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