x86-64.s revision 0d82fe77f2b6f48b5fab131c1671169d154f8c69
1// RUN: llvm-mc -triple x86_64-unknown-unknown -show-encoding %s > %t 2> %t.err
2// RUN: FileCheck < %t %s
3// RUN: FileCheck --check-prefix=CHECK-STDERR < %t.err %s
4
5	monitor
6// CHECK: monitor
7// CHECK: encoding: [0x0f,0x01,0xc8]
8	monitor %rax, %rcx, %rdx
9// CHECK: monitor
10// CHECK: encoding: [0x0f,0x01,0xc8]
11	mwait
12// CHECK: mwait
13// CHECK: encoding: [0x0f,0x01,0xc9]
14	mwait %rax, %rcx
15// CHECK: mwait
16// CHECK: encoding: [0x0f,0x01,0xc9]
17
18// Suffix inference:
19
20// CHECK: addl $0, %eax
21        add $0, %eax
22// CHECK: addb $255, %al
23        add $0xFF, %al
24// CHECK: orq %rax, %rdx
25        or %rax, %rdx
26// CHECK: shlq $3, %rax
27        shl $3, %rax
28
29
30// CHECK: subb %al, %al
31        subb %al, %al
32
33// CHECK: addl $24, %eax
34        addl $24, %eax
35
36// CHECK: movl %eax, 10(%ebp)
37        movl %eax, 10(%ebp)
38// CHECK: movl %eax, 10(%ebp,%ebx)
39        movl %eax, 10(%ebp, %ebx)
40// CHECK: movl %eax, 10(%ebp,%ebx,4)
41        movl %eax, 10(%ebp, %ebx, 4)
42// CHECK: movl %eax, 10(,%ebx,4)
43        movl %eax, 10(, %ebx, 4)
44
45// CHECK: movl 0, %eax
46        movl 0, %eax
47// CHECK: movl $0, %eax
48        movl $0, %eax
49
50// CHECK: ret
51        ret
52
53// CHECK: retw
54        retw
55
56// FIXME: Check that this matches SUB32ri8
57// CHECK: subl $1, %eax
58        subl $1, %eax
59
60// FIXME: Check that this matches SUB32ri8
61// CHECK: subl $-1, %eax
62        subl $-1, %eax
63
64// FIXME: Check that this matches SUB32ri
65// CHECK: subl $256, %eax
66        subl $256, %eax
67
68// FIXME: Check that this matches XOR64ri8
69// CHECK: xorq $1, %rax
70        xorq $1, %rax
71
72// FIXME: Check that this matches XOR64ri32
73// CHECK: xorq $256, %rax
74        xorq $256, %rax
75
76// FIXME: Check that this matches SUB8rr
77// CHECK: subb %al, %bl
78        subb %al, %bl
79
80// FIXME: Check that this matches SUB16rr
81// CHECK: subw %ax, %bx
82        subw %ax, %bx
83
84// FIXME: Check that this matches SUB32rr
85// CHECK: subl %eax, %ebx
86        subl %eax, %ebx
87
88// FIXME: Check that this matches the correct instruction.
89// CHECK: callq *%rax
90        call *%rax
91
92// FIXME: Check that this matches the correct instruction.
93// CHECK: shldl %cl, %eax, %ebx
94        shldl %cl, %eax, %ebx
95
96// CHECK: shll $2, %eax
97        shll $2, %eax
98
99// CHECK: shll $2, %eax
100        sall $2, %eax
101
102// CHECK: rep
103// CHECK: insb
104        rep;insb
105
106// CHECK: rep
107// CHECK: outsb
108        rep;outsb
109
110// CHECK: rep
111// CHECK: movsb
112        rep;movsb
113
114
115// rdar://8470918
116smovb // CHECK: movsb
117smovw // CHECK: movsw
118smovl // CHECK: movsd
119smovq // CHECK: movsq
120
121// rdar://8456361
122// CHECK: rep
123// CHECK: movsd
124        rep movsd
125
126// CHECK: rep
127// CHECK: lodsb
128        rep;lodsb
129
130// CHECK: rep
131// CHECK: stosb
132        rep;stosb
133
134// NOTE: repz and repe have the same opcode as rep
135// CHECK: rep
136// CHECK: cmpsb
137        repz;cmpsb
138
139// NOTE: repnz has the same opcode as repne
140// CHECK: repne
141// CHECK: cmpsb
142        repnz;cmpsb
143
144// NOTE: repe and repz have the same opcode as rep
145// CHECK: rep
146// CHECK: scasb
147        repe;scasb
148
149// CHECK: repne
150// CHECK: scasb
151        repne;scasb
152
153// CHECK: lock
154// CHECK: cmpxchgb %al, (%ebx)
155        lock;cmpxchgb %al, 0(%ebx)
156
157// CHECK: cs
158// CHECK: movb (%eax), %al
159        cs;movb 0(%eax), %al
160
161// CHECK: ss
162// CHECK: movb (%eax), %al
163        ss;movb 0(%eax), %al
164
165// CHECK: ds
166// CHECK: movb (%eax), %al
167        ds;movb 0(%eax), %al
168
169// CHECK: es
170// CHECK: movb (%eax), %al
171        es;movb 0(%eax), %al
172
173// CHECK: fs
174// CHECK: movb (%eax), %al
175        fs;movb 0(%eax), %al
176
177// CHECK: gs
178// CHECK: movb (%eax), %al
179        gs;movb 0(%eax), %al
180
181// CHECK: fadd %st(0)
182// CHECK: fadd %st(1)
183// CHECK: fadd %st(7)
184
185fadd %st(0)
186fadd %st(1)
187fadd %st(7)
188
189// CHECK: leal 0, %eax
190        leal 0, %eax
191
192// rdar://7986634 - Insensitivity on opcodes.
193// CHECK: int3
194INT3
195
196// rdar://8735979 - int $3 -> int3
197// CHECK: int3
198int	$3
199
200
201// Allow scale factor without index register.
202// CHECK: movaps	%xmm3, (%esi)
203// CHECK-STDERR: warning: scale factor without index register is ignored
204movaps %xmm3, (%esi, 2)
205
206// CHECK: imull $12, %eax, %eax
207imul $12, %eax
208
209// CHECK: imull %ecx, %eax
210imull %ecx, %eax
211
212
213// rdar://8208481
214// CHECK: outb	%al, $161
215outb	%al, $161
216// CHECK: outw	%ax, $128
217outw	%ax, $128
218// CHECK: inb	$161, %al
219inb	$161, %al
220
221// rdar://8017621
222// CHECK: pushq	$1
223push $1
224
225// rdar://9716860
226pushq $1
227// CHECK: encoding: [0x6a,0x01]
228pushq $1111111
229// CHECK: encoding: [0x68,0x47,0xf4,0x10,0x00]
230
231// rdar://8017530
232// CHECK: sldtw	4
233sldt	4
234
235// rdar://8208499
236// CHECK: cmovnew	%bx, %ax
237cmovnz %bx, %ax
238// CHECK: cmovneq	%rbx, %rax
239cmovnzq %rbx, %rax
240
241
242// rdar://8407928
243// CHECK: inb	$127, %al
244// CHECK: inw	%dx
245// CHECK: outb	%al, $127
246// CHECK: outw	%dx
247// CHECK: inl	%dx
248inb	$0x7f
249inw	%dx
250outb	$0x7f
251outw	%dx
252inl	%dx
253
254
255// PR8114
256// CHECK: outb	%dx
257// CHECK: outb	%dx
258// CHECK: outw	%dx
259// CHECK: outw	%dx
260// CHECK: outl	%dx
261// CHECK: outl	%dx
262
263out	%al, (%dx)
264outb	%al, (%dx)
265out	%ax, (%dx)
266outw	%ax, (%dx)
267out	%eax, (%dx)
268outl	%eax, (%dx)
269
270// CHECK: inb	%dx
271// CHECK: inb	%dx
272// CHECK: inw	%dx
273// CHECK: inw	%dx
274// CHECK: inl	%dx
275// CHECK: inl	%dx
276
277in	(%dx), %al
278inb	(%dx), %al
279in	(%dx), %ax
280inw	(%dx), %ax
281in	(%dx), %eax
282inl	(%dx), %eax
283
284// rdar://8431422
285
286// CHECK: fxch
287// CHECK: fucom
288// CHECK: fucomp
289// CHECK: faddp
290// CHECK: faddp	%st(0)
291// CHECK: fsubp
292// CHECK: fsubrp
293// CHECK: fmulp
294// CHECK: fdivp
295// CHECK: fdivrp
296
297fxch
298fucom
299fucomp
300faddp
301faddp %st
302fsubp
303fsubrp
304fmulp
305fdivp
306fdivrp
307
308// CHECK: fcomi
309// CHECK: fcomi	%st(2)
310// CHECK: fucomi
311// CHECK: fucomi %st(2)
312// CHECK: fucomi %st(2)
313
314fcomi
315fcomi	%st(2)
316fucomi
317fucomi	%st(2)
318fucomi	%st(2), %st
319
320// CHECK: fnstsw
321// CHECK: fnstsw
322// CHECK: fnstsw
323// CHECK: fnstsw
324
325fnstsw
326fnstsw %ax
327fnstsw %eax
328fnstsw %al
329
330// rdar://8431880
331// CHECK: rclb	%bl
332// CHECK: rcll	3735928559(%ebx,%ecx,8)
333// CHECK: rcrl	%ecx
334// CHECK: rcrl	305419896
335rcl	%bl
336rcll	0xdeadbeef(%ebx,%ecx,8)
337rcr	%ecx
338rcrl	0x12345678
339
340rclb	%bl       // CHECK: rclb %bl     # encoding: [0xd0,0xd3]
341rclb	$1, %bl   // CHECK: rclb %bl     # encoding: [0xd0,0xd3]
342rclb	$2, %bl   // CHECK: rclb $2, %bl # encoding: [0xc0,0xd3,0x02]
343
344// rdar://8418316
345// PR12173
346// CHECK: shldw	%cl, %bx, %dx
347// CHECK: shldw	%cl, %bx, %dx
348// CHECK: shldw	$1, %bx, %dx
349// CHECK: shldw	%cl, %bx, (%rax)
350// CHECK: shldw	%cl, %bx, (%rax)
351// CHECK: shrdw	%cl, %bx, %dx
352// CHECK: shrdw	%cl, %bx, %dx
353// CHECK: shrdw	$1, %bx, %dx
354// CHECK: shrdw	%cl, %bx, (%rax)
355// CHECK: shrdw	%cl, %bx, (%rax)
356
357shld  %bx, %dx
358shld  %cl, %bx, %dx
359shld  $1, %bx, %dx
360shld  %bx, (%rax)
361shld  %cl, %bx, (%rax)
362shrd  %bx, %dx
363shrd  %cl, %bx, %dx
364shrd  $1, %bx, %dx
365shrd  %bx, (%rax)
366shrd  %cl, %bx, (%rax)
367
368// CHECK: sldtl	%ecx
369// CHECK: encoding: [0x0f,0x00,0xc1]
370// CHECK: sldtw	%cx
371// CHECK: encoding: [0x66,0x0f,0x00,0xc1]
372
373sldt	%ecx
374sldt	%cx
375
376// CHECK: lcalll	*3135175374
377// CHECK: ljmpl	*3135175374
378lcall	*0xbadeface
379ljmp	*0xbadeface
380
381
382// rdar://8444631
383// CHECK: enter	$31438, $0
384// CHECK: encoding: [0xc8,0xce,0x7a,0x00]
385// CHECK: enter	$31438, $1
386// CHECK: encoding: [0xc8,0xce,0x7a,0x01]
387// CHECK: enter	$31438, $127
388// CHECK: encoding: [0xc8,0xce,0x7a,0x7f]
389enter $0x7ace,$0
390enter $0x7ace,$1
391enter $0x7ace,$0x7f
392
393
394// rdar://8456364
395// CHECK: movw	%cs, %ax
396mov %CS, %ax
397
398// rdar://8456391
399fcmovb %st(1), %st(0)   // CHECK: fcmovb	%st(1), %st(0)
400fcmove %st(1), %st(0)   // CHECK: fcmove	%st(1), %st(0)
401fcmovbe %st(1), %st(0)  // CHECK: fcmovbe	%st(1), %st(0)
402fcmovu %st(1), %st(0)   // CHECK: fcmovu	 %st(1), %st(0)
403
404fcmovnb %st(1), %st(0)  // CHECK: fcmovnb	%st(1), %st(0)
405fcmovne %st(1), %st(0)  // CHECK: fcmovne	%st(1), %st(0)
406fcmovnbe %st(1), %st(0) // CHECK: fcmovnbe	%st(1), %st(0)
407fcmovnu %st(1), %st(0)  // CHECK: fcmovnu	%st(1), %st(0)
408
409fcmovnae %st(1), %st(0) // CHECK: fcmovb	%st(1), %st(0)
410fcmovna %st(1), %st(0)  // CHECK: fcmovbe	%st(1), %st(0)
411
412fcmovae %st(1), %st(0)  // CHECK: fcmovnb	%st(1), %st(0)
413fcmova %st(1), %st(0)   // CHECK: fcmovnbe	%st(1), %st(0)
414
415// rdar://8456417
416.byte 88 + 1 & 15  // CHECK: .byte	9
417
418// rdar://8456412
419mov %rdx, %cr0
420// CHECK: movq	%rdx, %cr0
421// CHECK: encoding: [0x0f,0x22,0xc2]
422mov %rdx, %cr4
423// CHECK: movq	%rdx, %cr4
424// CHECK: encoding: [0x0f,0x22,0xe2]
425mov %rdx, %cr8
426// CHECK: movq	%rdx, %cr8
427// CHECK: encoding: [0x44,0x0f,0x22,0xc2]
428mov %rdx, %cr15
429// CHECK: movq	%rdx, %cr15
430// CHECK: encoding: [0x44,0x0f,0x22,0xfa]
431
432// rdar://8456371 - Handle commutable instructions written backward.
433// CHECK: 	faddp	%st(1)
434// CHECK:	fmulp	%st(2)
435faddp %st, %st(1)
436fmulp %st, %st(2)
437
438// rdar://8468087 - Encode these accurately, they are not synonyms.
439// CHECK: fmul	%st(0), %st(1)
440// CHECK: encoding: [0xdc,0xc9]
441// CHECK: fmul	%st(1)
442// CHECK: encoding: [0xd8,0xc9]
443fmul %st, %st(1)
444fmul %st(1), %st
445
446// CHECK: fadd	%st(0), %st(1)
447// CHECK: encoding: [0xdc,0xc1]
448// CHECK: fadd	%st(1)
449// CHECK: encoding: [0xd8,0xc1]
450fadd %st, %st(1)
451fadd %st(1), %st
452
453
454// rdar://8416805
455// CHECK: xorb	%al, %al
456// CHECK: encoding: [0x30,0xc0]
457// CHECK: xorw	%di, %di
458// CHECK: encoding: [0x66,0x31,0xff]
459// CHECK: xorl	%esi, %esi
460// CHECK: encoding: [0x31,0xf6]
461// CHECK: xorq	%rsi, %rsi
462// CHECK: encoding: [0x48,0x31,0xf6]
463clrb    %al
464clr    %di
465clr    %esi
466clr    %rsi
467
468// rdar://8456378
469cltq  // CHECK: cltq
470cdqe  // CHECK: cltq
471cwde  // CHECK: cwtl
472cwtl  // CHECK: cwtl
473
474// rdar://8416805
475cbw   // CHECK: cbtw
476cwd   // CHECK: cwtd
477cdq   // CHECK: cltd
478cqo   // CHECK: cqto
479
480// rdar://8456378 and PR7557 - fstsw
481fstsw %ax
482// CHECK: wait
483// CHECK: fnstsw
484fstsw (%rax)
485// CHECK: wait
486// CHECK: fnstsw (%rax)
487
488// PR8259
489fstcw (%rsp)
490// CHECK: wait
491// CHECK: fnstcw (%rsp)
492
493// PR8259
494fstcw (%rsp)
495// CHECK: wait
496// CHECK: fnstcw (%rsp)
497
498// PR8258
499finit
500// CHECK: wait
501// CHECK: fninit
502
503fsave	32493
504// CHECK: wait
505// CHECK: fnsave 32493
506
507
508// rdar://8456382 - cvtsd2si support.
509cvtsd2si	%xmm1, %rax
510// CHECK: cvtsd2siq	%xmm1, %rax
511// CHECK: encoding: [0xf2,0x48,0x0f,0x2d,0xc1]
512cvtsd2si	%xmm1, %eax
513// CHECK: cvtsd2sil	%xmm1, %eax
514// CHECK: encoding: [0xf2,0x0f,0x2d,0xc1]
515
516cvtsd2siq %xmm0, %rax // CHECK: cvtsd2siq	%xmm0, %rax
517cvtsd2sil %xmm0, %eax // CHECK: cvtsd2sil	%xmm0, %eax
518cvtsd2si %xmm0, %rax  // CHECK: cvtsd2siq	%xmm0, %rax
519
520
521cvttpd2dq %xmm1, %xmm0  // CHECK: cvttpd2dq %xmm1, %xmm0
522cvttpd2dq (%rax), %xmm0 // CHECK: cvttpd2dq (%rax), %xmm0
523
524cvttps2dq %xmm1, %xmm0  // CHECK: cvttps2dq %xmm1, %xmm0
525cvttps2dq (%rax), %xmm0 // CHECK: cvttps2dq (%rax), %xmm0
526
527// rdar://8456376 - llvm-mc rejects 'roundss'
528roundss $0xE, %xmm0, %xmm0 // CHECK: encoding: [0x66,0x0f,0x3a,0x0a,0xc0,0x0e]
529roundps $0xE, %xmm0, %xmm0 // CHECK: encoding: [0x66,0x0f,0x3a,0x08,0xc0,0x0e]
530roundsd $0xE, %xmm0, %xmm0 // CHECK: encoding: [0x66,0x0f,0x3a,0x0b,0xc0,0x0e]
531roundpd $0xE, %xmm0, %xmm0 // CHECK: encoding: [0x66,0x0f,0x3a,0x09,0xc0,0x0e]
532
533
534// rdar://8482675 - 32-bit mem operand support in 64-bit mode (0x67 prefix)
535leal	8(%eax), %esi
536// CHECK: leal	8(%eax), %esi
537// CHECK: encoding: [0x67,0x8d,0x70,0x08]
538leaq	8(%eax), %rsi
539// CHECK: leaq	8(%eax), %rsi
540// CHECK: encoding: [0x67,0x48,0x8d,0x70,0x08]
541leaq	8(%rax), %rsi
542// CHECK: leaq	8(%rax), %rsi
543// CHECK: encoding: [0x48,0x8d,0x70,0x08]
544
545
546cvttpd2dq	0xdeadbeef(%ebx,%ecx,8),%xmm5
547// CHECK: cvttpd2dq	3735928559(%ebx,%ecx,8), %xmm5
548// CHECK: encoding: [0x67,0x66,0x0f,0xe6,0xac,0xcb,0xef,0xbe,0xad,0xde]
549
550// rdar://8490728 - llvm-mc rejects 'movmskpd'
551movmskpd	%xmm6, %rax
552// CHECK: movmskpd	%xmm6, %rax
553// CHECK: encoding: [0x66,0x48,0x0f,0x50,0xc6]
554movmskpd	%xmm6, %eax
555// CHECK: movmskpd	%xmm6, %eax
556// CHECK: encoding: [0x66,0x0f,0x50,0xc6]
557
558// rdar://8491845 - Gas supports commuted forms of non-commutable instructions.
559fdivrp %st(0), %st(1) // CHECK: encoding: [0xde,0xf9]
560fdivrp %st(1), %st(0) // CHECK: encoding: [0xde,0xf9]
561
562fsubrp %ST(0), %ST(1) // CHECK: encoding: [0xde,0xe9]
563fsubrp %ST(1), %ST(0) // CHECK: encoding: [0xde,0xe9]
564
565// also PR8861
566fdivp %st(0), %st(1) // CHECK: encoding: [0xde,0xf1]
567fdivp %st(1), %st(0) // CHECK: encoding: [0xde,0xf1]
568
569
570movl	foo(%rip), %eax
571// CHECK: movl	foo(%rip), %eax
572// CHECK: encoding: [0x8b,0x05,A,A,A,A]
573// CHECK: fixup A - offset: 2, value: foo-4, kind: reloc_riprel_4byte
574
575movb	$12, foo(%rip)
576// CHECK: movb	$12, foo(%rip)
577// CHECK: encoding: [0xc6,0x05,A,A,A,A,0x0c]
578// CHECK:    fixup A - offset: 2, value: foo-5, kind: reloc_riprel_4byte
579
580movw	$12, foo(%rip)
581// CHECK: movw	$12, foo(%rip)
582// CHECK: encoding: [0x66,0xc7,0x05,A,A,A,A,0x0c,0x00]
583// CHECK:    fixup A - offset: 3, value: foo-6, kind: reloc_riprel_4byte
584
585movl	$12, foo(%rip)
586// CHECK: movl	$12, foo(%rip)
587// CHECK: encoding: [0xc7,0x05,A,A,A,A,0x0c,0x00,0x00,0x00]
588// CHECK:    fixup A - offset: 2, value: foo-8, kind: reloc_riprel_4byte
589
590movq	$12, foo(%rip)
591// CHECK:  movq	$12, foo(%rip)
592// CHECK: encoding: [0x48,0xc7,0x05,A,A,A,A,0x0c,0x00,0x00,0x00]
593// CHECK:    fixup A - offset: 3, value: foo-8, kind: reloc_riprel_4byte
594
595// CHECK: addq	$-424, %rax
596// CHECK: encoding: [0x48,0x05,0x58,0xfe,0xff,0xff]
597addq $-424, %rax
598
599
600// CHECK: movq	_foo@GOTPCREL(%rip), %rax
601// CHECK:  encoding: [0x48,0x8b,0x05,A,A,A,A]
602// CHECK:  fixup A - offset: 3, value: _foo@GOTPCREL-4, kind: reloc_riprel_4byte_movq_load
603movq _foo@GOTPCREL(%rip), %rax
604
605// CHECK: movq	_foo@GOTPCREL(%rip), %r14
606// CHECK:  encoding: [0x4c,0x8b,0x35,A,A,A,A]
607// CHECK:  fixup A - offset: 3, value: _foo@GOTPCREL-4, kind: reloc_riprel_4byte_movq_load
608movq _foo@GOTPCREL(%rip), %r14
609
610
611// CHECK: movq	(%r13,%rax,8), %r13
612// CHECK:  encoding: [0x4d,0x8b,0x6c,0xc5,0x00]
613movq 0x00(%r13,%rax,8),%r13
614
615// CHECK: testq	%rax, %rbx
616// CHECK:  encoding: [0x48,0x85,0xd8]
617testq %rax, %rbx
618
619// CHECK: cmpq	%rbx, %r14
620// CHECK:   encoding: [0x49,0x39,0xde]
621        cmpq %rbx, %r14
622
623// rdar://7947167
624
625movsq
626// CHECK: movsq
627// CHECK:   encoding: [0x48,0xa5]
628
629movsl
630// CHECK: movsd
631// CHECK:   encoding: [0xa5]
632
633stosq
634// CHECK: stosq
635// CHECK:   encoding: [0x48,0xab]
636stosl
637// CHECK: stosl
638// CHECK:   encoding: [0xab]
639
640
641// Not moffset forms of moves, they are x86-32 only! rdar://7947184
642movb	0, %al    // CHECK: movb 0, %al # encoding: [0x8a,0x04,0x25,0x00,0x00,0x00,0x00]
643movw	0, %ax    // CHECK: movw 0, %ax # encoding: [0x66,0x8b,0x04,0x25,0x00,0x00,0x00,0x00]
644movl	0, %eax   // CHECK: movl 0, %eax # encoding: [0x8b,0x04,0x25,0x00,0x00,0x00,0x00]
645
646// CHECK: pushfq	# encoding: [0x9c]
647        pushf
648// CHECK: pushfq	# encoding: [0x9c]
649        pushfq
650// CHECK: popfq	        # encoding: [0x9d]
651        popf
652// CHECK: popfq	        # encoding: [0x9d]
653        popfq
654
655// CHECK: movabsq $-281474976710654, %rax
656// CHECK: encoding: [0x48,0xb8,0x02,0x00,0x00,0x00,0x00,0x00,0xff,0xff]
657        movabsq $0xFFFF000000000002, %rax
658
659// CHECK: movabsq $-281474976710654, %rax
660// CHECK: encoding: [0x48,0xb8,0x02,0x00,0x00,0x00,0x00,0x00,0xff,0xff]
661        movq $0xFFFF000000000002, %rax
662
663// CHECK: movq $-65536, %rax
664// CHECK: encoding: [0x48,0xc7,0xc0,0x00,0x00,0xff,0xff]
665        movq $0xFFFFFFFFFFFF0000, %rax
666
667// CHECK: movq $-256, %rax
668// CHECK: encoding: [0x48,0xc7,0xc0,0x00,0xff,0xff,0xff]
669        movq $0xFFFFFFFFFFFFFF00, %rax
670
671// CHECK: movq $10, %rax
672// CHECK: encoding: [0x48,0xc7,0xc0,0x0a,0x00,0x00,0x00]
673        movq $10, %rax
674
675// rdar://8014869
676//
677// CHECK: ret
678// CHECK:  encoding: [0xc3]
679        retq
680
681// CHECK: sete %al
682// CHECK: encoding: [0x0f,0x94,0xc0]
683        setz %al
684
685// CHECK: setne %al
686// CHECK: encoding: [0x0f,0x95,0xc0]
687        setnz %al
688
689// CHECK: je 0
690// CHECK: encoding: [0x74,A]
691        jz 0
692
693// CHECK: jne
694// CHECK: encoding: [0x75,A]
695        jnz 0
696
697// PR9264
698btl	$1, 0 // CHECK: btl $1, 0 # encoding: [0x0f,0xba,0x24,0x25,0x00,0x00,0x00,0x00,0x01]
699bt	$1, 0 // CHECK: btl $1, 0 # encoding: [0x0f,0xba,0x24,0x25,0x00,0x00,0x00,0x00,0x01]
700
701// rdar://8017515
702btq $0x01,%rdx
703// CHECK: btq	$1, %rdx
704// CHECK:  encoding: [0x48,0x0f,0xba,0xe2,0x01]
705
706//rdar://8017633
707// CHECK: movzbl	%al, %esi
708// CHECK:  encoding: [0x0f,0xb6,0xf0]
709        movzx %al, %esi
710
711// CHECK: movzbq	%al, %rsi
712// CHECK:  encoding: [0x48,0x0f,0xb6,0xf0]
713        movzx %al, %rsi
714
715// CHECK: movsbw	%al, %ax
716// CHECK: encoding: [0x66,0x0f,0xbe,0xc0]
717movsx %al, %ax
718
719// CHECK: movsbl	%al, %eax
720// CHECK: encoding: [0x0f,0xbe,0xc0]
721movsx %al, %eax
722
723// CHECK: movswl	%ax, %eax
724// CHECK: encoding: [0x0f,0xbf,0xc0]
725movsx %ax, %eax
726
727// CHECK: movsbq	%bl, %rax
728// CHECK: encoding: [0x48,0x0f,0xbe,0xc3]
729movsx %bl, %rax
730
731// CHECK: movswq %cx, %rax
732// CHECK: encoding: [0x48,0x0f,0xbf,0xc1]
733movsx %cx, %rax
734
735// CHECK: movslq	%edi, %rax
736// CHECK: encoding: [0x48,0x63,0xc7]
737movsx %edi, %rax
738
739// CHECK: movzbw	%al, %ax
740// CHECK: encoding: [0x66,0x0f,0xb6,0xc0]
741movzx %al, %ax
742
743// CHECK: movzbl	%al, %eax
744// CHECK: encoding: [0x0f,0xb6,0xc0]
745movzx %al, %eax
746
747// CHECK: movzwl	%ax, %eax
748// CHECK: encoding: [0x0f,0xb7,0xc0]
749movzx %ax, %eax
750
751// CHECK: movzbq	%bl, %rax
752// CHECK: encoding: [0x48,0x0f,0xb6,0xc3]
753movzx %bl, %rax
754
755// CHECK: movzwq	%cx, %rax
756// CHECK: encoding: [0x48,0x0f,0xb7,0xc1]
757movzx %cx, %rax
758
759// CHECK: movsbw	(%rax), %ax
760// CHECK: encoding: [0x66,0x0f,0xbe,0x00]
761movsx (%rax), %ax
762
763// CHECK: movzbw	(%rax), %ax
764// CHECK: encoding: [0x66,0x0f,0xb6,0x00]
765movzx (%rax), %ax
766
767
768// rdar://7873482
769// CHECK: [0x65,0x8b,0x04,0x25,0x7c,0x00,0x00,0x00]
770        movl	%gs:124, %eax
771
772// CHECK: jmpq *8(%rax)
773// CHECK:   encoding: [0xff,0x60,0x08]
774	jmp	*8(%rax)
775
776// CHECK: btq $61, -216(%rbp)
777// CHECK:   encoding: [0x48,0x0f,0xba,0xa5,0x28,0xff,0xff,0xff,0x3d]
778	btq	$61, -216(%rbp)
779
780
781// rdar://8061602
782L1:
783  jecxz L1
784// CHECK: jecxz L1
785// CHECK:   encoding: [0x67,0xe3,A]
786  jrcxz L1
787// CHECK: jrcxz L1
788// CHECK:   encoding: [0xe3,A]
789
790// PR8061
791xchgl   368(%rax),%ecx
792// CHECK: xchgl	%ecx, 368(%rax)
793xchgl   %ecx, 368(%rax)
794// CHECK: xchgl	%ecx, 368(%rax)
795
796// rdar://8407548
797xchg	0xdeadbeef(%rbx,%rcx,8),%bl
798// CHECK: xchgb	%bl, 3735928559(%rbx,%rcx,8)
799
800
801
802// PR7254
803lock  incl 1(%rsp)
804// CHECK: lock
805// CHECK: incl 1(%rsp)
806
807// rdar://8741045
808lock/incl 1(%rsp)
809// CHECK: lock
810// CHECK: incl 1(%rsp)
811
812// rdar://8033482
813rep movsl
814// CHECK: rep
815// CHECK: encoding: [0xf3]
816// CHECK: movsd
817// CHECK: encoding: [0xa5]
818
819
820// rdar://8403974
821iret
822// CHECK: iretl
823// CHECK: encoding: [0xcf]
824iretw
825// CHECK: iretw
826// CHECK: encoding: [0x66,0xcf]
827iretl
828// CHECK: iretl
829// CHECK: encoding: [0xcf]
830iretq
831// CHECK: iretq
832// CHECK: encoding: [0x48,0xcf]
833
834// rdar://8416805
835// CHECK: retw	$31438
836// CHECK:  encoding: [0x66,0xc2,0xce,0x7a]
837        	retw	$0x7ace
838
839// CHECK: lretw	$31438
840// CHECK:  encoding: [0x66,0xca,0xce,0x7a]
841        	lretw	$0x7ace
842
843// PR8592
844lretq  // CHECK: lretq # encoding: [0x48,0xcb]
845lretl  // CHECK: lretl # encoding: [0xcb]
846lret   // CHECK: lretl # encoding: [0xcb]
847lretw  // CHECK: lretw # encoding: [0x66,0xcb]
848
849// rdar://8403907
850sysret
851// CHECK: sysretl
852// CHECK: encoding: [0x0f,0x07]
853sysretl
854// CHECK: sysretl
855// CHECK: encoding: [0x0f,0x07]
856sysretq
857// CHECK: sysretq
858// CHECK: encoding: [0x48,0x0f,0x07]
859
860// rdar://8407242
861push %fs
862// CHECK: pushq	%fs
863// CHECK: encoding: [0x0f,0xa0]
864push %gs
865// CHECK: pushq	%gs
866// CHECK: encoding: [0x0f,0xa8]
867
868pushw %fs
869// CHECK: pushw	%fs
870// CHECK: encoding: [0x66,0x0f,0xa0]
871pushw %gs
872// CHECK: pushw	%gs
873// CHECK: encoding: [0x66,0x0f,0xa8]
874
875
876pop %fs
877// CHECK: popq	%fs
878// CHECK: encoding: [0x0f,0xa1]
879pop %gs
880// CHECK: popq	%gs
881// CHECK: encoding: [0x0f,0xa9]
882
883popw %fs
884// CHECK: popw	%fs
885// CHECK: encoding: [0x66,0x0f,0xa1]
886popw %gs
887// CHECK: popw	%gs
888// CHECK: encoding: [0x66,0x0f,0xa9]
889
890// rdar://8438816
891fildq -8(%rsp)
892fildll -8(%rsp)
893// CHECK: fildll	-8(%rsp)
894// CHECK: encoding: [0xdf,0x6c,0x24,0xf8]
895// CHECK: fildll	-8(%rsp)
896// CHECK: encoding: [0xdf,0x6c,0x24,0xf8]
897
898// CHECK: callq a
899        callq a
900
901// CHECK: leaq	-40(%rbp), %r15
902	leaq	-40(%rbp), %r15
903
904
905
906// rdar://8013734 - Alias dr6=db6
907mov %dr6, %rax
908mov %db6, %rax
909// CHECK: movq	%dr6, %rax
910// CHECK: movq	%dr6, %rax
911
912
913// INC/DEC encodings.
914incb %al  // CHECK:	incb	%al # encoding: [0xfe,0xc0]
915incw %ax  // CHECK:	incw	%ax # encoding: [0x66,0xff,0xc0]
916incl %eax // CHECK:	incl	%eax # encoding: [0xff,0xc0]
917decb %al  // CHECK:	decb	%al # encoding: [0xfe,0xc8]
918decw %ax  // CHECK:	decw	%ax # encoding: [0x66,0xff,0xc8]
919decl %eax // CHECK:	decl	%eax # encoding: [0xff,0xc8]
920
921// rdar://8416805
922// CHECK: lgdt	4(%rax)
923// CHECK:  encoding: [0x0f,0x01,0x50,0x04]
924        	lgdt	4(%rax)
925
926// CHECK: lgdt	4(%rax)
927// CHECK:  encoding: [0x0f,0x01,0x50,0x04]
928        	lgdtq	4(%rax)
929
930// CHECK: lidt	4(%rax)
931// CHECK:  encoding: [0x0f,0x01,0x58,0x04]
932        	lidt	4(%rax)
933
934// CHECK: lidt	4(%rax)
935// CHECK:  encoding: [0x0f,0x01,0x58,0x04]
936        	lidtq	4(%rax)
937
938// CHECK: sgdt	4(%rax)
939// CHECK:  encoding: [0x0f,0x01,0x40,0x04]
940        	sgdt	4(%rax)
941
942// CHECK: sgdt	4(%rax)
943// CHECK:  encoding: [0x0f,0x01,0x40,0x04]
944        	sgdtq	4(%rax)
945
946// CHECK: sidt	4(%rax)
947// CHECK:  encoding: [0x0f,0x01,0x48,0x04]
948        	sidt	4(%rax)
949
950// CHECK: sidt	4(%rax)
951// CHECK:  encoding: [0x0f,0x01,0x48,0x04]
952        	sidtq	4(%rax)
953
954
955// rdar://8208615
956mov (%rsi), %gs  // CHECK: movl	(%rsi), %gs # encoding: [0x8e,0x2e]
957mov %gs, (%rsi)  // CHECK: movl	%gs, (%rsi) # encoding: [0x8c,0x2e]
958
959
960// rdar://8431864
961	div	%bl,%al
962	div	%bx,%ax
963	div	%ecx,%eax
964	div	0xdeadbeef(%ebx,%ecx,8),%eax
965	div	0x45,%eax
966	div	0x7eed,%eax
967	div	0xbabecafe,%eax
968	div	0x12345678,%eax
969	idiv	%bl,%al
970	idiv	%bx,%ax
971	idiv	%ecx,%eax
972	idiv	0xdeadbeef(%ebx,%ecx,8),%eax
973	idiv	0x45,%eax
974	idiv	0x7eed,%eax
975	idiv	0xbabecafe,%eax
976	idiv	0x12345678,%eax
977
978// PR8524
979movd	%rax, %mm5 // CHECK: movd %rax, %mm5 # encoding: [0x48,0x0f,0x6e,0xe8]
980movd	%mm5, %rbx // CHECK: movd %mm5, %rbx # encoding: [0x48,0x0f,0x7e,0xeb]
981movq	%rax, %mm5 // CHECK: movd %rax, %mm5 # encoding: [0x48,0x0f,0x6e,0xe8]
982movq	%mm5, %rbx // CHECK: movd %mm5, %rbx # encoding: [0x48,0x0f,0x7e,0xeb]
983
984rex64 // CHECK: rex64 # encoding: [0x48]
985data16 // CHECK: data16 # encoding: [0x66]
986
987// PR8855
988movq 18446744073709551615,%rbx   // CHECK: movq	-1, %rbx
989
990// PR8946
991movdqu	%xmm0, %xmm1 // CHECK: movdqu	%xmm0, %xmm1 # encoding: [0xf3,0x0f,0x6f,0xc8]
992
993// PR8935
994xgetbv // CHECK: xgetbv # encoding: [0x0f,0x01,0xd0]
995xsetbv // CHECK: xsetbv # encoding: [0x0f,0x01,0xd1]
996
997// CHECK: loope 0
998// CHECK: encoding: [0xe1,A]
999	loopz 0
1000
1001// CHECK: loopne 0
1002// CHECK: encoding: [0xe0,A]
1003	loopnz 0
1004
1005// CHECK: outsb # encoding: [0x6e]
1006// CHECK: outsb
1007// CHECK: outsb
1008	outsb
1009	outsb	%ds:(%rsi), %dx
1010	outsb	(%rsi), %dx
1011
1012// CHECK: outsw # encoding: [0x66,0x6f]
1013// CHECK: outsw
1014// CHECK: outsw
1015	outsw
1016	outsw	%ds:(%rsi), %dx
1017	outsw	(%rsi), %dx
1018
1019// CHECK: outsl # encoding: [0x6f]
1020// CHECK: outsl
1021	outsl
1022	outsl	%ds:(%rsi), %dx
1023	outsl	(%rsi), %dx
1024
1025// CHECK: insb # encoding: [0x6c]
1026// CHECK: insb
1027	insb
1028	insb	%dx, %es:(%rdi)
1029
1030// CHECK: insw # encoding: [0x66,0x6d]
1031// CHECK: insw
1032	insw
1033	insw	%dx, %es:(%rdi)
1034
1035// CHECK: insl # encoding: [0x6d]
1036// CHECK: insl
1037	insl
1038	insl	%dx, %es:(%rdi)
1039
1040// CHECK: movsb # encoding: [0xa4]
1041// CHECK: movsb
1042// CHECK: movsb
1043	movsb
1044	movsb	%ds:(%rsi), %es:(%rdi)
1045	movsb	(%rsi), %es:(%rdi)
1046
1047// CHECK: movsw # encoding: [0x66,0xa5]
1048// CHECK: movsw
1049// CHECK: movsw
1050	movsw
1051	movsw	%ds:(%rsi), %es:(%rdi)
1052	movsw	(%rsi), %es:(%rdi)
1053
1054// CHECK: movsd # encoding: [0xa5]
1055// CHECK: movsd
1056// CHECK: movsd
1057	movsl
1058	movsl	%ds:(%rsi), %es:(%rdi)
1059	movsl	(%rsi), %es:(%rdi)
1060// rdar://10883092
1061// CHECK: movsd
1062	movsl	(%rsi), (%rdi)
1063
1064// CHECK: movsq # encoding: [0x48,0xa5]
1065// CHECK: movsq
1066// CHECK: movsq
1067	movsq
1068	movsq	%ds:(%rsi), %es:(%rdi)
1069	movsq	(%rsi), %es:(%rdi)
1070
1071// CHECK: lodsb # encoding: [0xac]
1072// CHECK: lodsb
1073// CHECK: lodsb
1074// CHECK: lodsb
1075// CHECK: lodsb
1076	lodsb
1077	lodsb	%ds:(%rsi), %al
1078	lodsb	(%rsi), %al
1079	lods	%ds:(%rsi), %al
1080	lods	(%rsi), %al
1081
1082// CHECK: lodsw # encoding: [0x66,0xad]
1083// CHECK: lodsw
1084// CHECK: lodsw
1085// CHECK: lodsw
1086// CHECK: lodsw
1087	lodsw
1088	lodsw	%ds:(%rsi), %ax
1089	lodsw	(%rsi), %ax
1090	lods	%ds:(%rsi), %ax
1091	lods	(%rsi), %ax
1092
1093// CHECK: lodsl # encoding: [0xad]
1094// CHECK: lodsl
1095// CHECK: lodsl
1096// CHECK: lodsl
1097// CHECK: lodsl
1098	lodsl
1099	lodsl	%ds:(%rsi), %eax
1100	lodsl	(%rsi), %eax
1101	lods	%ds:(%rsi), %eax
1102	lods	(%rsi), %eax
1103
1104// CHECK: lodsq # encoding: [0x48,0xad]
1105// CHECK: lodsq
1106// CHECK: lodsq
1107// CHECK: lodsq
1108// CHECK: lodsq
1109	lodsq
1110	lodsq	%ds:(%rsi), %rax
1111	lodsq	(%rsi), %rax
1112	lods	%ds:(%rsi), %rax
1113	lods	(%rsi), %rax
1114
1115// CHECK: stosb # encoding: [0xaa]
1116// CHECK: stosb
1117// CHECK: stosb
1118	stosb
1119	stosb	%al, %es:(%rdi)
1120	stos	%al, %es:(%rdi)
1121
1122// CHECK: stosw # encoding: [0x66,0xab]
1123// CHECK: stosw
1124// CHECK: stosw
1125	stosw
1126	stosw	%ax, %es:(%rdi)
1127	stos	%ax, %es:(%rdi)
1128
1129// CHECK: stosl # encoding: [0xab]
1130// CHECK: stosl
1131// CHECK: stosl
1132	stosl
1133	stosl	%eax, %es:(%rdi)
1134	stos	%eax, %es:(%rdi)
1135
1136// CHECK: stosq # encoding: [0x48,0xab]
1137// CHECK: stosq
1138// CHECK: stosq
1139	stosq
1140	stosq	%rax, %es:(%rdi)
1141	stos	%rax, %es:(%rdi)
1142
1143// CHECK: strw
1144// CHECK: encoding: [0x66,0x0f,0x00,0xc8]
1145	str %ax
1146
1147// CHECK: strl
1148// CHECK: encoding: [0x0f,0x00,0xc8]
1149	str %eax
1150
1151// CHECK: strw
1152// CHECK: encoding: [0x66,0x0f,0x00,0xc8]
1153	str %ax
1154
1155// CHECK: strq
1156// CHECK: encoding: [0x48,0x0f,0x00,0xc8]
1157	str %rax
1158
1159// CHECK: movd %rdi, %xmm0
1160// CHECK: encoding: [0x66,0x48,0x0f,0x6e,0xc7]
1161	movq %rdi,%xmm0
1162
1163// CHECK: movd %rdi, %xmm0
1164// CHECK: encoding: [0x66,0x48,0x0f,0x6e,0xc7]
1165	movd %rdi,%xmm0
1166
1167// CHECK: movntil %eax, (%rdi)
1168// CHECK: encoding: [0x0f,0xc3,0x07]
1169// CHECK: movntil
1170movntil %eax, (%rdi)
1171movnti %eax, (%rdi)
1172
1173// CHECK: movntiq %rax, (%rdi)
1174// CHECK: encoding: [0x48,0x0f,0xc3,0x07]
1175// CHECK: movntiq
1176movntiq %rax, (%rdi)
1177movnti %rax, (%rdi)
1178
1179// CHECK: pclmulqdq	$17, %xmm0, %xmm1
1180// CHECK: encoding: [0x66,0x0f,0x3a,0x44,0xc8,0x11]
1181pclmulhqhqdq %xmm0, %xmm1
1182
1183// CHECK: pclmulqdq	$1, %xmm0, %xmm1
1184// CHECK: encoding: [0x66,0x0f,0x3a,0x44,0xc8,0x01]
1185pclmulqdq $1, %xmm0, %xmm1
1186
1187// CHECK: pclmulqdq	$16, (%rdi), %xmm1
1188// CHECK: encoding: [0x66,0x0f,0x3a,0x44,0x0f,0x10]
1189pclmullqhqdq (%rdi), %xmm1
1190
1191// CHECK: pclmulqdq	$0, (%rdi), %xmm1
1192// CHECK: encoding: [0x66,0x0f,0x3a,0x44,0x0f,0x00]
1193pclmulqdq $0, (%rdi), %xmm1
1194
1195// PR10345
1196// CHECK: xchgq %rax, %rax
1197// CHECK: encoding: [0x48,0x90]
1198xchgq %rax, %rax
1199
1200// CHECK: xchgl %eax, %eax
1201// CHECK: encoding: [0x87,0xc0]
1202xchgl %eax, %eax
1203
1204// CHECK: xchgw %ax, %ax
1205// CHECK: encoding: [0x66,0x90]
1206xchgw %ax, %ax
1207
1208// CHECK: xchgl %ecx, %eax
1209// CHECK: encoding: [0x91]
1210xchgl %ecx, %eax
1211
1212// CHECK: xchgl %ecx, %eax
1213// CHECK: encoding: [0x91]
1214xchgl %eax, %ecx
1215
1216// CHECK: sysexit
1217// CHECK: encoding: [0x0f,0x35]
1218sysexit
1219
1220// CHECK: sysexitl
1221// CHECK: encoding: [0x0f,0x35]
1222sysexitl
1223
1224// CHECK: sysexitq
1225// CHECK: encoding: [0x48,0x0f,0x35]
1226sysexitq
1227