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