fix-mixed-struct (patch by Pip Cet)
[tinycc.git] / i386-tok.h
Commit [+]AuthorDateLineData
1308e8eb grischka2009-12-19 22:08:37 +01001/* ------------------------------------------------------------------ */
ae23c46c Frederic Feret2009-08-27 14:25:56 +02002/* WARNING: relative order of tokens is important. */
1308e8eb grischka2009-12-19 22:08:37 +01003
4/* register */
ae23c46c
FF
Frederic Feret2009-08-27 14:25:56 +02005 DEF_ASM(al)
6 DEF_ASM(cl)
7 DEF_ASM(dl)
8 DEF_ASM(bl)
9 DEF_ASM(ah)
10 DEF_ASM(ch)
11 DEF_ASM(dh)
12 DEF_ASM(bh)
13 DEF_ASM(ax)
14 DEF_ASM(cx)
15 DEF_ASM(dx)
16 DEF_ASM(bx)
17 DEF_ASM(sp)
18 DEF_ASM(bp)
19 DEF_ASM(si)
20 DEF_ASM(di)
21 DEF_ASM(eax)
22 DEF_ASM(ecx)
23 DEF_ASM(edx)
24 DEF_ASM(ebx)
25 DEF_ASM(esp)
26 DEF_ASM(ebp)
27 DEF_ASM(esi)
28 DEF_ASM(edi)
1308e8eb grischka2009-12-19 22:08:37 +010029#ifdef TCC_TARGET_X86_64
30 DEF_ASM(rax)
31 DEF_ASM(rcx)
32 DEF_ASM(rdx)
33 DEF_ASM(rbx)
34 DEF_ASM(rsp)
35 DEF_ASM(rbp)
36 DEF_ASM(rsi)
37 DEF_ASM(rdi)
38#endif
ae23c46c
FF
Frederic Feret2009-08-27 14:25:56 +020039 DEF_ASM(mm0)
40 DEF_ASM(mm1)
41 DEF_ASM(mm2)
42 DEF_ASM(mm3)
43 DEF_ASM(mm4)
44 DEF_ASM(mm5)
45 DEF_ASM(mm6)
46 DEF_ASM(mm7)
47 DEF_ASM(xmm0)
48 DEF_ASM(xmm1)
49 DEF_ASM(xmm2)
50 DEF_ASM(xmm3)
51 DEF_ASM(xmm4)
52 DEF_ASM(xmm5)
53 DEF_ASM(xmm6)
54 DEF_ASM(xmm7)
55 DEF_ASM(cr0)
56 DEF_ASM(cr1)
57 DEF_ASM(cr2)
58 DEF_ASM(cr3)
59 DEF_ASM(cr4)
60 DEF_ASM(cr5)
61 DEF_ASM(cr6)
62 DEF_ASM(cr7)
63 DEF_ASM(tr0)
64 DEF_ASM(tr1)
65 DEF_ASM(tr2)
66 DEF_ASM(tr3)
67 DEF_ASM(tr4)
68 DEF_ASM(tr5)
69 DEF_ASM(tr6)
70 DEF_ASM(tr7)
71 DEF_ASM(db0)
72 DEF_ASM(db1)
73 DEF_ASM(db2)
74 DEF_ASM(db3)
75 DEF_ASM(db4)
76 DEF_ASM(db5)
77 DEF_ASM(db6)
78 DEF_ASM(db7)
79 DEF_ASM(dr0)
80 DEF_ASM(dr1)
81 DEF_ASM(dr2)
82 DEF_ASM(dr3)
83 DEF_ASM(dr4)
84 DEF_ASM(dr5)
85 DEF_ASM(dr6)
86 DEF_ASM(dr7)
87 DEF_ASM(es)
88 DEF_ASM(cs)
89 DEF_ASM(ss)
90 DEF_ASM(ds)
91 DEF_ASM(fs)
92 DEF_ASM(gs)
93 DEF_ASM(st)
94
ae23c46c Frederic Feret2009-08-27 14:25:56 +020095 /* generic two operands */
1308e8eb grischka2009-12-19 22:08:37 +010096 DEF_BWLX(mov)
97
98 DEF_BWLX(add)
99 DEF_BWLX(or)
100 DEF_BWLX(adc)
101 DEF_BWLX(sbb)
102 DEF_BWLX(and)
103 DEF_BWLX(sub)
104 DEF_BWLX(xor)
105 DEF_BWLX(cmp)
ae23c46c
FF
Frederic Feret2009-08-27 14:25:56 +0200106
107 /* unary ops */
1308e8eb grischka2009-12-19 22:08:37 +0100108 DEF_BWLX(inc)
109 DEF_BWLX(dec)
110 DEF_BWLX(not)
111 DEF_BWLX(neg)
112 DEF_BWLX(mul)
113 DEF_BWLX(imul)
114 DEF_BWLX(div)
115 DEF_BWLX(idiv)
116
117 DEF_BWLX(xchg)
118 DEF_BWLX(test)
ae23c46c
FF
Frederic Feret2009-08-27 14:25:56 +0200119
120 /* shifts */
1308e8eb grischka2009-12-19 22:08:37 +0100121 DEF_BWLX(rol)
122 DEF_BWLX(ror)
123 DEF_BWLX(rcl)
124 DEF_BWLX(rcr)
125 DEF_BWLX(shl)
126 DEF_BWLX(shr)
127 DEF_BWLX(sar)
ae23c46c
FF
Frederic Feret2009-08-27 14:25:56 +0200128
129 DEF_ASM(shldw)
130 DEF_ASM(shldl)
131 DEF_ASM(shld)
132 DEF_ASM(shrdw)
133 DEF_ASM(shrdl)
134 DEF_ASM(shrd)
135
136 DEF_ASM(pushw)
137 DEF_ASM(pushl)
1308e8eb grischka2009-12-19 22:08:37 +0100138#ifdef TCC_TARGET_X86_64
139 DEF_ASM(pushq)
140#endif
ae23c46c Frederic Feret2009-08-27 14:25:56 +0200141 DEF_ASM(push)
1308e8eb grischka2009-12-19 22:08:37 +0100142
ae23c46c
FF
Frederic Feret2009-08-27 14:25:56 +0200143 DEF_ASM(popw)
144 DEF_ASM(popl)
1308e8eb grischka2009-12-19 22:08:37 +0100145#ifdef TCC_TARGET_X86_64
146 DEF_ASM(popq)
147#endif
ae23c46c Frederic Feret2009-08-27 14:25:56 +0200148 DEF_ASM(pop)
1308e8eb grischka2009-12-19 22:08:37 +0100149
ae23c46c
FF
Frederic Feret2009-08-27 14:25:56 +0200150 DEF_BWL(in)
151 DEF_BWL(out)
152
153 DEF_WL(movzb)
ae23c46c
FF
Frederic Feret2009-08-27 14:25:56 +0200154 DEF_ASM(movzwl)
155 DEF_ASM(movsbw)
156 DEF_ASM(movsbl)
157 DEF_ASM(movswl)
1308e8eb grischka2009-12-19 22:08:37 +0100158#ifdef TCC_TARGET_X86_64
159 DEF_ASM(movslq)
160#endif
ae23c46c Frederic Feret2009-08-27 14:25:56 +0200161
1308e8eb grischka2009-12-19 22:08:37 +0100162 DEF_WLX(lea)
ae23c46c
FF
Frederic Feret2009-08-27 14:25:56 +0200163
164 DEF_ASM(les)
165 DEF_ASM(lds)
166 DEF_ASM(lss)
167 DEF_ASM(lfs)
168 DEF_ASM(lgs)
169
170 DEF_ASM(call)
171 DEF_ASM(jmp)
172 DEF_ASM(lcall)
173 DEF_ASM(ljmp)
174
e260b036 seyko2015-01-06 22:59:19 +0300175 DEF_ASMTEST(j,)
ae23c46c Frederic Feret2009-08-27 14:25:56 +0200176
e260b036 seyko2015-01-06 22:59:19 +0300177 DEF_ASMTEST(set,)
178 DEF_ASMTEST(set,b)
179 DEF_ASMTEST(cmov,)
ae23c46c Frederic Feret2009-08-27 14:25:56 +0200180
1308e8eb grischka2009-12-19 22:08:37 +0100181 DEF_WLX(bsf)
182 DEF_WLX(bsr)
183 DEF_WLX(bt)
184 DEF_WLX(bts)
185 DEF_WLX(btr)
186 DEF_WLX(btc)
ae23c46c Frederic Feret2009-08-27 14:25:56 +0200187
1308e8eb grischka2009-12-19 22:08:37 +0100188 DEF_WLX(lsl)
ae23c46c
FF
Frederic Feret2009-08-27 14:25:56 +0200189
190 /* generic FP ops */
191 DEF_FP(add)
192 DEF_FP(mul)
193
194 DEF_ASM(fcom)
3e9a7e9d Vincent Lefevre2014-04-07 13:31:00 +0200195 DEF_ASM(fcom_1) /* non existent op, just to have a regular table */
ae23c46c
FF
Frederic Feret2009-08-27 14:25:56 +0200196 DEF_FP1(com)
197
198 DEF_FP(comp)
199 DEF_FP(sub)
200 DEF_FP(subr)
201 DEF_FP(div)
202 DEF_FP(divr)
203
1308e8eb grischka2009-12-19 22:08:37 +0100204 DEF_BWLX(xadd)
205 DEF_BWLX(cmpxchg)
ae23c46c
FF
Frederic Feret2009-08-27 14:25:56 +0200206
207 /* string ops */
1308e8eb grischka2009-12-19 22:08:37 +0100208 DEF_BWLX(cmps)
209 DEF_BWLX(scmp)
ae23c46c
FF
Frederic Feret2009-08-27 14:25:56 +0200210 DEF_BWL(ins)
211 DEF_BWL(outs)
1308e8eb grischka2009-12-19 22:08:37 +0100212 DEF_BWLX(lods)
213 DEF_BWLX(slod)
214 DEF_BWLX(movs)
215 DEF_BWLX(smov)
216 DEF_BWLX(scas)
217 DEF_BWLX(ssca)
218 DEF_BWLX(stos)
219 DEF_BWLX(ssto)
ae23c46c
FF
Frederic Feret2009-08-27 14:25:56 +0200220
221 /* generic asm ops */
ae23c46c
FF
Frederic Feret2009-08-27 14:25:56 +0200222#define ALT(x)
223#define DEF_ASM_OP0(name, opcode) DEF_ASM(name)
224#define DEF_ASM_OP0L(name, opcode, group, instr_type)
225#define DEF_ASM_OP1(name, opcode, group, instr_type, op0)
226#define DEF_ASM_OP2(name, opcode, group, instr_type, op0, op1)
227#define DEF_ASM_OP3(name, opcode, group, instr_type, op0, op1, op2)
1308e8eb grischka2009-12-19 22:08:37 +0100228#ifdef TCC_TARGET_X86_64
229# include "x86_64-asm.h"
230#else
231# include "i386-asm.h"
232#endif
ae23c46c
FF
Frederic Feret2009-08-27 14:25:56 +0200233
234#define ALT(x)
235#define DEF_ASM_OP0(name, opcode)
236#define DEF_ASM_OP0L(name, opcode, group, instr_type) DEF_ASM(name)
237#define DEF_ASM_OP1(name, opcode, group, instr_type, op0) DEF_ASM(name)
238#define DEF_ASM_OP2(name, opcode, group, instr_type, op0, op1) DEF_ASM(name)
239#define DEF_ASM_OP3(name, opcode, group, instr_type, op0, op1, op2) DEF_ASM(name)
1308e8eb grischka2009-12-19 22:08:37 +0100240#ifdef TCC_TARGET_X86_64
241# include "x86_64-asm.h"
242#else
243# include "i386-asm.h"
244#endif