x86-64.s revision 3a5004dc3ee789bcbafd5b9733d3302e73e1187d
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
6// Suffix inference:
7
8// CHECK: addl $0, %eax
9        add $0, %eax
10// CHECK: addb $255, %al
11        add $0xFF, %al
12// CHECK: orq %rax, %rdx
13        or %rax, %rdx
14// CHECK: shlq $3, %rax
15        shl $3, %rax
16
17
18// CHECK: subb %al, %al
19        subb %al, %al
20
21// CHECK: addl $24, %eax
22        addl $24, %eax
23
24// CHECK: movl %eax, 10(%ebp)
25        movl %eax, 10(%ebp)
26// CHECK: movl %eax, 10(%ebp,%ebx)
27        movl %eax, 10(%ebp, %ebx)
28// CHECK: movl %eax, 10(%ebp,%ebx,4)
29        movl %eax, 10(%ebp, %ebx, 4)
30// CHECK: movl %eax, 10(,%ebx,4)
31        movl %eax, 10(, %ebx, 4)
32
33// CHECK: movl 0, %eax
34        movl 0, %eax
35// CHECK: movl $0, %eax
36        movl $0, %eax
37
38// CHECK: ret
39        ret
40
41// FIXME: Check that this matches SUB32ri8
42// CHECK: subl $1, %eax
43        subl $1, %eax
44
45// FIXME: Check that this matches SUB32ri8
46// CHECK: subl $-1, %eax
47        subl $-1, %eax
48
49// FIXME: Check that this matches SUB32ri
50// CHECK: subl $256, %eax
51        subl $256, %eax
52
53// FIXME: Check that this matches XOR64ri8
54// CHECK: xorq $1, %rax
55        xorq $1, %rax
56
57// FIXME: Check that this matches XOR64ri32
58// CHECK: xorq $256, %rax
59        xorq $256, %rax
60
61// FIXME: Check that this matches SUB8rr
62// CHECK: subb %al, %bl
63        subb %al, %bl
64
65// FIXME: Check that this matches SUB16rr
66// CHECK: subw %ax, %bx
67        subw %ax, %bx
68
69// FIXME: Check that this matches SUB32rr
70// CHECK: subl %eax, %ebx
71        subl %eax, %ebx
72
73// FIXME: Check that this matches the correct instruction.
74// CHECK: callq *%rax
75        call *%rax
76
77// FIXME: Check that this matches the correct instruction.
78// CHECK: shldl %cl, %eax, %ebx
79        shldl %cl, %eax, %ebx
80
81// CHECK: shll $2, %eax
82        shll $2, %eax
83
84// CHECK: shll $2, %eax
85        sall $2, %eax
86
87// CHECK: rep
88// CHECK: insb
89        rep;insb
90
91// CHECK: rep
92// CHECK: outsb
93        rep;outsb
94
95// CHECK: rep
96// CHECK: movsb
97        rep;movsb
98
99
100// rdar://8470918
101smovb // CHECK: movsb
102smovw // CHECK: movsw
103smovl // CHECK: movsl
104smovq // CHECK: movsq
105
106// rdar://8456361
107// CHECK: rep
108// CHECK: movsl
109        rep movsd
110
111// CHECK: rep
112// CHECK: lodsb
113        rep;lodsb
114
115// CHECK: rep
116// CHECK: stosb
117        rep;stosb
118
119// NOTE: repz and repe have the same opcode as rep
120// CHECK: rep
121// CHECK: cmpsb
122        repz;cmpsb
123
124// NOTE: repnz has the same opcode as repne
125// CHECK: repne
126// CHECK: cmpsb
127        repnz;cmpsb
128
129// NOTE: repe and repz have the same opcode as rep
130// CHECK: rep
131// CHECK: scasb
132        repe;scasb
133
134// CHECK: repne
135// CHECK: scasb
136        repne;scasb
137
138// CHECK: lock
139// CHECK: cmpxchgb %al, (%ebx)
140        lock;cmpxchgb %al, 0(%ebx)
141
142// CHECK: cs
143// CHECK: movb (%eax), %al
144        cs;movb 0(%eax), %al
145
146// CHECK: ss
147// CHECK: movb (%eax), %al
148        ss;movb 0(%eax), %al
149
150// CHECK: ds
151// CHECK: movb (%eax), %al
152        ds;movb 0(%eax), %al
153
154// CHECK: es
155// CHECK: movb (%eax), %al
156        es;movb 0(%eax), %al
157
158// CHECK: fs
159// CHECK: movb (%eax), %al
160        fs;movb 0(%eax), %al
161
162// CHECK: gs
163// CHECK: movb (%eax), %al
164        gs;movb 0(%eax), %al
165
166// CHECK: fadd %st(0)
167// CHECK: fadd %st(1)
168// CHECK: fadd %st(7)
169
170fadd %st(0)
171fadd %st(1)
172fadd %st(7)
173
174// CHECK: leal 0, %eax
175        leal 0, %eax
176
177// rdar://7986634 - Insensitivity on opcodes.
178// CHECK: int3
179INT3
180
181
182// Allow scale factor without index register.
183// CHECK: movaps	%xmm3, (%esi)
184// CHECK-STDERR: warning: scale factor without index register is ignored
185movaps %xmm3, (%esi, 2)
186
187// CHECK: imull $12, %eax, %eax
188imul $12, %eax
189
190// CHECK: imull %ecx, %eax
191imull %ecx, %eax
192
193
194// rdar://8208481
195// CHECK: outb	%al, $161
196outb	%al, $161
197// CHECK: outw	%ax, $128
198outw	%ax, $128
199// CHECK: inb	$161, %al
200inb	$161, %al
201
202// rdar://8017621
203// CHECK: pushq	$1
204push $1
205
206// rdar://8017530
207// CHECK: sldtw	4
208sldt	4
209
210// rdar://8208499
211// CHECK: cmovnew	%bx, %ax
212cmovnz %bx, %ax
213// CHECK: cmovneq	%rbx, %rax
214cmovnzq %rbx, %rax
215
216
217// rdar://8407928
218// CHECK: inb	$127, %al
219// CHECK: inw	%dx, %ax
220// CHECK: outb	%al, $127
221// CHECK: outw	%ax, %dx
222// CHECK: inl	%dx, %eax
223inb	$0x7f
224inw	%dx
225outb	$0x7f
226outw	%dx
227inl	%dx
228
229
230// PR8114
231// CHECK: outb	%al, %dx
232// CHECK: outw	%ax, %dx
233// CHECK: outl	%eax, %dx
234
235out %al, (%dx)
236out %ax, (%dx)
237outl %eax, (%dx)
238
239
240// rdar://8431422
241
242// CHECK: fxch	%st(1)
243// CHECK: fucom	%st(1)
244// CHECK: fucomp	%st(1)
245// CHECK: faddp	%st(1)
246// CHECK: faddp	%st(0)
247// CHECK: fsubp	%st(1)
248// CHECK: fsubrp	%st(1)
249// CHECK: fmulp	%st(1)
250// CHECK: fdivp	%st(1)
251// CHECK: fdivrp	%st(1)
252
253fxch
254fucom
255fucomp
256faddp
257faddp %st
258fsubp
259fsubrp
260fmulp
261fdivp
262fdivrp
263
264// CHECK: fcomi	%st(1)
265// CHECK: fcomi	%st(2)
266// CHECK: fucomi	%st(1)
267// CHECK: fucomi	%st(2)
268// CHECK: fucomi	%st(2)
269
270fcomi
271fcomi	%st(2)
272fucomi
273fucomi	%st(2)
274fucomi	%st(2), %st
275
276// CHECK: fnstsw %ax
277// CHECK: fnstsw %ax
278// CHECK: fnstsw %ax
279// CHECK: fnstsw %ax
280
281fnstsw
282fnstsw %ax
283fnstsw %eax
284fnstsw %al
285
286// rdar://8431880
287// CHECK: rclb	%bl
288// CHECK: rcll	3735928559(%ebx,%ecx,8)
289// CHECK: rcrl	%ecx
290// CHECK: rcrl	305419896
291rcl	%bl
292rcll	0xdeadbeef(%ebx,%ecx,8)
293rcr	%ecx
294rcrl	0x12345678
295
296rclb	%bl       // CHECK: rclb %bl     # encoding: [0xd0,0xd3]
297rclb	$1, %bl   // CHECK: rclb %bl     # encoding: [0xd0,0xd3]
298rclb	$2, %bl   // CHECK: rclb $2, %bl # encoding: [0xc0,0xd3,0x02]
299
300// rdar://8418316
301// CHECK: shldw	$1, %bx, %bx
302// CHECK: shldw	$1, %bx, %bx
303// CHECK: shrdw	$1, %bx, %bx
304// CHECK: shrdw	$1, %bx, %bx
305
306shld	%bx,%bx
307shld	$1, %bx,%bx
308shrd	%bx,%bx
309shrd	$1, %bx,%bx
310
311// CHECK: sldtl	%ecx
312// CHECK: encoding: [0x0f,0x00,0xc1]
313// CHECK: sldtw	%cx
314// CHECK: encoding: [0x66,0x0f,0x00,0xc1]
315
316sldt	%ecx
317sldt	%cx
318
319// CHECK: lcalll	*3135175374
320// CHECK: ljmpl	*3135175374
321lcall	*0xbadeface
322ljmp	*0xbadeface
323
324
325// rdar://8444631
326// CHECK: enter	$31438, $0
327// CHECK: encoding: [0xc8,0xce,0x7a,0x00]
328// CHECK: enter	$31438, $1
329// CHECK: encoding: [0xc8,0xce,0x7a,0x01]
330// CHECK: enter	$31438, $127
331// CHECK: encoding: [0xc8,0xce,0x7a,0x7f]
332enter $0x7ace,$0
333enter $0x7ace,$1
334enter $0x7ace,$0x7f
335
336
337// rdar://8456364
338// CHECK: movw	%cs, %ax
339mov %CS, %ax
340
341// rdar://8456391
342fcmovb %st(1), %st(0)   // CHECK: fcmovb	%st(1), %st(0)
343fcmove %st(1), %st(0)   // CHECK: fcmove	%st(1), %st(0)
344fcmovbe %st(1), %st(0)  // CHECK: fcmovbe	%st(1), %st(0)
345fcmovu %st(1), %st(0)   // CHECK: fcmovu	 %st(1), %st(0)
346
347fcmovnb %st(1), %st(0)  // CHECK: fcmovnb	%st(1), %st(0)
348fcmovne %st(1), %st(0)  // CHECK: fcmovne	%st(1), %st(0)
349fcmovnbe %st(1), %st(0) // CHECK: fcmovnbe	%st(1), %st(0)
350fcmovnu %st(1), %st(0)  // CHECK: fcmovnu	%st(1), %st(0)
351
352fcmovnae %st(1), %st(0) // CHECK: fcmovb	%st(1), %st(0)
353fcmovna %st(1), %st(0)  // CHECK: fcmovbe	%st(1), %st(0)
354
355fcmovae %st(1), %st(0)  // CHECK: fcmovnb	%st(1), %st(0)
356fcmova %st(1), %st(0)   // CHECK: fcmovnbe	%st(1), %st(0)
357
358// rdar://8456417
359.byte 88 + 1 & 15  // CHECK: .byte	9
360
361// rdar://8456412
362mov %rdx, %cr0
363// CHECK: movq	%rdx, %cr0
364// CHECK: encoding: [0x0f,0x22,0xc2]
365mov %rdx, %cr4
366// CHECK: movq	%rdx, %cr4
367// CHECK: encoding: [0x0f,0x22,0xe2]
368mov %rdx, %cr8
369// CHECK: movq	%rdx, %cr8
370// CHECK: encoding: [0x44,0x0f,0x22,0xc2]
371mov %rdx, %cr15
372// CHECK: movq	%rdx, %cr15
373// CHECK: encoding: [0x44,0x0f,0x22,0xfa]
374
375// rdar://8456371 - Handle commutable instructions written backward.
376// CHECK: 	faddp	%st(1)
377// CHECK:	fmulp	%st(2)
378faddp %st, %st(1)
379fmulp %st, %st(2)
380
381// rdar://8468087 - Encode these accurately, they are not synonyms.
382// CHECK: fmul	%st(0), %st(1)
383// CHECK: encoding: [0xdc,0xc9]
384// CHECK: fmul	%st(1)
385// CHECK: encoding: [0xd8,0xc9]
386fmul %st, %st(1)
387fmul %st(1), %st
388
389// CHECK: fadd	%st(0), %st(1)
390// CHECK: encoding: [0xdc,0xc1]
391// CHECK: fadd	%st(1)
392// CHECK: encoding: [0xd8,0xc1]
393fadd %st, %st(1)
394fadd %st(1), %st
395
396
397// rdar://8416805
398// CHECK: xorb	%al, %al
399// CHECK: encoding: [0x30,0xc0]
400// CHECK: xorw	%di, %di
401// CHECK: encoding: [0x66,0x31,0xff]
402// CHECK: xorl	%esi, %esi
403// CHECK: encoding: [0x31,0xf6]
404// CHECK: xorq	%rsi, %rsi
405// CHECK: encoding: [0x48,0x31,0xf6]
406clrb    %al
407clr    %di
408clr    %esi
409clr    %rsi
410
411// rdar://8456378
412cltq  // CHECK: cltq
413cdqe  // CHECK: cltq
414cwde  // CHECK: cwtl
415cwtl  // CHECK: cwtl
416
417// rdar://8416805
418cbw   // CHECK: cbtw
419cwd   // CHECK: cwtd
420cdq   // CHECK: cltd
421
422// rdar://8456378 and PR7557 - fstsw
423fstsw %ax
424// CHECK: wait
425// CHECK: fnstsw %ax
426fstsw (%rax)
427// CHECK: wait
428// CHECK: fnstsw (%rax)
429
430// PR8259
431fstcw (%rsp)
432// CHECK: wait
433// CHECK: fnstcw (%rsp)
434
435// PR8259
436fstcw (%rsp)
437// CHECK: wait
438// CHECK: fnstcw (%rsp)
439
440// PR8258
441finit
442// CHECK: wait
443// CHECK: fninit
444
445fsave	32493
446// CHECK: wait
447// CHECK: fnsave 32493
448
449
450// rdar://8456382 - cvtsd2si support.
451cvtsd2si	%xmm1, %rax
452// CHECK: cvtsd2siq	%xmm1, %rax
453// CHECK: encoding: [0xf2,0x48,0x0f,0x2d,0xc1]
454cvtsd2si	%xmm1, %eax
455// CHECK: cvtsd2sil	%xmm1, %eax
456// CHECK: encoding: [0xf2,0x0f,0x2d,0xc1]
457
458cvtsd2siq %xmm0, %rax // CHECK: cvtsd2siq	%xmm0, %rax
459cvtsd2sil %xmm0, %eax // CHECK: cvtsd2sil	%xmm0, %eax
460cvtsd2si %xmm0, %rax  // CHECK: cvtsd2siq	%xmm0, %rax
461
462
463cvttpd2dq %xmm1, %xmm0  // CHECK: cvttpd2dq %xmm1, %xmm0
464cvttpd2dq (%rax), %xmm0 // CHECK: cvttpd2dq (%rax), %xmm0
465
466cvttps2dq %xmm1, %xmm0  // CHECK: cvttps2dq %xmm1, %xmm0
467cvttps2dq (%rax), %xmm0 // CHECK: cvttps2dq (%rax), %xmm0
468
469// rdar://8456376 - llvm-mc rejects 'roundss'
470roundss $0xE, %xmm0, %xmm0 // CHECK: encoding: [0x66,0x0f,0x3a,0x0a,0xc0,0x0e]
471roundps $0xE, %xmm0, %xmm0 // CHECK: encoding: [0x66,0x0f,0x3a,0x08,0xc0,0x0e]
472roundsd $0xE, %xmm0, %xmm0 // CHECK: encoding: [0x66,0x0f,0x3a,0x0b,0xc0,0x0e]
473roundpd $0xE, %xmm0, %xmm0 // CHECK: encoding: [0x66,0x0f,0x3a,0x09,0xc0,0x0e]
474
475
476// rdar://8482675 - 32-bit mem operand support in 64-bit mode (0x67 prefix)
477leal	8(%eax), %esi
478// CHECK: leal	8(%eax), %esi
479// CHECK: encoding: [0x67,0x8d,0x70,0x08]
480leaq	8(%eax), %rsi
481// CHECK: leaq	8(%eax), %rsi
482// CHECK: encoding: [0x67,0x48,0x8d,0x70,0x08]
483leaq	8(%rax), %rsi
484// CHECK: leaq	8(%rax), %rsi
485// CHECK: encoding: [0x48,0x8d,0x70,0x08]
486
487
488cvttpd2dq	0xdeadbeef(%ebx,%ecx,8),%xmm5
489// CHECK: cvttpd2dq	3735928559(%ebx,%ecx,8), %xmm5
490// CHECK: encoding: [0x67,0x66,0x0f,0xe6,0xac,0xcb,0xef,0xbe,0xad,0xde]
491
492// rdar://8490728 - llvm-mc rejects 'movmskpd'
493movmskpd	%xmm6, %rax
494// CHECK: movmskpd	%xmm6, %rax
495// CHECK: encoding: [0x66,0x48,0x0f,0x50,0xc6]
496movmskpd	%xmm6, %eax
497// CHECK: movmskpd	%xmm6, %eax
498// CHECK: encoding: [0x66,0x0f,0x50,0xc6]
499
500// rdar://8491845 - Gas supports commuted forms of non-commutable instructions.
501fdivrp %st(0), %st(1) // CHECK: encoding: [0xde,0xf9]
502fdivrp %st(1), %st(0) // CHECK: encoding: [0xde,0xf9]
503
504fsubrp %ST(0), %ST(1) // CHECK: encoding: [0xde,0xe9]
505fsubrp %ST(1), %ST(0) // CHECK: encoding: [0xde,0xe9]
506
507// also PR8861
508fdivp %st(0), %st(1) // CHECK: encoding: [0xde,0xf1]
509fdivp %st(1), %st(0) // CHECK: encoding: [0xde,0xf1]
510
511
512movl	foo(%rip), %eax
513// CHECK: movl	foo(%rip), %eax
514// CHECK: encoding: [0x8b,0x05,A,A,A,A]
515// CHECK: fixup A - offset: 2, value: foo-4, kind: reloc_riprel_4byte
516
517movb	$12, foo(%rip)
518// CHECK: movb	$12, foo(%rip)
519// CHECK: encoding: [0xc6,0x05,A,A,A,A,0x0c]
520// CHECK:    fixup A - offset: 2, value: foo-5, kind: reloc_riprel_4byte
521
522movw	$12, foo(%rip)
523// CHECK: movw	$12, foo(%rip)
524// CHECK: encoding: [0x66,0xc7,0x05,A,A,A,A,0x0c,0x00]
525// CHECK:    fixup A - offset: 3, value: foo-6, kind: reloc_riprel_4byte
526
527movl	$12, foo(%rip)
528// CHECK: movl	$12, foo(%rip)
529// CHECK: encoding: [0xc7,0x05,A,A,A,A,0x0c,0x00,0x00,0x00]
530// CHECK:    fixup A - offset: 2, value: foo-8, kind: reloc_riprel_4byte
531
532movq	$12, foo(%rip)
533// CHECK:  movq	$12, foo(%rip)
534// CHECK: encoding: [0x48,0xc7,0x05,A,A,A,A,0x0c,0x00,0x00,0x00]
535// CHECK:    fixup A - offset: 3, value: foo-8, kind: reloc_riprel_4byte
536
537// CHECK: addq	$-424, %rax
538// CHECK: encoding: [0x48,0x05,0x58,0xfe,0xff,0xff]
539addq $-424, %rax
540
541
542// CHECK: movq	_foo@GOTPCREL(%rip), %rax
543// CHECK:  encoding: [0x48,0x8b,0x05,A,A,A,A]
544// CHECK:  fixup A - offset: 3, value: _foo@GOTPCREL-4, kind: reloc_riprel_4byte_movq_load
545movq _foo@GOTPCREL(%rip), %rax
546
547// CHECK: movq	_foo@GOTPCREL(%rip), %r14
548// CHECK:  encoding: [0x4c,0x8b,0x35,A,A,A,A]
549// CHECK:  fixup A - offset: 3, value: _foo@GOTPCREL-4, kind: reloc_riprel_4byte_movq_load
550movq _foo@GOTPCREL(%rip), %r14
551
552
553// CHECK: movq	(%r13,%rax,8), %r13
554// CHECK:  encoding: [0x4d,0x8b,0x6c,0xc5,0x00]
555movq 0x00(%r13,%rax,8),%r13
556
557// CHECK: testq	%rax, %rbx
558// CHECK:  encoding: [0x48,0x85,0xd8]
559testq %rax, %rbx
560
561// CHECK: cmpq	%rbx, %r14
562// CHECK:   encoding: [0x49,0x39,0xde]
563        cmpq %rbx, %r14
564
565// rdar://7947167
566
567movsq
568// CHECK: movsq
569// CHECK:   encoding: [0x48,0xa5]
570
571movsl
572// CHECK: movsl
573// CHECK:   encoding: [0xa5]
574
575stosq
576// CHECK: stosq
577// CHECK:   encoding: [0x48,0xab]
578stosl
579// CHECK: stosl
580// CHECK:   encoding: [0xab]
581
582
583// Not moffset forms of moves, they are x86-32 only! rdar://7947184
584movb	0, %al    // CHECK: movb 0, %al # encoding: [0x8a,0x04,0x25,0x00,0x00,0x00,0x00]
585movw	0, %ax    // CHECK: movw 0, %ax # encoding: [0x66,0x8b,0x04,0x25,0x00,0x00,0x00,0x00]
586movl	0, %eax   // CHECK: movl 0, %eax # encoding: [0x8b,0x04,0x25,0x00,0x00,0x00,0x00]
587
588// CHECK: pushfq	# encoding: [0x9c]
589        pushf
590// CHECK: pushfq	# encoding: [0x9c]
591        pushfq
592// CHECK: popfq	        # encoding: [0x9d]
593        popf
594// CHECK: popfq	        # encoding: [0x9d]
595        popfq
596
597// CHECK: movabsq $-281474976710654, %rax
598// CHECK: encoding: [0x48,0xb8,0x02,0x00,0x00,0x00,0x00,0x00,0xff,0xff]
599        movabsq $0xFFFF000000000002, %rax
600
601// CHECK: movabsq $-281474976710654, %rax
602// CHECK: encoding: [0x48,0xb8,0x02,0x00,0x00,0x00,0x00,0x00,0xff,0xff]
603        movq $0xFFFF000000000002, %rax
604
605// CHECK: movq $-65536, %rax
606// CHECK: encoding: [0x48,0xc7,0xc0,0x00,0x00,0xff,0xff]
607        movq $0xFFFFFFFFFFFF0000, %rax
608
609// CHECK: movq $-256, %rax
610// CHECK: encoding: [0x48,0xc7,0xc0,0x00,0xff,0xff,0xff]
611        movq $0xFFFFFFFFFFFFFF00, %rax
612
613// CHECK: movq $10, %rax
614// CHECK: encoding: [0x48,0xc7,0xc0,0x0a,0x00,0x00,0x00]
615        movq $10, %rax
616
617// rdar://8014869
618//
619// CHECK: ret
620// CHECK:  encoding: [0xc3]
621        retq
622
623// CHECK: sete %al
624// CHECK: encoding: [0x0f,0x94,0xc0]
625        setz %al
626
627// CHECK: setne %al
628// CHECK: encoding: [0x0f,0x95,0xc0]
629        setnz %al
630
631// CHECK: je 0
632// CHECK: encoding: [0x74,A]
633        jz 0
634
635// CHECK: jne
636// CHECK: encoding: [0x75,A]
637        jnz 0
638
639// rdar://8017515
640btq $0x01,%rdx
641// CHECK: btq	$1, %rdx
642// CHECK:  encoding: [0x48,0x0f,0xba,0xe2,0x01]
643
644//rdar://8017633
645// CHECK: movzbl	%al, %esi
646// CHECK:  encoding: [0x0f,0xb6,0xf0]
647        movzx %al, %esi
648
649// CHECK: movzbq	%al, %rsi
650// CHECK:  encoding: [0x48,0x0f,0xb6,0xf0]
651        movzx %al, %rsi
652
653// CHECK: movsbw	%al, %ax
654// CHECK: encoding: [0x66,0x0f,0xbe,0xc0]
655movsx %al, %ax
656
657// CHECK: movsbl	%al, %eax
658// CHECK: encoding: [0x0f,0xbe,0xc0]
659movsx %al, %eax
660
661// CHECK: movswl	%ax, %eax
662// CHECK: encoding: [0x0f,0xbf,0xc0]
663movsx %ax, %eax
664
665// CHECK: movsbq	%bl, %rax
666// CHECK: encoding: [0x48,0x0f,0xbe,0xc3]
667movsx %bl, %rax
668
669// CHECK: movswq %cx, %rax
670// CHECK: encoding: [0x48,0x0f,0xbf,0xc1]
671movsx %cx, %rax
672
673// CHECK: movslq	%edi, %rax
674// CHECK: encoding: [0x48,0x63,0xc7]
675movsx %edi, %rax
676
677// CHECK: movzbw	%al, %ax
678// CHECK: encoding: [0x66,0x0f,0xb6,0xc0]
679movzx %al, %ax
680
681// CHECK: movzbl	%al, %eax
682// CHECK: encoding: [0x0f,0xb6,0xc0]
683movzx %al, %eax
684
685// CHECK: movzwl	%ax, %eax
686// CHECK: encoding: [0x0f,0xb7,0xc0]
687movzx %ax, %eax
688
689// CHECK: movzbq	%bl, %rax
690// CHECK: encoding: [0x48,0x0f,0xb6,0xc3]
691movzx %bl, %rax
692
693// CHECK: movzwq	%cx, %rax
694// CHECK: encoding: [0x48,0x0f,0xb7,0xc1]
695movzx %cx, %rax
696
697// CHECK: movsbw	(%rax), %ax
698// CHECK: encoding: [0x66,0x0f,0xbe,0x00]
699movsx (%rax), %ax
700
701// CHECK: movzbw	(%rax), %ax
702// CHECK: encoding: [0x66,0x0f,0xb6,0x00]
703movzx (%rax), %ax
704
705
706// rdar://7873482
707// CHECK: [0x65,0x8b,0x04,0x25,0x7c,0x00,0x00,0x00]
708        movl	%gs:124, %eax
709
710// CHECK: jmpq *8(%rax)
711// CHECK:   encoding: [0xff,0x60,0x08]
712	jmp	*8(%rax)
713
714// CHECK: btq $61, -216(%rbp)
715// CHECK:   encoding: [0x48,0x0f,0xba,0xa5,0x28,0xff,0xff,0xff,0x3d]
716	btq	$61, -216(%rbp)
717
718
719// rdar://8061602
720L1:
721  jecxz L1
722// CHECK: jecxz L1
723// CHECK:   encoding: [0x67,0xe3,A]
724  jrcxz L1
725// CHECK: jrcxz L1
726// CHECK:   encoding: [0xe3,A]
727
728// PR8061
729xchgl   368(%rax),%ecx
730// CHECK: xchgl	%ecx, 368(%rax)
731xchgl   %ecx, 368(%rax)
732// CHECK: xchgl	%ecx, 368(%rax)
733
734// rdar://8407548
735xchg	0xdeadbeef(%rbx,%rcx,8),%bl
736// CHECK: xchgb	%bl, 3735928559(%rbx,%rcx,8)
737
738
739
740// PR7254
741lock  incl 1(%rsp)
742// CHECK: lock
743// CHECK: incl 1(%rsp)
744
745// rdar://8741045
746lock/incl 1(%rsp)
747// CHECK: lock
748// CHECK: incl 1(%rsp)
749
750// rdar://8033482
751rep movsl
752// CHECK: rep
753// CHECK: encoding: [0xf3]
754// CHECK: movsl
755// CHECK: encoding: [0xa5]
756
757
758// rdar://8403974
759iret
760// CHECK: iretl
761// CHECK: encoding: [0xcf]
762iretw
763// CHECK: iretw
764// CHECK: encoding: [0x66,0xcf]
765iretl
766// CHECK: iretl
767// CHECK: encoding: [0xcf]
768iretq
769// CHECK: iretq
770// CHECK: encoding: [0x48,0xcf]
771
772// rdar://8416805
773// CHECK: retw	$31438
774// CHECK:  encoding: [0x66,0xc2,0xce,0x7a]
775        	retw	$0x7ace
776
777// CHECK: lretw	$31438
778// CHECK:  encoding: [0x66,0xca,0xce,0x7a]
779        	lretw	$0x7ace
780
781// PR8592
782lretq  // CHECK: lretq # encoding: [0x48,0xcb]
783lretl  // CHECK: lretl # encoding: [0xcb]
784lret   // CHECK: lretl # encoding: [0xcb]
785
786// rdar://8403907
787sysret
788// CHECK: sysretl
789// CHECK: encoding: [0x0f,0x07]
790sysretl
791// CHECK: sysretl
792// CHECK: encoding: [0x0f,0x07]
793sysretq
794// CHECK: sysretq
795// CHECK: encoding: [0x48,0x0f,0x07]
796
797// rdar://8407242
798push %fs
799// CHECK: pushq	%fs
800// CHECK: encoding: [0x0f,0xa0]
801push %gs
802// CHECK: pushq	%gs
803// CHECK: encoding: [0x0f,0xa8]
804
805pushw %fs
806// CHECK: pushw	%fs
807// CHECK: encoding: [0x66,0x0f,0xa0]
808pushw %gs
809// CHECK: pushw	%gs
810// CHECK: encoding: [0x66,0x0f,0xa8]
811
812
813pop %fs
814// CHECK: popq	%fs
815// CHECK: encoding: [0x0f,0xa1]
816pop %gs
817// CHECK: popq	%gs
818// CHECK: encoding: [0x0f,0xa9]
819
820popw %fs
821// CHECK: popw	%fs
822// CHECK: encoding: [0x66,0x0f,0xa1]
823popw %gs
824// CHECK: popw	%gs
825// CHECK: encoding: [0x66,0x0f,0xa9]
826
827// rdar://8438816
828fildq -8(%rsp)
829fildll -8(%rsp)
830// CHECK: fildll	-8(%rsp)
831// CHECK: encoding: [0xdf,0x6c,0x24,0xf8]
832// CHECK: fildll	-8(%rsp)
833// CHECK: encoding: [0xdf,0x6c,0x24,0xf8]
834
835// CHECK: callq a
836        callq a
837
838// CHECK: leaq	-40(%rbp), %r15
839	leaq	-40(%rbp), %r15
840
841
842
843// rdar://8013734 - Alias dr6=db6
844mov %dr6, %rax
845mov %db6, %rax
846// CHECK: movq	%dr6, %rax
847// CHECK: movq	%dr6, %rax
848
849
850// INC/DEC encodings.
851incb %al  // CHECK:	incb	%al # encoding: [0xfe,0xc0]
852incw %ax  // CHECK:	incw	%ax # encoding: [0x66,0xff,0xc0]
853incl %eax // CHECK:	incl	%eax # encoding: [0xff,0xc0]
854decb %al  // CHECK:	decb	%al # encoding: [0xfe,0xc8]
855decw %ax  // CHECK:	decw	%ax # encoding: [0x66,0xff,0xc8]
856decl %eax // CHECK:	decl	%eax # encoding: [0xff,0xc8]
857
858// rdar://8416805
859// CHECK: lgdt	4(%rax)
860// CHECK:  encoding: [0x0f,0x01,0x50,0x04]
861        	lgdt	4(%rax)
862
863// CHECK: lgdt	4(%rax)
864// CHECK:  encoding: [0x0f,0x01,0x50,0x04]
865        	lgdtq	4(%rax)
866
867// CHECK: lidt	4(%rax)
868// CHECK:  encoding: [0x0f,0x01,0x58,0x04]
869        	lidt	4(%rax)
870
871// CHECK: lidt	4(%rax)
872// CHECK:  encoding: [0x0f,0x01,0x58,0x04]
873        	lidtq	4(%rax)
874
875// CHECK: sgdt	4(%rax)
876// CHECK:  encoding: [0x0f,0x01,0x40,0x04]
877        	sgdt	4(%rax)
878
879// CHECK: sgdt	4(%rax)
880// CHECK:  encoding: [0x0f,0x01,0x40,0x04]
881        	sgdtq	4(%rax)
882
883// CHECK: sidt	4(%rax)
884// CHECK:  encoding: [0x0f,0x01,0x48,0x04]
885        	sidt	4(%rax)
886
887// CHECK: sidt	4(%rax)
888// CHECK:  encoding: [0x0f,0x01,0x48,0x04]
889        	sidtq	4(%rax)
890
891
892// rdar://8208615
893mov (%rsi), %gs  // CHECK: movl	(%rsi), %gs # encoding: [0x8e,0x2e]
894mov %gs, (%rsi)  // CHECK: movl	%gs, (%rsi) # encoding: [0x8c,0x2e]
895
896
897// rdar://8431864
898	div	%bl,%al
899	div	%bx,%ax
900	div	%ecx,%eax
901	div	0xdeadbeef(%ebx,%ecx,8),%eax
902	div	0x45,%eax
903	div	0x7eed,%eax
904	div	0xbabecafe,%eax
905	div	0x12345678,%eax
906	idiv	%bl,%al
907	idiv	%bx,%ax
908	idiv	%ecx,%eax
909	idiv	0xdeadbeef(%ebx,%ecx,8),%eax
910	idiv	0x45,%eax
911	idiv	0x7eed,%eax
912	idiv	0xbabecafe,%eax
913	idiv	0x12345678,%eax
914
915// PR8524
916movd	%rax, %mm5 // CHECK: movd %rax, %mm5 # encoding: [0x48,0x0f,0x6e,0xe8]
917movd	%mm5, %rbx // CHECK: movd %mm5, %rbx # encoding: [0x48,0x0f,0x7e,0xeb]
918movq	%rax, %mm5 // CHECK: movd %rax, %mm5 # encoding: [0x48,0x0f,0x6e,0xe8]
919movq	%mm5, %rbx // CHECK: movd %mm5, %rbx # encoding: [0x48,0x0f,0x7e,0xeb]
920
921rex64 // CHECK: rex64 # encoding: [0x48]
922data16 // CHECK: data16 # encoding: [0x66]
923
924// PR8855
925movq 18446744073709551615,%rbx   // CHECK: movq	-1, %rbx
926
927// PR8946
928movdqu	%xmm0, %xmm1 // CHECK: movdqu	%xmm0, %xmm1 # encoding: [0xf3,0x0f,0x6f,0xc8]
929