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