1#ifndef X /* amd64 */
2 #define X(NMemArgs, SetsZeroFlag, LeavesFlags)
3#endif
4
5#ifndef V /* riscv64 */
6 #define V(Imm)
7#endif
8
9
10#define T(a,b,c,d,e,f,g,h) { \
11 {[Kw]=K##a, [Kl]=K##b, [Ks]=K##c, [Kd]=K##d}, \
12 {[Kw]=K##e, [Kl]=K##f, [Ks]=K##g, [Kd]=K##h} \
13}
14
15
16/*********************/
17/* PUBLIC OPERATIONS */
18/*********************/
19
20/* Arithmetic and Bits */
21O(add, T(w,l,s,d, w,l,s,d), 1) X(2, 1, 0) V(1)
22O(sub, T(w,l,s,d, w,l,s,d), 1) X(2, 1, 0) V(0)
23O(neg, T(w,l,s,d, x,x,x,x), 1) X(1, 1, 0) V(0)
24O(div, T(w,l,s,d, w,l,s,d), 1) X(0, 0, 0) V(0)
25O(rem, T(w,l,e,e, w,l,e,e), 1) X(0, 0, 0) V(0)
26O(udiv, T(w,l,e,e, w,l,e,e), 1) X(0, 0, 0) V(0)
27O(urem, T(w,l,e,e, w,l,e,e), 1) X(0, 0, 0) V(0)
28O(mul, T(w,l,s,d, w,l,s,d), 1) X(2, 0, 0) V(0)
29O(and, T(w,l,e,e, w,l,e,e), 1) X(2, 1, 0) V(1)
30O(or, T(w,l,e,e, w,l,e,e), 1) X(2, 1, 0) V(1)
31O(xor, T(w,l,e,e, w,l,e,e), 1) X(2, 1, 0) V(1)
32O(sar, T(w,l,e,e, w,w,e,e), 1) X(1, 1, 0) V(1)
33O(shr, T(w,l,e,e, w,w,e,e), 1) X(1, 1, 0) V(1)
34O(shl, T(w,l,e,e, w,w,e,e), 1) X(1, 1, 0) V(1)
35
36/* Comparisons */
37O(ceqw, T(w,w,e,e, w,w,e,e), 1) X(0, 1, 0) V(0)
38O(cnew, T(w,w,e,e, w,w,e,e), 1) X(0, 1, 0) V(0)
39O(csgew, T(w,w,e,e, w,w,e,e), 1) X(0, 1, 0) V(0)
40O(csgtw, T(w,w,e,e, w,w,e,e), 1) X(0, 1, 0) V(0)
41O(cslew, T(w,w,e,e, w,w,e,e), 1) X(0, 1, 0) V(0)
42O(csltw, T(w,w,e,e, w,w,e,e), 1) X(0, 1, 0) V(1)
43O(cugew, T(w,w,e,e, w,w,e,e), 1) X(0, 1, 0) V(0)
44O(cugtw, T(w,w,e,e, w,w,e,e), 1) X(0, 1, 0) V(0)
45O(culew, T(w,w,e,e, w,w,e,e), 1) X(0, 1, 0) V(0)
46O(cultw, T(w,w,e,e, w,w,e,e), 1) X(0, 1, 0) V(1)
47
48O(ceql, T(l,l,e,e, l,l,e,e), 1) X(0, 1, 0) V(0)
49O(cnel, T(l,l,e,e, l,l,e,e), 1) X(0, 1, 0) V(0)
50O(csgel, T(l,l,e,e, l,l,e,e), 1) X(0, 1, 0) V(0)
51O(csgtl, T(l,l,e,e, l,l,e,e), 1) X(0, 1, 0) V(0)
52O(cslel, T(l,l,e,e, l,l,e,e), 1) X(0, 1, 0) V(0)
53O(csltl, T(l,l,e,e, l,l,e,e), 1) X(0, 1, 0) V(1)
54O(cugel, T(l,l,e,e, l,l,e,e), 1) X(0, 1, 0) V(0)
55O(cugtl, T(l,l,e,e, l,l,e,e), 1) X(0, 1, 0) V(0)
56O(culel, T(l,l,e,e, l,l,e,e), 1) X(0, 1, 0) V(0)
57O(cultl, T(l,l,e,e, l,l,e,e), 1) X(0, 1, 0) V(1)
58
59O(ceqs, T(s,s,e,e, s,s,e,e), 1) X(0, 1, 0) V(0)
60O(cges, T(s,s,e,e, s,s,e,e), 1) X(0, 1, 0) V(0)
61O(cgts, T(s,s,e,e, s,s,e,e), 1) X(0, 1, 0) V(0)
62O(cles, T(s,s,e,e, s,s,e,e), 1) X(0, 1, 0) V(0)
63O(clts, T(s,s,e,e, s,s,e,e), 1) X(0, 1, 0) V(0)
64O(cnes, T(s,s,e,e, s,s,e,e), 1) X(0, 1, 0) V(0)
65O(cos, T(s,s,e,e, s,s,e,e), 1) X(0, 1, 0) V(0)
66O(cuos, T(s,s,e,e, s,s,e,e), 1) X(0, 1, 0) V(0)
67
68O(ceqd, T(d,d,e,e, d,d,e,e), 1) X(0, 1, 0) V(0)
69O(cged, T(d,d,e,e, d,d,e,e), 1) X(0, 1, 0) V(0)
70O(cgtd, T(d,d,e,e, d,d,e,e), 1) X(0, 1, 0) V(0)
71O(cled, T(d,d,e,e, d,d,e,e), 1) X(0, 1, 0) V(0)
72O(cltd, T(d,d,e,e, d,d,e,e), 1) X(0, 1, 0) V(0)
73O(cned, T(d,d,e,e, d,d,e,e), 1) X(0, 1, 0) V(0)
74O(cod, T(d,d,e,e, d,d,e,e), 1) X(0, 1, 0) V(0)
75O(cuod, T(d,d,e,e, d,d,e,e), 1) X(0, 1, 0) V(0)
76
77/* Memory */
78O(storeb, T(w,e,e,e, m,e,e,e), 0) X(0, 0, 1) V(0)
79O(storeh, T(w,e,e,e, m,e,e,e), 0) X(0, 0, 1) V(0)
80O(storew, T(w,e,e,e, m,e,e,e), 0) X(0, 0, 1) V(0)
81O(storel, T(l,e,e,e, m,e,e,e), 0) X(0, 0, 1) V(0)
82O(stores, T(s,e,e,e, m,e,e,e), 0) X(0, 0, 1) V(0)
83O(stored, T(d,e,e,e, m,e,e,e), 0) X(0, 0, 1) V(0)
84
85O(loadsb, T(m,m,e,e, x,x,e,e), 0) X(0, 0, 1) V(0)
86O(loadub, T(m,m,e,e, x,x,e,e), 0) X(0, 0, 1) V(0)
87O(loadsh, T(m,m,e,e, x,x,e,e), 0) X(0, 0, 1) V(0)
88O(loaduh, T(m,m,e,e, x,x,e,e), 0) X(0, 0, 1) V(0)
89O(loadsw, T(m,m,e,e, x,x,e,e), 0) X(0, 0, 1) V(0)
90O(loaduw, T(m,m,e,e, x,x,e,e), 0) X(0, 0, 1) V(0)
91O(load, T(m,m,m,m, x,x,x,x), 0) X(0, 0, 1) V(0)
92
93/* Extensions and Truncations */
94O(extsb, T(w,w,e,e, x,x,e,e), 1) X(0, 0, 1) V(0)
95O(extub, T(w,w,e,e, x,x,e,e), 1) X(0, 0, 1) V(0)
96O(extsh, T(w,w,e,e, x,x,e,e), 1) X(0, 0, 1) V(0)
97O(extuh, T(w,w,e,e, x,x,e,e), 1) X(0, 0, 1) V(0)
98O(extsw, T(e,w,e,e, e,x,e,e), 1) X(0, 0, 1) V(0)
99O(extuw, T(e,w,e,e, e,x,e,e), 1) X(0, 0, 1) V(0)
100
101O(exts, T(e,e,e,s, e,e,e,x), 1) X(0, 0, 1) V(0)
102O(truncd, T(e,e,d,e, e,e,x,e), 1) X(0, 0, 1) V(0)
103O(stosi, T(s,s,e,e, x,x,e,e), 1) X(0, 0, 1) V(0)
104O(stoui, T(s,s,e,e, x,x,e,e), 1) X(0, 0, 1) V(0)
105O(dtosi, T(d,d,e,e, x,x,e,e), 1) X(0, 0, 1) V(0)
106O(dtoui, T(d,d,e,e, x,x,e,e), 1) X(0, 0, 1) V(0)
107O(swtof, T(e,e,w,w, e,e,x,x), 1) X(0, 0, 1) V(0)
108O(uwtof, T(e,e,w,w, e,e,x,x), 1) X(0, 0, 1) V(0)
109O(sltof, T(e,e,l,l, e,e,x,x), 1) X(0, 0, 1) V(0)
110O(ultof, T(e,e,l,l, e,e,x,x), 1) X(0, 0, 1) V(0)
111O(cast, T(s,d,w,l, x,x,x,x), 1) X(0, 0, 1) V(0)
112
113/* Stack Allocation */
114O(alloc4, T(e,l,e,e, e,x,e,e), 0) X(0, 0, 0) V(0)
115O(alloc8, T(e,l,e,e, e,x,e,e), 0) X(0, 0, 0) V(0)
116O(alloc16, T(e,l,e,e, e,x,e,e), 0) X(0, 0, 0) V(0)
117
118/* Variadic Function Helpers */
119O(vaarg, T(m,m,m,m, x,x,x,x), 0) X(0, 0, 0) V(0)
120O(vastart, T(m,e,e,e, x,e,e,e), 0) X(0, 0, 0) V(0)
121
122O(copy, T(w,l,s,d, x,x,x,x), 0) X(0, 0, 1) V(0)
123
124
125/****************************************/
126/* INTERNAL OPERATIONS (keep nop first) */
127/****************************************/
128
129/* Miscellaneous and Architecture-Specific Operations */
130O(nop, T(x,x,x,x, x,x,x,x), 0) X(0, 0, 1) V(0)
131O(addr, T(m,m,e,e, x,x,e,e), 0) X(0, 0, 1) V(0)
132O(swap, T(w,l,s,d, w,l,s,d), 0) X(1, 0, 0) V(0)
133O(sign, T(w,l,e,e, x,x,e,e), 0) X(0, 0, 0) V(0)
134O(salloc, T(e,l,e,e, e,x,e,e), 0) X(0, 0, 0) V(0)
135O(xidiv, T(w,l,e,e, x,x,e,e), 0) X(1, 0, 0) V(0)
136O(xdiv, T(w,l,e,e, x,x,e,e), 0) X(1, 0, 0) V(0)
137O(xcmp, T(w,l,s,d, w,l,s,d), 0) X(1, 1, 0) V(0)
138O(xtest, T(w,l,e,e, w,l,e,e), 0) X(1, 1, 0) V(0)
139O(acmp, T(w,l,e,e, w,l,e,e), 0) X(0, 0, 0) V(0)
140O(acmn, T(w,l,e,e, w,l,e,e), 0) X(0, 0, 0) V(0)
141O(afcmp, T(e,e,s,d, e,e,s,d), 0) X(0, 0, 0) V(0)
142O(reqz, T(w,l,e,e, x,x,e,e), 0) X(0, 0, 0) V(0)
143O(rnez, T(w,l,e,e, x,x,e,e), 0) X(0, 0, 0) V(0)
144
145/* Arguments, Parameters, and Calls */
146O(par, T(x,x,x,x, x,x,x,x), 0) X(0, 0, 0) V(0)
147O(parc, T(e,x,e,e, e,x,e,e), 0) X(0, 0, 0) V(0)
148O(pare, T(e,x,e,e, e,x,e,e), 0) X(0, 0, 0) V(0)
149O(arg, T(w,l,s,d, x,x,x,x), 0) X(0, 0, 0) V(0)
150O(argc, T(e,x,e,e, e,l,e,e), 0) X(0, 0, 0) V(0)
151O(arge, T(e,l,e,e, e,x,e,e), 0) X(0, 0, 0) V(0)
152O(argv, T(x,x,x,x, x,x,x,x), 0) X(0, 0, 0) V(0)
153O(call, T(m,m,m,m, x,x,x,x), 0) X(0, 0, 0) V(0)
154
155/* Flags Setting */
156O(flagieq, T(x,x,e,e, x,x,e,e), 0) X(0, 0, 1) V(0)
157O(flagine, T(x,x,e,e, x,x,e,e), 0) X(0, 0, 1) V(0)
158O(flagisge, T(x,x,e,e, x,x,e,e), 0) X(0, 0, 1) V(0)
159O(flagisgt, T(x,x,e,e, x,x,e,e), 0) X(0, 0, 1) V(0)
160O(flagisle, T(x,x,e,e, x,x,e,e), 0) X(0, 0, 1) V(0)
161O(flagislt, T(x,x,e,e, x,x,e,e), 0) X(0, 0, 1) V(0)
162O(flagiuge, T(x,x,e,e, x,x,e,e), 0) X(0, 0, 1) V(0)
163O(flagiugt, T(x,x,e,e, x,x,e,e), 0) X(0, 0, 1) V(0)
164O(flagiule, T(x,x,e,e, x,x,e,e), 0) X(0, 0, 1) V(0)
165O(flagiult, T(x,x,e,e, x,x,e,e), 0) X(0, 0, 1) V(0)
166O(flagfeq, T(x,x,e,e, x,x,e,e), 0) X(0, 0, 1) V(0)
167O(flagfge, T(x,x,e,e, x,x,e,e), 0) X(0, 0, 1) V(0)
168O(flagfgt, T(x,x,e,e, x,x,e,e), 0) X(0, 0, 1) V(0)
169O(flagfle, T(x,x,e,e, x,x,e,e), 0) X(0, 0, 1) V(0)
170O(flagflt, T(x,x,e,e, x,x,e,e), 0) X(0, 0, 1) V(0)
171O(flagfne, T(x,x,e,e, x,x,e,e), 0) X(0, 0, 1) V(0)
172O(flagfo, T(x,x,e,e, x,x,e,e), 0) X(0, 0, 1) V(0)
173O(flagfuo, T(x,x,e,e, x,x,e,e), 0) X(0, 0, 1) V(0)
174
175
176#undef T
177#undef X
178#undef V
179#undef O
180
181/*
182| column -t -o ' '
183*/
184