x86-64.s revision 824a9076eaf8d109bc79f53e51b7d7a045f42552
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// PR9264
652btl	$1, 0 // CHECK: btl $1, 0 # encoding: [0x0f,0xba,0x24,0x25,0x00,0x00,0x00,0x00,0x01]
653bt	$1, 0 // CHECK: btl $1, 0 # encoding: [0x0f,0xba,0x24,0x25,0x00,0x00,0x00,0x00,0x01]
654
655// rdar://8017515
656btq $0x01,%rdx
657// CHECK: btq	$1, %rdx
658// CHECK:  encoding: [0x48,0x0f,0xba,0xe2,0x01]
659
660//rdar://8017633
661// CHECK: movzbl	%al, %esi
662// CHECK:  encoding: [0x0f,0xb6,0xf0]
663        movzx %al, %esi
664
665// CHECK: movzbq	%al, %rsi
666// CHECK:  encoding: [0x48,0x0f,0xb6,0xf0]
667        movzx %al, %rsi
668
669// CHECK: movsbw	%al, %ax
670// CHECK: encoding: [0x66,0x0f,0xbe,0xc0]
671movsx %al, %ax
672
673// CHECK: movsbl	%al, %eax
674// CHECK: encoding: [0x0f,0xbe,0xc0]
675movsx %al, %eax
676
677// CHECK: movswl	%ax, %eax
678// CHECK: encoding: [0x0f,0xbf,0xc0]
679movsx %ax, %eax
680
681// CHECK: movsbq	%bl, %rax
682// CHECK: encoding: [0x48,0x0f,0xbe,0xc3]
683movsx %bl, %rax
684
685// CHECK: movswq %cx, %rax
686// CHECK: encoding: [0x48,0x0f,0xbf,0xc1]
687movsx %cx, %rax
688
689// CHECK: movslq	%edi, %rax
690// CHECK: encoding: [0x48,0x63,0xc7]
691movsx %edi, %rax
692
693// CHECK: movzbw	%al, %ax
694// CHECK: encoding: [0x66,0x0f,0xb6,0xc0]
695movzx %al, %ax
696
697// CHECK: movzbl	%al, %eax
698// CHECK: encoding: [0x0f,0xb6,0xc0]
699movzx %al, %eax
700
701// CHECK: movzwl	%ax, %eax
702// CHECK: encoding: [0x0f,0xb7,0xc0]
703movzx %ax, %eax
704
705// CHECK: movzbq	%bl, %rax
706// CHECK: encoding: [0x48,0x0f,0xb6,0xc3]
707movzx %bl, %rax
708
709// CHECK: movzwq	%cx, %rax
710// CHECK: encoding: [0x48,0x0f,0xb7,0xc1]
711movzx %cx, %rax
712
713// CHECK: movsbw	(%rax), %ax
714// CHECK: encoding: [0x66,0x0f,0xbe,0x00]
715movsx (%rax), %ax
716
717// CHECK: movzbw	(%rax), %ax
718// CHECK: encoding: [0x66,0x0f,0xb6,0x00]
719movzx (%rax), %ax
720
721
722// rdar://7873482
723// CHECK: [0x65,0x8b,0x04,0x25,0x7c,0x00,0x00,0x00]
724        movl	%gs:124, %eax
725
726// CHECK: jmpq *8(%rax)
727// CHECK:   encoding: [0xff,0x60,0x08]
728	jmp	*8(%rax)
729
730// CHECK: btq $61, -216(%rbp)
731// CHECK:   encoding: [0x48,0x0f,0xba,0xa5,0x28,0xff,0xff,0xff,0x3d]
732	btq	$61, -216(%rbp)
733
734
735// rdar://8061602
736L1:
737  jecxz L1
738// CHECK: jecxz L1
739// CHECK:   encoding: [0x67,0xe3,A]
740  jrcxz L1
741// CHECK: jrcxz L1
742// CHECK:   encoding: [0xe3,A]
743
744// PR8061
745xchgl   368(%rax),%ecx
746// CHECK: xchgl	%ecx, 368(%rax)
747xchgl   %ecx, 368(%rax)
748// CHECK: xchgl	%ecx, 368(%rax)
749
750// rdar://8407548
751xchg	0xdeadbeef(%rbx,%rcx,8),%bl
752// CHECK: xchgb	%bl, 3735928559(%rbx,%rcx,8)
753
754
755
756// PR7254
757lock  incl 1(%rsp)
758// CHECK: lock
759// CHECK: incl 1(%rsp)
760
761// rdar://8741045
762lock/incl 1(%rsp)
763// CHECK: lock
764// CHECK: incl 1(%rsp)
765
766// rdar://8033482
767rep movsl
768// CHECK: rep
769// CHECK: encoding: [0xf3]
770// CHECK: movsl
771// CHECK: encoding: [0xa5]
772
773
774// rdar://8403974
775iret
776// CHECK: iretl
777// CHECK: encoding: [0xcf]
778iretw
779// CHECK: iretw
780// CHECK: encoding: [0x66,0xcf]
781iretl
782// CHECK: iretl
783// CHECK: encoding: [0xcf]
784iretq
785// CHECK: iretq
786// CHECK: encoding: [0x48,0xcf]
787
788// rdar://8416805
789// CHECK: retw	$31438
790// CHECK:  encoding: [0x66,0xc2,0xce,0x7a]
791        	retw	$0x7ace
792
793// CHECK: lretw	$31438
794// CHECK:  encoding: [0x66,0xca,0xce,0x7a]
795        	lretw	$0x7ace
796
797// PR8592
798lretq  // CHECK: lretq # encoding: [0x48,0xcb]
799lretl  // CHECK: lretl # encoding: [0xcb]
800lret   // CHECK: lretl # encoding: [0xcb]
801
802// rdar://8403907
803sysret
804// CHECK: sysretl
805// CHECK: encoding: [0x0f,0x07]
806sysretl
807// CHECK: sysretl
808// CHECK: encoding: [0x0f,0x07]
809sysretq
810// CHECK: sysretq
811// CHECK: encoding: [0x48,0x0f,0x07]
812
813// rdar://8407242
814push %fs
815// CHECK: pushq	%fs
816// CHECK: encoding: [0x0f,0xa0]
817push %gs
818// CHECK: pushq	%gs
819// CHECK: encoding: [0x0f,0xa8]
820
821pushw %fs
822// CHECK: pushw	%fs
823// CHECK: encoding: [0x66,0x0f,0xa0]
824pushw %gs
825// CHECK: pushw	%gs
826// CHECK: encoding: [0x66,0x0f,0xa8]
827
828
829pop %fs
830// CHECK: popq	%fs
831// CHECK: encoding: [0x0f,0xa1]
832pop %gs
833// CHECK: popq	%gs
834// CHECK: encoding: [0x0f,0xa9]
835
836popw %fs
837// CHECK: popw	%fs
838// CHECK: encoding: [0x66,0x0f,0xa1]
839popw %gs
840// CHECK: popw	%gs
841// CHECK: encoding: [0x66,0x0f,0xa9]
842
843// rdar://8438816
844fildq -8(%rsp)
845fildll -8(%rsp)
846// CHECK: fildll	-8(%rsp)
847// CHECK: encoding: [0xdf,0x6c,0x24,0xf8]
848// CHECK: fildll	-8(%rsp)
849// CHECK: encoding: [0xdf,0x6c,0x24,0xf8]
850
851// CHECK: callq a
852        callq a
853
854// CHECK: leaq	-40(%rbp), %r15
855	leaq	-40(%rbp), %r15
856
857
858
859// rdar://8013734 - Alias dr6=db6
860mov %dr6, %rax
861mov %db6, %rax
862// CHECK: movq	%dr6, %rax
863// CHECK: movq	%dr6, %rax
864
865
866// INC/DEC encodings.
867incb %al  // CHECK:	incb	%al # encoding: [0xfe,0xc0]
868incw %ax  // CHECK:	incw	%ax # encoding: [0x66,0xff,0xc0]
869incl %eax // CHECK:	incl	%eax # encoding: [0xff,0xc0]
870decb %al  // CHECK:	decb	%al # encoding: [0xfe,0xc8]
871decw %ax  // CHECK:	decw	%ax # encoding: [0x66,0xff,0xc8]
872decl %eax // CHECK:	decl	%eax # encoding: [0xff,0xc8]
873
874// rdar://8416805
875// CHECK: lgdt	4(%rax)
876// CHECK:  encoding: [0x0f,0x01,0x50,0x04]
877        	lgdt	4(%rax)
878
879// CHECK: lgdt	4(%rax)
880// CHECK:  encoding: [0x0f,0x01,0x50,0x04]
881        	lgdtq	4(%rax)
882
883// CHECK: lidt	4(%rax)
884// CHECK:  encoding: [0x0f,0x01,0x58,0x04]
885        	lidt	4(%rax)
886
887// CHECK: lidt	4(%rax)
888// CHECK:  encoding: [0x0f,0x01,0x58,0x04]
889        	lidtq	4(%rax)
890
891// CHECK: sgdt	4(%rax)
892// CHECK:  encoding: [0x0f,0x01,0x40,0x04]
893        	sgdt	4(%rax)
894
895// CHECK: sgdt	4(%rax)
896// CHECK:  encoding: [0x0f,0x01,0x40,0x04]
897        	sgdtq	4(%rax)
898
899// CHECK: sidt	4(%rax)
900// CHECK:  encoding: [0x0f,0x01,0x48,0x04]
901        	sidt	4(%rax)
902
903// CHECK: sidt	4(%rax)
904// CHECK:  encoding: [0x0f,0x01,0x48,0x04]
905        	sidtq	4(%rax)
906
907
908// rdar://8208615
909mov (%rsi), %gs  // CHECK: movl	(%rsi), %gs # encoding: [0x8e,0x2e]
910mov %gs, (%rsi)  // CHECK: movl	%gs, (%rsi) # encoding: [0x8c,0x2e]
911
912
913// rdar://8431864
914	div	%bl,%al
915	div	%bx,%ax
916	div	%ecx,%eax
917	div	0xdeadbeef(%ebx,%ecx,8),%eax
918	div	0x45,%eax
919	div	0x7eed,%eax
920	div	0xbabecafe,%eax
921	div	0x12345678,%eax
922	idiv	%bl,%al
923	idiv	%bx,%ax
924	idiv	%ecx,%eax
925	idiv	0xdeadbeef(%ebx,%ecx,8),%eax
926	idiv	0x45,%eax
927	idiv	0x7eed,%eax
928	idiv	0xbabecafe,%eax
929	idiv	0x12345678,%eax
930
931// PR8524
932movd	%rax, %mm5 // CHECK: movd %rax, %mm5 # encoding: [0x48,0x0f,0x6e,0xe8]
933movd	%mm5, %rbx // CHECK: movd %mm5, %rbx # encoding: [0x48,0x0f,0x7e,0xeb]
934movq	%rax, %mm5 // CHECK: movd %rax, %mm5 # encoding: [0x48,0x0f,0x6e,0xe8]
935movq	%mm5, %rbx // CHECK: movd %mm5, %rbx # encoding: [0x48,0x0f,0x7e,0xeb]
936
937rex64 // CHECK: rex64 # encoding: [0x48]
938data16 // CHECK: data16 # encoding: [0x66]
939
940// PR8855
941movq 18446744073709551615,%rbx   // CHECK: movq	-1, %rbx
942
943// PR8946
944movdqu	%xmm0, %xmm1 // CHECK: movdqu	%xmm0, %xmm1 # encoding: [0xf3,0x0f,0x6f,0xc8]
945