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