1// RUN: llvm-mc -triple x86_64-unknown-unknown -x86-asm-syntax=intel %s | FileCheck %s
2
3_test:
4	xor	EAX, EAX
5	ret
6
7_main:
8// CHECK:	movl	$257, -4(%rsp)
9	mov	DWORD PTR [RSP - 4], 257
10// CHECK:	movl	$258, 4(%rsp)
11	mov	DWORD PTR [RSP + 4], 258
12// CHECK:	movq	$123, -16(%rsp)
13	mov	QWORD PTR [RSP - 16], 123
14// CHECK:	movb	$97, -17(%rsp)
15	mov	BYTE PTR [RSP - 17], 97
16// CHECK:	movl	-4(%rsp), %eax
17	mov	EAX, DWORD PTR [RSP - 4]
18// CHECK:	movq    (%rsp), %rax
19	mov     RAX, QWORD PTR [RSP]
20// CHECK:	movl	$-4, -4(%rsp)
21	mov	DWORD PTR [RSP - 4], -4
22// CHECK:	movq	0, %rcx
23	mov	RCX, QWORD PTR [0]
24// CHECK:	movl	-24(%rsp,%rax,4), %eax
25	mov	EAX, DWORD PTR [RSP + 4*RAX - 24]
26// CHECK:	movb	%dil, (%rdx,%rcx)
27	mov	BYTE PTR [RDX + RCX], DIL
28// CHECK:	movzwl	2(%rcx), %edi
29	movzx	EDI, WORD PTR [RCX + 2]
30// CHECK:	callq	_test
31	call	_test
32// CHECK:	andw	$12,	%ax
33	and	ax, 12
34// CHECK:	andw	$-12,	%ax
35	and	ax, -12
36// CHECK:	andw	$257,	%ax
37	and	ax, 257
38// CHECK:	andw	$-257,	%ax
39	and	ax, -257
40// CHECK:	andl	$12,	%eax
41	and	eax, 12
42// CHECK:	andl	$-12,	%eax
43	and	eax, -12
44// CHECK:	andl	$257,	%eax
45	and	eax, 257
46// CHECK:	andl	$-257,	%eax
47	and	eax, -257
48// CHECK:	andq	$12,	%rax
49	and	rax, 12
50// CHECK:	andq	$-12,	%rax
51	and	rax, -12
52// CHECK:	andq	$257,	%rax
53	and	rax, 257
54// CHECK:	andq	$-257,	%rax
55	and	rax, -257
56// CHECK:	fld	%st(0)
57	fld	ST(0)
58// CHECK:	movl	%fs:(%rdi), %eax
59    mov EAX, DWORD PTR FS:[RDI]
60// CHECK: leal (,%rdi,4), %r8d
61    lea R8D, DWORD PTR [4*RDI]
62// CHECK: movl _fnan(,%ecx,4), %ecx
63    mov ECX, DWORD PTR [4*ECX + _fnan]
64// CHECK: movq %fs:320, %rax
65    mov RAX, QWORD PTR FS:[320]
66// CHECK: movq %fs:320, %rax
67    mov RAX, QWORD PTR FS:320
68// CHECK: movq %rax, %fs:320
69    mov QWORD PTR FS:320, RAX
70// CHECK: movq %rax, %fs:20(%rbx)
71    mov QWORD PTR FS:20[rbx], RAX
72// CHECK: vshufpd $1, %xmm2, %xmm1, %xmm0
73    vshufpd XMM0, XMM1, XMM2, 1
74// CHECK: vpgatherdd %xmm8, (%r15,%xmm9,2), %xmm1
75    vpgatherdd XMM10, DWORD PTR [R15 + 2*XMM9], XMM8
76// CHECK: movsd	-8, %xmm5
77    movsd   XMM5, QWORD PTR [-8]
78// CHECK: movl %ecx, (%eax)
79    mov [eax], ecx
80// CHECK: movl %ecx, (,%ebx,4)
81    mov [4*ebx], ecx
82 // CHECK:   movl %ecx, (,%ebx,4)
83    mov [ebx*4], ecx
84// CHECK: movl %ecx, 1024
85    mov [1024], ecx
86// CHECK: movl %ecx, 4132
87    mov [0x1024], ecx
88// CHECK: movl %ecx, 32
89    mov [16 + 16], ecx
90// CHECK: movl %ecx, 0
91    mov [16 - 16], ecx
92// CHECK: movl %ecx, 32
93    mov [16][16], ecx
94// CHECK: movl %ecx, (%eax,%ebx,4)
95    mov [eax + 4*ebx], ecx
96// CHECK: movl %ecx, (%eax,%ebx,4)
97    mov [eax + ebx*4], ecx
98// CHECK: movl %ecx, (%eax,%ebx,4)
99    mov [4*ebx + eax], ecx
100// CHECK: movl %ecx, (%eax,%ebx,4)
101    mov [ebx*4 + eax], ecx
102// CHECK: movl %ecx, (%eax,%ebx,4)
103    mov [eax][4*ebx], ecx
104// CHECK: movl %ecx, (%eax,%ebx,4)
105    mov [eax][ebx*4], ecx
106// CHECK: movl %ecx, (%eax,%ebx,4)
107    mov [4*ebx][eax], ecx
108// CHECK: movl %ecx, (%eax,%ebx,4)
109    mov [ebx*4][eax], ecx
110// CHECK: movl %ecx, 12(%eax)
111    mov [eax + 12], ecx
112// CHECK: movl %ecx, 12(%eax)
113    mov [12 + eax], ecx
114// CHECK: movl %ecx, 32(%eax)
115    mov [eax + 16 + 16], ecx
116// CHECK: movl %ecx, 32(%eax)
117    mov [16 + eax + 16], ecx
118// CHECK: movl %ecx, 32(%eax)
119    mov [16 + 16 + eax], ecx
120// CHECK: movl %ecx, 12(%eax)
121    mov [eax][12], ecx
122// CHECK: movl %ecx, 12(%eax)
123    mov [12][eax], ecx
124// CHECK: movl %ecx, 32(%eax)
125    mov [eax][16 + 16], ecx
126// CHECK: movl %ecx, 32(%eax)
127    mov [eax + 16][16], ecx
128// CHECK: movl %ecx, 32(%eax)
129    mov [eax][16][16], ecx
130// CHECK: movl %ecx, 32(%eax)
131    mov [16][eax + 16], ecx
132// CHECK: movl %ecx, 32(%eax)
133    mov [16 + eax][16], ecx
134// CHECK: movl %ecx, 32(%eax)
135    mov [16][16 + eax], ecx
136// CHECK: movl %ecx, 32(%eax)
137    mov [16 + 16][eax], ecx
138// CHECK: movl %ecx, 32(%eax)
139    mov [eax][16][16], ecx
140// CHECK: movl %ecx, 32(%eax)
141    mov [16][eax][16], ecx
142// CHECK: movl %ecx, 32(%eax)
143    mov [16][16][eax], ecx
144// CHECK: movl %ecx, 16(,%ebx,4)
145    mov [4*ebx + 16], ecx
146// CHECK: movl %ecx, 16(,%ebx,4)
147    mov [ebx*4 + 16], ecx
148// CHECK: movl %ecx, 16(,%ebx,4)
149    mov [4*ebx][16], ecx
150// CHECK: movl %ecx, 16(,%ebx,4)
151    mov [ebx*4][16], ecx
152// CHECK: movl %ecx, 16(,%ebx,4)
153    mov [16 + 4*ebx], ecx
154// CHECK: movl %ecx, 16(,%ebx,4)
155    mov [16 + ebx*4], ecx
156// CHECK: movl %ecx, 16(,%ebx,4)
157    mov [16][4*ebx], ecx
158// CHECK: movl %ecx, 16(,%ebx,4)
159    mov [16][ebx*4], ecx
160// CHECK: movl %ecx, 16(%eax,%ebx,4)
161    mov [eax + 4*ebx + 16], ecx
162// CHECK: movl %ecx, 16(%eax,%ebx,4)
163    mov [eax + 16 + 4*ebx], ecx
164// CHECK: movl %ecx, 16(%eax,%ebx,4)
165    mov [4*ebx + eax + 16], ecx
166// CHECK: movl %ecx, 16(%eax,%ebx,4)
167    mov [4*ebx + 16 + eax], ecx
168// CHECK: movl %ecx, 16(%eax,%ebx,4)
169    mov [16 + eax + 4*ebx], ecx
170// CHECK: movl %ecx, 16(%eax,%ebx,4)
171    mov [16 + eax + 4*ebx], ecx
172// CHECK: movl %ecx, 16(%eax,%ebx,4)
173    mov [eax][4*ebx + 16], ecx
174// CHECK: movl %ecx, 16(%eax,%ebx,4)
175    mov [eax][16 + 4*ebx], ecx
176// CHECK: movl %ecx, 16(%eax,%ebx,4)
177    mov [4*ebx][eax + 16], ecx
178// CHECK: movl %ecx, 16(%eax,%ebx,4)
179    mov [4*ebx][16 + eax], ecx
180// CHECK: movl %ecx, 16(%eax,%ebx,4)
181    mov [16][eax + 4*ebx], ecx
182// CHECK: movl %ecx, 16(%eax,%ebx,4)
183    mov [16][eax + 4*ebx], ecx
184// CHECK: movl %ecx, 16(%eax,%ebx,4)
185    mov [eax + 4*ebx][16], ecx
186// CHECK: movl %ecx, 16(%eax,%ebx,4)
187    mov [eax + 16][4*ebx], ecx
188// CHECK: movl %ecx, 16(%eax,%ebx,4)
189    mov [4*ebx + eax][16], ecx
190// CHECK: movl %ecx, 16(%eax,%ebx,4)
191    mov [4*ebx + 16][eax], ecx
192// CHECK: movl %ecx, 16(%eax,%ebx,4)
193    mov [16 + eax][4*ebx], ecx
194// CHECK: movl %ecx, 16(%eax,%ebx,4)
195    mov [16 + eax][4*ebx], ecx
196// CHECK: movl %ecx, 16(%eax,%ebx,4)
197    mov [eax][4*ebx][16], ecx
198// CHECK: movl %ecx, 16(%eax,%ebx,4)
199    mov [eax][16][4*ebx], ecx
200// CHECK: movl %ecx, 16(%eax,%ebx,4)
201    mov [4*ebx][eax][16], ecx
202// CHECK: movl %ecx, 16(%eax,%ebx,4)
203    mov [4*ebx][16][eax], ecx
204// CHECK: movl %ecx, 16(%eax,%ebx,4)
205    mov [16][eax][4*ebx], ecx
206// CHECK: movl %ecx, 16(%eax,%ebx,4)
207    mov [16][eax][4*ebx], ecx
208// CHECK: movl %ecx, 16(%eax,%ebx,4)
209    mov [eax + ebx*4 + 16], ecx
210// CHECK: movl %ecx, 16(%eax,%ebx,4)
211    mov [eax + 16 + ebx*4], ecx
212// CHECK: movl %ecx, 16(%eax,%ebx,4)
213    mov [ebx*4 + eax + 16], ecx
214// CHECK: movl %ecx, 16(%eax,%ebx,4)
215    mov [ebx*4 + 16 + eax], ecx
216// CHECK: movl %ecx, 16(%eax,%ebx,4)
217    mov [16 + eax + ebx*4], ecx
218// CHECK: movl %ecx, 16(%eax,%ebx,4)
219    mov [16 + eax + ebx*4], ecx
220// CHECK: movl %ecx, 16(%eax,%ebx,4)
221    mov [eax][ebx*4 + 16], ecx
222// CHECK: movl %ecx, 16(%eax,%ebx,4)
223    mov [eax][16 + ebx*4], ecx
224// CHECK: movl %ecx, 16(%eax,%ebx,4)
225    mov [ebx*4][eax + 16], ecx
226// CHECK: movl %ecx, 16(%eax,%ebx,4)
227    mov [ebx*4][16 + eax], ecx
228// CHECK: movl %ecx, 16(%eax,%ebx,4)
229    mov [16][eax + ebx*4], ecx
230// CHECK: movl %ecx, 16(%eax,%ebx,4)
231    mov [16][eax + ebx*4], ecx
232// CHECK: movl %ecx, 16(%eax,%ebx,4)
233    mov [eax + ebx*4][16], ecx
234// CHECK: movl %ecx, 16(%eax,%ebx,4)
235    mov [eax + 16][ebx*4], ecx
236// CHECK: movl %ecx, 16(%eax,%ebx,4)
237    mov [ebx*4 + eax][16], ecx
238// CHECK: movl %ecx, 16(%eax,%ebx,4)
239    mov [ebx*4 + 16][eax], ecx
240// CHECK: movl %ecx, 16(%eax,%ebx,4)
241    mov [16 + eax][ebx*4], ecx
242// CHECK: movl %ecx, 16(%eax,%ebx,4)
243    mov [16 + eax][ebx*4], ecx
244// CHECK: movl %ecx, 16(%eax,%ebx,4)
245    mov [eax][ebx*4][16], ecx
246// CHECK: movl %ecx, 16(%eax,%ebx,4)
247    mov [eax][16][ebx*4], ecx
248// CHECK: movl %ecx, 16(%eax,%ebx,4)
249    mov [ebx*4][eax][16], ecx
250// CHECK: movl %ecx, 16(%eax,%ebx,4)
251    mov [ebx*4][16][eax], ecx
252// CHECK: movl %ecx, 16(%eax,%ebx,4)
253    mov [16][eax][ebx*4], ecx
254// CHECK: movl %ecx, 16(%eax,%ebx,4)
255    mov [16][eax][ebx*4], ecx
256// CHECK: movl %ecx, -16(%eax,%ebx,4)
257    mov [eax][ebx*4 - 16], ecx
258
259// CHECK: prefetchnta 12800(%esi)
260    prefetchnta [esi + (200*64)]
261// CHECK: prefetchnta 32(%esi)
262    prefetchnta [esi + (64/2)]
263// CHECK: prefetchnta 128(%esi)
264    prefetchnta [esi + (64/2*4)]
265// CHECK: prefetchnta 8(%esi)
266    prefetchnta [esi + (64/(2*4))]
267// CHECK: prefetchnta 48(%esi)
268    prefetchnta [esi + (64/(2*4)+40)]
269
270// CHECK: movl %ecx, -16(%eax,%ebx,4)
271    mov [eax][ebx*4 - 2*8], ecx
272// CHECK: movl %ecx, -16(%eax,%ebx,4)
273    mov [eax][4*ebx - 2*8], ecx
274// CHECK: movl %ecx, -16(%eax,%ebx,4)
275    mov [eax + 4*ebx - 2*8], ecx
276// CHECK: movl %ecx, -16(%eax,%ebx,4)
277    mov [12 + eax + (4*ebx) - 2*14], ecx
278// CHECK: movl %ecx, -16(%eax,%ebx,4)
279    mov [eax][ebx*4 - 2*2*2*2], ecx
280// CHECK: movl %ecx, -16(%eax,%ebx,4)
281    mov [eax][ebx*4 - (2*8)], ecx
282// CHECK: movl %ecx, -16(%eax,%ebx,4)
283    mov [eax][ebx*4 - 2 * 8 + 4 - 4], ecx
284// CHECK: movl %ecx, -16(%eax,%ebx,4)
285    mov [eax + ebx*4 - 2 * 8 + 4 - 4], ecx
286// CHECK: movl %ecx, -16(%eax,%ebx,4)
287    mov [eax + ebx*4 - 2 * ((8 + 4) - 4)], ecx
288// CHECK: movl %ecx, -16(%eax,%ebx,4)
289    mov [-2 * ((8 + 4) - 4) + eax + ebx*4], ecx
290// CHECK: movl %ecx, -16(%eax,%ebx,4)
291    mov [((-2) * ((8 + 4) - 4)) + eax + ebx*4], ecx
292// CHECK: movl %ecx, -16(%eax,%ebx,4)
293    mov [eax + ((-2) * ((8 + 4) - 4)) + ebx*4], ecx
294// CHECK: movl %ecx, 96(%eax,%ebx,4)
295    mov [eax + ((-2) * ((8 + 4) * -4)) + ebx*4], ecx
296// CHECK: movl %ecx, -8(%eax,%ebx,4)
297    mov [eax][-8][ebx*4], ecx
298// CHECK: movl %ecx, -2(%eax,%ebx,4)
299    mov [eax][16/-8][ebx*4], ecx
300// CHECK: movl %ecx, -2(%eax,%ebx,4)
301    mov [eax][(16)/-8][ebx*4], ecx
302
303// CHECK: setb %al
304    setc al
305// CHECK: sete %al
306    setz al
307// CHECK: setbe %al
308    setna al
309// CHECK: setae %al
310    setnb al
311// CHECK: setae %al
312    setnc al
313// CHECK: setle %al
314    setng al
315// CHECK: setge %al
316    setnl al
317// CHECK: setne %al
318    setnz al
319// CHECK: setp %al
320    setpe al
321// CHECK: setnp %al
322    setpo al
323// CHECK: setb %al
324    setnae al
325// CHECK: seta %al
326    setnbe al
327// CHECK: setl %al
328    setnge al
329// CHECK: setg %al
330    setnle al
331// CHECK: jne _foo
332    jnz _foo
333// CHECK: outb %al, $4
334    out 4, al
335    ret
336
337// CHECK: cmovbl %ebx, %eax
338    cmovc eax, ebx
339// CHECK: cmovel %ebx, %eax
340    cmovz eax, ebx
341// CHECK: cmovbel %ebx, %eax
342    cmovna eax, ebx
343// CHECK: cmovael %ebx, %eax
344    cmovnb eax, ebx
345// CHECK: cmovael %ebx, %eax
346    cmovnc eax, ebx
347// CHECK: cmovlel %ebx, %eax
348    cmovng eax, ebx
349// CHECK: cmovgel %ebx, %eax
350    cmovnl eax, ebx
351// CHECK: cmovnel %ebx, %eax
352    cmovnz eax, ebx
353// CHECK: cmovpl %ebx, %eax
354    cmovpe eax, ebx
355// CHECK: cmovnpl %ebx, %eax
356    cmovpo eax, ebx
357// CHECK: cmovbl %ebx, %eax
358    cmovnae eax, ebx
359// CHECK: cmoval %ebx, %eax
360    cmovnbe eax, ebx
361// CHECK: cmovll %ebx, %eax
362    cmovnge eax, ebx
363// CHECK: cmovgl %ebx, %eax
364    cmovnle eax, ebx
365
366// CHECK: shldw	%cl, %bx, %dx
367// CHECK: shldw	%cl, %bx, %dx
368// CHECK: shldw	$1, %bx, %dx
369// CHECK: shldw	%cl, %bx, (%rax)
370// CHECK: shldw	%cl, %bx, (%rax)
371// CHECK: shrdw	%cl, %bx, %dx
372// CHECK: shrdw	%cl, %bx, %dx
373// CHECK: shrdw	$1, %bx, %dx
374// CHECK: shrdw	%cl, %bx, (%rax)
375// CHECK: shrdw	%cl, %bx, (%rax)
376
377shld  DX, BX
378shld  DX, BX, CL
379shld  DX, BX, 1
380shld  [RAX], BX
381shld  [RAX], BX, CL
382shrd  DX, BX
383shrd  DX, BX, CL
384shrd  DX, BX, 1
385shrd  [RAX], BX
386shrd  [RAX], BX, CL
387
388// CHECK: btl $1, (%eax)
389// CHECK: btsl $1, (%eax)
390// CHECK: btrl $1, (%eax)
391// CHECK: btcl $1, (%eax)
392    bt DWORD PTR [EAX], 1
393    bt DWORD PTR [EAX], 1
394    bts DWORD PTR [EAX], 1
395    btr DWORD PTR [EAX], 1
396    btc DWORD PTR [EAX], 1
397
398//CHECK: divb	%bl
399//CHECK: divw	%bx
400//CHECK: divl	%ecx
401//CHECK: divl	3735928559(%ebx,%ecx,8)
402//CHECK: divl	69
403//CHECK: divl	32493
404//CHECK: divl	3133065982
405//CHECK: divl	305419896
406//CHECK: idivb	%bl
407//CHECK: idivw	%bx
408//CHECK: idivl	%ecx
409//CHECK: idivl	3735928559(%ebx,%ecx,8)
410//CHECK: idivl	69
411//CHECK: idivl	32493
412//CHECK: idivl	3133065982
413//CHECK: idivl	305419896
414    div AL, BL
415    div AX, BX
416    div EAX, ECX
417    div EAX, [ECX*8+EBX+0xdeadbeef]
418    div EAX, [0x45]
419    div EAX, [0x7eed]
420    div EAX, [0xbabecafe]
421    div EAX, [0x12345678]
422    idiv AL, BL
423    idiv AX, BX
424    idiv EAX, ECX
425    idiv EAX, [ECX*8+EBX+0xdeadbeef]
426    idiv EAX, [0x45]
427    idiv EAX, [0x7eed]
428    idiv EAX, [0xbabecafe]
429    idiv EAX, [0x12345678]
430
431
432// CHECK: inb %dx, %al
433// CHECK: inw %dx, %ax
434// CHECK: inl %dx, %eax
435// CHECK: outb %al, %dx
436// CHECK: outw %ax, %dx
437// CHECK: outl %eax, %dx
438    inb DX
439    inw DX
440    inl DX
441    outb DX
442    outw DX
443    outl DX
444
445// CHECK: xchgq %rcx, %rax
446// CHECK: xchgq %rcx, %rax
447// CHECK: xchgl %ecx, %eax
448// CHECK: xchgl %ecx, %eax
449// CHECK: xchgw %cx, %ax
450// CHECK: xchgw %cx, %ax
451xchg RAX, RCX
452xchg RCX, RAX
453xchg EAX, ECX
454xchg ECX, EAX
455xchg AX, CX
456xchg CX, AX
457
458// CHECK: xchgq %rax, (%ecx)
459// CHECK: xchgq %rax, (%ecx)
460// CHECK: xchgl %eax, (%ecx)
461// CHECK: xchgl %eax, (%ecx)
462// CHECK: xchgw %ax, (%ecx)
463// CHECK: xchgw %ax, (%ecx)
464xchg RAX, [ECX]
465xchg [ECX], RAX
466xchg EAX, [ECX]
467xchg [ECX], EAX
468xchg AX, [ECX]
469xchg [ECX], AX
470
471// CHECK: testq (%ecx), %rax
472// CHECK: testq (%ecx), %rax
473// CHECK: testl (%ecx), %eax
474// CHECK: testl (%ecx), %eax
475// CHECK: testw (%ecx), %ax
476// CHECK: testw (%ecx), %ax
477// CHECK: testb (%ecx), %al
478// CHECK: testb (%ecx), %al
479test RAX, [ECX]
480test [ECX], RAX
481test EAX, [ECX]
482test [ECX], EAX
483test AX, [ECX]
484test [ECX], AX
485test AL, [ECX]
486test [ECX], AL
487
488// CHECK: fnstsw %ax
489// CHECK: fnstsw %ax
490// CHECK: fnstsw %ax
491// CHECK: fnstsw %ax
492// CHECK: fnstsw (%eax)
493fnstsw
494fnstsw AX
495fnstsw EAX
496fnstsw AL
497fnstsw WORD PTR [EAX]
498
499// CHECK: faddp %st(1)
500// CHECK: fmulp %st(1)
501// CHECK: fsubrp %st(1)
502// CHECK: fsubp %st(1)
503// CHECK: fdivrp %st(1)
504// CHECK: fdivp %st(1)
505faddp ST(1), ST(0)
506fmulp ST(1), ST(0)
507fsubp ST(1), ST(0)
508fsubrp ST(1), ST(0)
509fdivp ST(1), ST(0)
510fdivrp ST(1), ST(0)
511
512// CHECK: faddp %st(1)
513// CHECK: fmulp %st(1)
514// CHECK: fsubrp %st(1)
515// CHECK: fsubp %st(1)
516// CHECK: fdivrp %st(1)
517// CHECK: fdivp %st(1)
518faddp ST(0), ST(1)
519fmulp ST(0), ST(1)
520fsubp ST(0), ST(1)
521fsubrp ST(0), ST(1)
522fdivp ST(0), ST(1)
523fdivrp ST(0), ST(1)
524
525// CHECK: faddp %st(1)
526// CHECK: fmulp %st(1)
527// CHECK: fsubrp %st(1)
528// CHECK: fsubp %st(1)
529// CHECK: fdivrp %st(1)
530// CHECK: fdivp %st(1)
531faddp ST(1)
532fmulp ST(1)
533fsubp ST(1)
534fsubrp ST(1)
535fdivp ST(1)
536fdivrp ST(1)
537
538
539// CHECK: faddp %st(1)
540// CHECK: fmulp %st(1)
541// CHECK: fsubrp %st(1)
542// CHECK: fsubp %st(1)
543// CHECK: fdivrp %st(1)
544// CHECK: fdivp %st(1)
545fadd
546fmul
547fsub
548fsubr
549fdiv
550fdivr
551
552// CHECK: faddp %st(1)
553// CHECK: fmulp %st(1)
554// CHECK: fsubrp %st(1)
555// CHECK: fsubp %st(1)
556// CHECK: fdivrp %st(1)
557// CHECK: fdivp %st(1)
558faddp
559fmulp
560fsubp
561fsubrp
562fdivp
563fdivrp
564
565// CHECK: fadd %st(1)
566// CHECK: fmul %st(1)
567// CHECK: fsub %st(1)
568// CHECK: fsubr %st(1)
569// CHECK: fdiv %st(1)
570// CHECK: fdivr %st(1)
571fadd ST(0), ST(1)
572fmul ST(0), ST(1)
573fsub ST(0), ST(1)
574fsubr ST(0), ST(1)
575fdiv ST(0), ST(1)
576fdivr ST(0), ST(1)
577
578// CHECK: fadd %st(0), %st(1)
579// CHECK: fmul %st(0), %st(1)
580// CHECK: fsubr %st(0), %st(1)
581// CHECK: fsub %st(0), %st(1)
582// CHECK: fdivr %st(0), %st(1)
583// CHECK: fdiv %st(0), %st(1)
584fadd ST(1), ST(0)
585fmul ST(1), ST(0)
586fsub ST(1), ST(0)
587fsubr ST(1), ST(0)
588fdiv ST(1), ST(0)
589fdivr ST(1), ST(0)
590
591// CHECK: fadd %st(1)
592// CHECK: fmul %st(1)
593// CHECK: fsub %st(1)
594// CHECK: fsubr %st(1)
595// CHECK: fdiv %st(1)
596// CHECK: fdivr %st(1)
597fadd ST(1)
598fmul ST(1)
599fsub ST(1)
600fsubr ST(1)
601fdiv ST(1)
602fdivr ST(1)
603
604
605// CHECK: fxsave64 (%rax)
606// CHECK: fxrstor64 (%rax)
607fxsave64 opaque ptr [rax]
608fxrstor64 opaque ptr [rax]
609
610.bss
611.globl _g0
612.text
613
614// CHECK: movq _g0, %rbx
615// CHECK: movq _g0+8, %rcx
616mov rbx, qword ptr [_g0]
617mov rcx, qword ptr [_g0 + 8]
618
619"?half@?0??bar@@YAXXZ@4NA":
620	.quad   4602678819172646912
621
622fadd   dword ptr "?half@?0??bar@@YAXXZ@4NA"
623fadd   dword ptr "?half@?0??bar@@YAXXZ@4NA"@IMGREL
624// CHECK: fadds   "?half@?0??bar@@YAXXZ@4NA"
625// CHECK: fadds   "?half@?0??bar@@YAXXZ@4NA"@IMGREL
626
627inc qword ptr [rax]
628inc dword ptr [rax]
629inc word ptr [rax]
630inc byte ptr [rax]
631// CHECK: incq (%rax)
632// CHECK: incl (%rax)
633// CHECK: incw (%rax)
634// CHECK: incb (%rax)
635
636dec qword ptr [rax]
637dec dword ptr [rax]
638dec word ptr [rax]
639dec byte ptr [rax]
640// CHECK: decq (%rax)
641// CHECK: decl (%rax)
642// CHECK: decw (%rax)
643// CHECK: decb (%rax)
644
645add qword ptr [rax], 1
646add dword ptr [rax], 1
647add word ptr [rax], 1
648add byte ptr [rax], 1
649// CHECK: addq $1, (%rax)
650// CHECK: addl $1, (%rax)
651// CHECK: addw $1, (%rax)
652// CHECK: addb $1, (%rax)
653
654fstp tbyte ptr [rax]
655fstp xword ptr [rax]
656fstp qword ptr [rax]
657fstp dword ptr [rax]
658// CHECK: fstpt (%rax)
659// CHECK: fstpt (%rax)
660// CHECK: fstpl (%rax)
661// CHECK: fstps (%rax)
662
663fxsave [eax]
664fsave [eax]
665fxrstor [eax]
666frstor [eax]
667// CHECK: fxsave (%eax)
668// CHECK: wait
669// CHECK: fnsave (%eax)
670// CHECK: fxrstor (%eax)
671// CHECK: frstor (%eax)
672
673// FIXME: Should we accept this?  Masm accepts it, but gas does not.
674fxsave dword ptr [eax]
675fsave dword ptr [eax]
676fxrstor dword ptr [eax]
677frstor dword ptr [eax]
678// CHECK: fxsave (%eax)
679// CHECK: wait
680// CHECK: fnsave (%eax)
681// CHECK: fxrstor (%eax)
682// CHECK: frstor (%eax)
683
684// CHECK: cmpnless %xmm1, %xmm0
685cmpnless xmm0, xmm1
686
687insb
688insw
689insd
690// CHECK: insb %dx, %es:(%rdi)
691// CHECK: insw %dx, %es:(%rdi)
692// CHECK: insl %dx, %es:(%rdi)
693
694outsb
695outsw
696outsd
697// CHECK: outsb (%rsi), %dx
698// CHECK: outsw (%rsi), %dx
699// CHECK: outsl (%rsi), %dx
700
701imul bx, 123
702imul ebx, 123
703imul rbx, 123
704// CHECK: imulw $123, %bx
705// CHECK: imull $123, %ebx
706// CHECK: imulq $123, %rbx
707
708repe cmpsb
709repz cmpsb
710repne cmpsb
711repnz cmpsb
712// CHECK: rep
713// CHECK: cmpsb	%es:(%rdi), (%rsi)
714// CHECK: rep
715// CHECK: cmpsb	%es:(%rdi), (%rsi)
716// CHECK: repne
717// CHECK: cmpsb	%es:(%rdi), (%rsi)
718// CHECK: repne
719// CHECK: cmpsb	%es:(%rdi), (%rsi)
720
721sal eax, 123
722// CHECK: shll	$123, %eax
723
724psignw    mm0, MMWORD PTR t2
725// CHECK: psignw t2, %mm0
726
727comisd xmm0, QWORD PTR [eax]
728comiss xmm0, DWORD PTR [eax]
729vcomisd xmm0, QWORD PTR [eax]
730vcomiss xmm0, DWORD PTR [eax]
731
732// CHECK: comisd (%eax), %xmm0
733// CHECK: comiss (%eax), %xmm0
734// CHECK: vcomisd (%eax), %xmm0
735// CHECK: vcomiss (%eax), %xmm0
736
737fbld tbyte ptr [eax]
738fbstp tbyte ptr [eax]
739// CHECK: fbld (%eax)
740// CHECK: fbstp (%eax)
741
742fcomip st, st(2)
743fucomip st, st(2)
744// CHECK: fcompi  %st(2)
745// CHECK: fucompi  %st(2)
746
747loopz _foo
748loopnz _foo
749// CHECK: loope _foo
750// CHECK: loopne _foo
751
752sidt fword ptr [eax]
753// CHECK: sidtq (%eax)
754