1.text
2.intel_syntax noprefix
3# REX prefix and addressing modes.
4add edx,ecx
5add edx,r9d
6add r10d,ecx
7add rdx,rcx
8add r10,r9
9add r8d,eax
10add r8w,ax
11add r8,rax
12add eax,0x44332211
13add rax,0xfffffffff4332211
14add ax,0x4433
15add rax,0x44332211
16add dl,cl
17add bh,dh
18add dil,sil
19add r15b,sil
20add dil,r14b
21add r15b,r14b
22PUSH RAX
23PUSH R8
24POP R9
25ADD AL,0x11
26ADD AH,0x11
27ADD SPL,0x11
28ADD R8B,0x11
29ADD R12B,0x11
30MOV RAX,CR0
31MOV R8,CR0
32MOV RAX,CR8
33MOV CR8,RAX
34REP MOVSQ #[RSI],[RDI]
35REP MOVSW #[RSI,[RDI]
36REP MOVSQ #[RSI],[RDI]
37MOV AL, 0x11
38MOV AH, 0x11
39MOV SPL, 0x11
40MOV R12B, 0x11
41MOV EAX,0x11223344
42MOV R8D,0x11223344
43MOV RAX,0x1122334455667788
44MOV R8,0x1122334455667788
45add eax,[rax]
46ADD EAX,[R8]
47ADD R8D,[R8]
48ADD RAX,[R8]
49ADD EAX,[0x22222222+RIP]
50ADD EAX,[RBP+0x00]
51ADD EAX,FLAT:[0x22222222]
52ADD EAX,[R13+0]
53ADD EAX,[RAX+RAX*4]
54ADD EAX,[R8+RAX*4]
55ADD R8D,[R8+RAX*4]
56ADD EAX,[R8+R8*4]
57ADD [RCX+R8*4],R8D
58ADD EDX,[RAX+RAX*8]
59ADD EDX,[RAX+RCX*8]
60ADD EDX,[RAX+RDX*8]
61ADD EDX,[RAX+RBX*8]
62ADD EDX,[RAX]
63ADD EDX,[RAX+RBP*8]
64ADD EDX,[RAX+RSI*8]
65ADD EDX,[RAX+RDI*8]
66ADD EDX,[RAX+R8*8]
67ADD EDX,[RAX+R9*8]
68ADD EDX,[RAX+R10*8]
69ADD EDX,[RAX+R11*8]
70ADD EDX,[RAX+R12*8]
71ADD EDX,[RAX+R13*8]
72ADD EDX,[RAX+R14*8]
73ADD EDX,[RAX+R15*8]
74ADD ECX,0x11
75ADD DWORD PTR [RAX],0x11
76ADD QWORD PTR [RAX],0x11
77ADD DWORD PTR [R8],0x11
78ADD DWORD PTR [RCX+RAX*4],0x11
79ADD DWORD PTR [R9+RAX*4],0x11
80ADD DWORD PTR [RCX+R8*4],0x11
81ADD DWORD PTR [0x22222222+RIP],0x33
82ADD QWORD PTR [RIP+0x22222222],0x33
83ADD DWORD PTR [RIP+0x22222222],0x33333333
84ADD QWORD PTR [RIP+0x22222222],0x33333333
85ADD DWORD PTR [RAX*8+0x22222222],0x33
86ADD DWORD PTR [RAX+0x22222222],0x33
87ADD DWORD PTR [RAX+0x22222222],0x33
88ADD DWORD PTR [R8+RBP*8],0x33
89ADD DWORD PTR FLAT:[0x22222222],0x33
90#new instructions
91MOVABS AL,FLAT:[0x8877665544332211]
92MOVABS EAX,FLAT:[0x8877665544332211]
93MOVABS FLAT:[0x8877665544332211],AL
94MOVABS FLAT:[0x8877665544332211],EAX
95MOVABS RAX,FLAT:[0x8877665544332211]
96MOVABS FLAT:[0x8877665544332211],RAX
97cqo
98cdqe
99movsx rax, eax
100movsx rax, ax
101movsx rax, al
102retf
103retf 16
104retfw
105retfw 2
106retfd
107retfd 4
108retfq
109retfq 8
110bar:
111.att_syntax
112#testcase for symbol references.
113
114#immediates - various sizes:
115
116mov $symbol, %al
117mov $symbol, %ax
118mov $symbol, %eax
119mov $symbol, %rax
120
121#addressing modes:
122
123#absolute 64bit addressing
124movabs symbol, %eax
125
126#absolute 32bit addressing
127mov symbol, %eax
128
129#arithmetic
130mov symbol(%rax), %eax
131
132#RIP relative
133mov symbol(%rip), %eax
134
135.intel_syntax noprefix
136
137#immediates - various sizes:
138mov al, offset flat:symbol
139mov ax, offset flat:symbol
140mov eax, offset flat:symbol
141mov rax, offset flat:symbol
142
143#parts aren't supported by the parser, yet (and not at all for symbol refs)
144#mov eax, high part symbol
145#mov eax, low part symbol
146
147#addressing modes
148
149#absolute 64bit addressing
150movabs eax, [symbol]
151
152#absolute 32bit addressing
153mov eax, [symbol]
154
155#arithmetic
156mov eax, [rax+symbol]
157
158#RIP relative
159mov eax, [rip+symbol]
160
161foo:
162.att_syntax
163#absolute 64bit addressing
164mov 0x8877665544332211,%al
165mov 0x8877665544332211,%ax
166mov 0x8877665544332211,%eax
167mov 0x8877665544332211,%rax
168mov %al,0x8877665544332211
169mov %ax,0x8877665544332211
170mov %eax,0x8877665544332211
171mov %rax,0x8877665544332211
172movb 0x8877665544332211,%al
173movw 0x8877665544332211,%ax
174movl 0x8877665544332211,%eax
175movq 0x8877665544332211,%rax
176movb %al,0x8877665544332211
177movw %ax,0x8877665544332211
178movl %eax,0x8877665544332211
179movq %rax,0x8877665544332211
180
181#absolute signed 32bit addressing
182mov 0xffffffffff332211,%al
183mov 0xffffffffff332211,%ax
184mov 0xffffffffff332211,%eax
185mov 0xffffffffff332211,%rax
186mov %al,0xffffffffff332211
187mov %ax,0xffffffffff332211
188mov %eax,0xffffffffff332211
189mov %rax,0xffffffffff332211
190movb 0xffffffffff332211,%al
191movw 0xffffffffff332211,%ax
192movl 0xffffffffff332211,%eax
193movq 0xffffffffff332211,%rax
194movb %al,0xffffffffff332211
195movw %ax,0xffffffffff332211
196movl %eax,0xffffffffff332211
197movq %rax,0xffffffffff332211
198
199cmpxchg16b (%rax)
200
201.intel_syntax noprefix
202cmpxchg16b oword ptr [rax]
203
204.att_syntax
205	movsx	%al, %si
206	movsx	%al, %esi
207	movsx	%al, %rsi
208	movsx	%ax, %esi
209	movsx	%ax, %rsi
210	movsx	%eax, %rsi
211	movsx	(%rax), %dx
212	movsbl	(%rax), %edx
213	movsbq	(%rax), %rdx
214	movsbw	(%rax), %dx
215	movswl	(%rax), %edx
216	movswq	(%rax), %rdx
217
218	movzx	%al, %si
219	movzx	%al, %esi
220	movzx	%al, %rsi
221	movzx	%ax, %esi
222	movzx	%ax, %rsi
223	movzx	(%rax), %dx
224	movzb	(%rax), %edx
225	movzb	(%rax), %rdx
226	movzb	(%rax), %dx
227	movzbl	(%rax), %edx
228	movzbq	(%rax), %rdx
229	movzbw	(%rax), %dx
230	movzwl	(%rax), %edx
231	movzwq	(%rax), %rdx
232
233	.intel_syntax noprefix
234	movsx	si,al
235	movsx	esi,al
236	movsx	rsi,al
237	movsx	esi,ax
238	movsx	rsi,ax
239	movsx	rsi,eax
240	movsx	edx,BYTE PTR [rax]
241	movsx	rdx,BYTE PTR [rax]
242	movsx	dx,BYTE PTR [rax]
243	movsx	edx,WORD PTR [rax]
244	movsx	rdx,WORD PTR [rax]
245
246	movzx	si,al
247	movzx	esi,al
248	movzx	rsi,al
249	movzx	esi,ax
250	movzx	rsi,ax
251	movzx	edx,BYTE PTR [rax]
252	movzx	rdx,BYTE PTR [rax]
253	movzx	dx,BYTE PTR [rax]
254	movzx	edx,WORD PTR [rax]
255	movzx	rdx,WORD PTR [rax]
256
257	movq	xmm1,QWORD PTR [rsp]
258	movq	xmm1,[rsp]
259	movq	QWORD PTR [rsp],xmm1
260	movq	[rsp],xmm1
261
262.att_syntax
263	fnstsw
264	fnstsw	%ax
265	fstsw
266	fstsw	%ax
267
268	.intel_syntax noprefix
269	fnstsw
270	fnstsw	ax
271	fstsw
272	fstsw	ax
273
274.att_syntax
275movsx (%rax),%ax
276movsxb	(%rax), %dx
277movsxb	(%rax), %edx
278movsxb	(%rax), %rdx
279movsxw	(%rax), %edx
280movsxw	(%rax), %rdx
281movsxl	(%rax), %rdx
282movsxd (%rax),%rax
283movzx (%rax),%ax
284movzxb	(%rax), %dx
285movzxb	(%rax), %edx
286movzxb	(%rax), %rdx
287movzxw	(%rax), %edx
288movzxw	(%rax), %rdx
289
290movnti %eax, (%rax)
291movntil %eax, (%rax)
292movnti %rax, (%rax)
293movntiq %rax, (%rax)
294
295.intel_syntax noprefix
296
297movsx ax, BYTE PTR [rax]
298movsx eax, BYTE PTR [rax]
299movsx eax, WORD PTR [rax]
300movsx rax, WORD PTR [rax]
301movsx rax, DWORD PTR [rax]
302movsxd rax, [rax]
303movzx ax, BYTE PTR [rax]
304movzx eax, BYTE PTR [rax]
305movzx eax, WORD PTR [rax]
306movzx rax, WORD PTR [rax]
307
308movnti dword ptr [rax], eax
309movnti qword ptr [rax], rax
310
311mov eax, tr1
312mov tr0, rcx
313