2010-09-15 04:45:10 +00:00
|
|
|
// RUN: llvm-mc -triple x86_64-unknown-unknown -show-encoding %s > %t 2> %t.err
|
2010-08-24 19:13:38 +00:00
|
|
|
// RUN: FileCheck < %t %s
|
|
|
|
// RUN: FileCheck --check-prefix=CHECK-STDERR < %t.err %s
|
2009-07-31 03:11:49 +00:00
|
|
|
|
2009-08-14 03:48:55 +00:00
|
|
|
// CHECK: subb %al, %al
|
2009-07-31 20:53:16 +00:00
|
|
|
subb %al, %al
|
|
|
|
|
2009-08-14 03:48:55 +00:00
|
|
|
// CHECK: addl $24, %eax
|
2009-07-31 20:53:16 +00:00
|
|
|
addl $24, %eax
|
|
|
|
|
2009-08-14 03:48:55 +00:00
|
|
|
// CHECK: movl %eax, 10(%ebp)
|
2009-07-31 20:53:16 +00:00
|
|
|
movl %eax, 10(%ebp)
|
2009-08-14 03:48:55 +00:00
|
|
|
// CHECK: movl %eax, 10(%ebp,%ebx)
|
2009-07-31 20:53:16 +00:00
|
|
|
movl %eax, 10(%ebp, %ebx)
|
2009-08-14 03:48:55 +00:00
|
|
|
// CHECK: movl %eax, 10(%ebp,%ebx,4)
|
2009-07-31 20:53:16 +00:00
|
|
|
movl %eax, 10(%ebp, %ebx, 4)
|
2009-08-14 03:48:55 +00:00
|
|
|
// CHECK: movl %eax, 10(,%ebx,4)
|
2009-07-31 20:53:16 +00:00
|
|
|
movl %eax, 10(, %ebx, 4)
|
2010-01-30 01:02:48 +00:00
|
|
|
|
|
|
|
// CHECK: movl 0, %eax
|
|
|
|
movl 0, %eax
|
|
|
|
// CHECK: movl $0, %eax
|
|
|
|
movl $0, %eax
|
|
|
|
|
2010-01-22 20:16:37 +00:00
|
|
|
// CHECK: ret
|
|
|
|
ret
|
|
|
|
|
2009-08-09 07:20:21 +00:00
|
|
|
// FIXME: Check that this matches SUB32ri8
|
2009-08-14 03:48:55 +00:00
|
|
|
// CHECK: subl $1, %eax
|
2009-08-09 07:20:21 +00:00
|
|
|
subl $1, %eax
|
|
|
|
|
|
|
|
// FIXME: Check that this matches SUB32ri8
|
2009-08-14 03:48:55 +00:00
|
|
|
// CHECK: subl $-1, %eax
|
2009-08-09 07:20:21 +00:00
|
|
|
subl $-1, %eax
|
|
|
|
|
|
|
|
// FIXME: Check that this matches SUB32ri
|
2009-08-14 03:48:55 +00:00
|
|
|
// CHECK: subl $256, %eax
|
2009-08-09 07:20:21 +00:00
|
|
|
subl $256, %eax
|
|
|
|
|
2009-08-10 21:06:41 +00:00
|
|
|
// FIXME: Check that this matches XOR64ri8
|
2009-08-14 03:48:55 +00:00
|
|
|
// CHECK: xorq $1, %rax
|
2009-08-11 02:59:53 +00:00
|
|
|
xorq $1, %rax
|
2009-08-09 07:20:21 +00:00
|
|
|
|
2009-08-10 21:06:41 +00:00
|
|
|
// FIXME: Check that this matches XOR64ri32
|
2009-08-14 03:48:55 +00:00
|
|
|
// CHECK: xorq $256, %rax
|
2009-08-11 02:59:53 +00:00
|
|
|
xorq $256, %rax
|
|
|
|
|
|
|
|
// FIXME: Check that this matches SUB8rr
|
2009-08-14 03:48:55 +00:00
|
|
|
// CHECK: subb %al, %bl
|
2009-08-11 02:59:53 +00:00
|
|
|
subb %al, %bl
|
|
|
|
|
|
|
|
// FIXME: Check that this matches SUB16rr
|
2009-08-14 03:48:55 +00:00
|
|
|
// CHECK: subw %ax, %bx
|
2009-08-11 02:59:53 +00:00
|
|
|
subw %ax, %bx
|
|
|
|
|
|
|
|
// FIXME: Check that this matches SUB32rr
|
2009-08-14 03:48:55 +00:00
|
|
|
// CHECK: subl %eax, %ebx
|
2009-08-11 02:59:53 +00:00
|
|
|
subl %eax, %ebx
|
|
|
|
|
2009-08-11 05:00:25 +00:00
|
|
|
// FIXME: Check that this matches the correct instruction.
|
2010-07-19 07:21:07 +00:00
|
|
|
// CHECK: callq *%rax
|
2009-08-11 05:00:25 +00:00
|
|
|
call *%rax
|
2009-08-11 23:23:44 +00:00
|
|
|
|
|
|
|
// FIXME: Check that this matches the correct instruction.
|
2009-08-14 03:48:55 +00:00
|
|
|
// CHECK: shldl %cl, %eax, %ebx
|
2009-08-11 23:23:44 +00:00
|
|
|
shldl %cl, %eax, %ebx
|
2010-02-02 23:46:47 +00:00
|
|
|
|
|
|
|
// CHECK: shll $2, %eax
|
|
|
|
shll $2, %eax
|
|
|
|
|
|
|
|
// CHECK: shll $2, %eax
|
|
|
|
sall $2, %eax
|
2010-02-03 21:04:42 +00:00
|
|
|
|
|
|
|
// CHECK: rep
|
|
|
|
// CHECK: insb
|
|
|
|
rep;insb
|
|
|
|
|
|
|
|
// CHECK: rep
|
|
|
|
// CHECK: outsb
|
|
|
|
rep;outsb
|
|
|
|
|
|
|
|
// CHECK: rep
|
|
|
|
// CHECK: movsb
|
|
|
|
rep;movsb
|
|
|
|
|
2010-09-27 07:11:53 +00:00
|
|
|
|
|
|
|
// rdar://8470918
|
|
|
|
smovb // CHECK: movsb
|
|
|
|
smovw // CHECK: movsw
|
|
|
|
smovl // CHECK: movsl
|
|
|
|
smovq // CHECK: movsq
|
|
|
|
|
2010-09-22 03:50:32 +00:00
|
|
|
// rdar://8456361
|
|
|
|
// CHECK: rep
|
|
|
|
// CHECK: movsl
|
|
|
|
rep movsd
|
|
|
|
|
2010-02-03 21:04:42 +00:00
|
|
|
// CHECK: rep
|
|
|
|
// CHECK: lodsb
|
|
|
|
rep;lodsb
|
|
|
|
|
|
|
|
// CHECK: rep
|
|
|
|
// CHECK: stosb
|
|
|
|
rep;stosb
|
|
|
|
|
|
|
|
// NOTE: repz and repe have the same opcode as rep
|
|
|
|
// CHECK: rep
|
|
|
|
// CHECK: cmpsb
|
|
|
|
repz;cmpsb
|
|
|
|
|
|
|
|
// NOTE: repnz has the same opcode as repne
|
|
|
|
// CHECK: repne
|
|
|
|
// CHECK: cmpsb
|
|
|
|
repnz;cmpsb
|
|
|
|
|
|
|
|
// NOTE: repe and repz have the same opcode as rep
|
|
|
|
// CHECK: rep
|
|
|
|
// CHECK: scasb
|
|
|
|
repe;scasb
|
|
|
|
|
|
|
|
// CHECK: repne
|
|
|
|
// CHECK: scasb
|
|
|
|
repne;scasb
|
|
|
|
|
|
|
|
// CHECK: lock
|
2010-02-13 00:17:21 +00:00
|
|
|
// CHECK: cmpxchgb %al, (%ebx)
|
2010-02-03 21:04:42 +00:00
|
|
|
lock;cmpxchgb %al, 0(%ebx)
|
|
|
|
|
|
|
|
// CHECK: cs
|
2010-02-13 00:17:21 +00:00
|
|
|
// CHECK: movb (%eax), %al
|
2010-02-03 21:04:42 +00:00
|
|
|
cs;movb 0(%eax), %al
|
|
|
|
|
|
|
|
// CHECK: ss
|
2010-02-13 00:17:21 +00:00
|
|
|
// CHECK: movb (%eax), %al
|
2010-02-03 21:04:42 +00:00
|
|
|
ss;movb 0(%eax), %al
|
|
|
|
|
|
|
|
// CHECK: ds
|
2010-02-13 00:17:21 +00:00
|
|
|
// CHECK: movb (%eax), %al
|
2010-02-03 21:04:42 +00:00
|
|
|
ds;movb 0(%eax), %al
|
|
|
|
|
|
|
|
// CHECK: es
|
2010-02-13 00:17:21 +00:00
|
|
|
// CHECK: movb (%eax), %al
|
2010-02-03 21:04:42 +00:00
|
|
|
es;movb 0(%eax), %al
|
|
|
|
|
|
|
|
// CHECK: fs
|
2010-02-13 00:17:21 +00:00
|
|
|
// CHECK: movb (%eax), %al
|
2010-02-03 21:04:42 +00:00
|
|
|
fs;movb 0(%eax), %al
|
|
|
|
|
|
|
|
// CHECK: gs
|
2010-02-13 00:17:21 +00:00
|
|
|
// CHECK: movb (%eax), %al
|
2010-02-03 21:04:42 +00:00
|
|
|
gs;movb 0(%eax), %al
|
|
|
|
|
2010-02-09 00:49:22 +00:00
|
|
|
// CHECK: fadd %st(0)
|
|
|
|
// CHECK: fadd %st(1)
|
|
|
|
// CHECK: fadd %st(7)
|
|
|
|
|
|
|
|
fadd %st(0)
|
|
|
|
fadd %st(1)
|
|
|
|
fadd %st(7)
|
2010-05-06 22:39:14 +00:00
|
|
|
|
|
|
|
// CHECK: leal 0, %eax
|
|
|
|
leal 0, %eax
|
2010-05-19 23:34:33 +00:00
|
|
|
|
|
|
|
// rdar://7986634 - Insensitivity on opcodes.
|
|
|
|
// CHECK: int3
|
|
|
|
INT3
|
|
|
|
|
2010-08-24 19:13:38 +00:00
|
|
|
|
|
|
|
// Allow scale factor without index register.
|
|
|
|
// CHECK: movaps %xmm3, (%esi)
|
|
|
|
// CHECK-STDERR: warning: scale factor without index register is ignored
|
|
|
|
movaps %xmm3, (%esi, 2)
|
2010-08-24 19:24:18 +00:00
|
|
|
|
|
|
|
// CHECK: imull $12, %eax, %eax
|
|
|
|
imul $12, %eax
|
2010-08-24 19:37:56 +00:00
|
|
|
|
|
|
|
// CHECK: imull %ecx, %eax
|
|
|
|
imull %ecx, %eax
|
2010-09-06 23:29:05 +00:00
|
|
|
|
|
|
|
|
|
|
|
// rdar://8208481
|
|
|
|
// CHECK: outb %al, $161
|
|
|
|
outb %al, $161
|
|
|
|
// CHECK: outw %ax, $128
|
|
|
|
outw %ax, $128
|
|
|
|
// CHECK: inb $161, %al
|
|
|
|
inb $161, %al
|
2010-09-06 23:40:56 +00:00
|
|
|
|
|
|
|
// rdar://8017621
|
|
|
|
// CHECK: pushq $1
|
|
|
|
push $1
|
|
|
|
|
2010-09-06 23:51:44 +00:00
|
|
|
// rdar://8017530
|
|
|
|
// CHECK: sldtw 4
|
|
|
|
sldt 4
|
2010-09-07 00:05:45 +00:00
|
|
|
|
|
|
|
// rdar://8208499
|
|
|
|
// CHECK: cmovnew %bx, %ax
|
|
|
|
cmovnz %bx, %ax
|
|
|
|
// CHECK: cmovneq %rbx, %rax
|
|
|
|
cmovnzq %rbx, %rax
|
|
|
|
|
2010-09-11 16:32:12 +00:00
|
|
|
|
|
|
|
// rdar://8407928
|
|
|
|
// CHECK: inb $127, %al
|
|
|
|
// CHECK: inw %dx, %ax
|
|
|
|
// CHECK: outb %al, $127
|
|
|
|
// CHECK: outw %ax, %dx
|
|
|
|
// CHECK: inl %dx, %eax
|
|
|
|
inb $0x7f
|
|
|
|
inw %dx
|
|
|
|
outb $0x7f
|
|
|
|
outw %dx
|
|
|
|
inl %dx
|
2010-09-14 23:34:29 +00:00
|
|
|
|
|
|
|
|
|
|
|
// PR8114
|
|
|
|
// CHECK: outb %al, %dx
|
|
|
|
// CHECK: outw %ax, %dx
|
|
|
|
// CHECK: outl %eax, %dx
|
|
|
|
|
|
|
|
out %al, (%dx)
|
|
|
|
out %ax, (%dx)
|
|
|
|
outl %eax, (%dx)
|
2010-09-15 04:04:33 +00:00
|
|
|
|
|
|
|
|
|
|
|
// rdar://8431422
|
|
|
|
|
|
|
|
// CHECK: fxch %st(1)
|
|
|
|
// CHECK: fucom %st(1)
|
|
|
|
// CHECK: fucomp %st(1)
|
|
|
|
// CHECK: faddp %st(1)
|
|
|
|
// CHECK: faddp %st(0)
|
|
|
|
// CHECK: fsubp %st(1)
|
|
|
|
// CHECK: fsubrp %st(1)
|
|
|
|
// CHECK: fmulp %st(1)
|
|
|
|
// CHECK: fdivp %st(1)
|
|
|
|
// CHECK: fdivrp %st(1)
|
|
|
|
|
|
|
|
fxch
|
|
|
|
fucom
|
|
|
|
fucomp
|
|
|
|
faddp
|
|
|
|
faddp %st
|
|
|
|
fsubp
|
|
|
|
fsubrp
|
|
|
|
fmulp
|
|
|
|
fdivp
|
|
|
|
fdivrp
|
2010-09-15 04:08:38 +00:00
|
|
|
|
|
|
|
// CHECK: fcomi %st(1), %st(0)
|
|
|
|
// CHECK: fcomi %st(2), %st(0)
|
|
|
|
// CHECK: fucomi %st(1), %st(0)
|
|
|
|
// CHECK: fucomi %st(2), %st(0)
|
|
|
|
// CHECK: fucomi %st(2), %st(0)
|
|
|
|
|
|
|
|
fcomi
|
|
|
|
fcomi %st(2)
|
|
|
|
fucomi
|
|
|
|
fucomi %st(2)
|
|
|
|
fucomi %st(2), %st
|
|
|
|
|
2010-09-15 04:15:16 +00:00
|
|
|
// CHECK: fnstsw %ax
|
|
|
|
// CHECK: fnstsw %ax
|
|
|
|
// CHECK: fnstsw %ax
|
|
|
|
// CHECK: fnstsw %ax
|
|
|
|
|
|
|
|
fnstsw
|
|
|
|
fnstsw %ax
|
|
|
|
fnstsw %eax
|
|
|
|
fnstsw %al
|
2010-09-15 04:33:27 +00:00
|
|
|
|
|
|
|
// rdar://8431880
|
|
|
|
// CHECK: rclb $1, %bl
|
|
|
|
// CHECK: rcll $1, 3735928559(%ebx,%ecx,8)
|
|
|
|
// CHECK: rcrl $1, %ecx
|
|
|
|
// CHECK: rcrl $1, 305419896
|
|
|
|
|
|
|
|
rcl %bl
|
|
|
|
rcll 0xdeadbeef(%ebx,%ecx,8)
|
|
|
|
rcr %ecx
|
|
|
|
rcrl 0x12345678
|
2010-09-15 04:37:18 +00:00
|
|
|
|
|
|
|
// rdar://8418316
|
|
|
|
// CHECK: shldw $1, %bx, %bx
|
|
|
|
// CHECK: shldw $1, %bx, %bx
|
|
|
|
// CHECK: shrdw $1, %bx, %bx
|
|
|
|
// CHECK: shrdw $1, %bx, %bx
|
|
|
|
|
|
|
|
shld %bx,%bx
|
|
|
|
shld $1, %bx,%bx
|
|
|
|
shrd %bx,%bx
|
|
|
|
shrd $1, %bx,%bx
|
2010-09-15 04:45:10 +00:00
|
|
|
|
|
|
|
// CHECK: sldtl %ecx
|
|
|
|
// CHECK: encoding: [0x0f,0x00,0xc1]
|
|
|
|
// CHECK: sldtw %cx
|
|
|
|
// CHECK: encoding: [0x66,0x0f,0x00,0xc1]
|
|
|
|
|
|
|
|
sldt %ecx
|
|
|
|
sldt %cx
|
|
|
|
|
2010-09-15 05:14:54 +00:00
|
|
|
// CHECK: lcalll *3135175374
|
|
|
|
// CHECK: ljmpl *3135175374
|
|
|
|
lcall *0xbadeface
|
|
|
|
ljmp *0xbadeface
|
|
|
|
|
2010-09-17 18:02:29 +00:00
|
|
|
|
|
|
|
// rdar://8444631
|
|
|
|
// CHECK: enter $31438, $0
|
|
|
|
// CHECK: encoding: [0xc8,0xce,0x7a,0x00]
|
|
|
|
// CHECK: enter $31438, $1
|
|
|
|
// CHECK: encoding: [0xc8,0xce,0x7a,0x01]
|
|
|
|
// CHECK: enter $31438, $127
|
|
|
|
// CHECK: encoding: [0xc8,0xce,0x7a,0x7f]
|
|
|
|
enter $0x7ace,$0
|
|
|
|
enter $0x7ace,$1
|
|
|
|
enter $0x7ace,$0x7f
|
|
|
|
|
2010-09-22 04:04:03 +00:00
|
|
|
|
|
|
|
// rdar://8456389
|
|
|
|
// CHECK: fstps (%eax)
|
|
|
|
// CHECK: encoding: [0xd9,0x18]
|
|
|
|
fstp (%eax)
|
|
|
|
|
2010-09-22 04:11:10 +00:00
|
|
|
// rdar://8456364
|
|
|
|
// CHECK: movw %cs, %ax
|
|
|
|
mov %CS, %ax
|
2010-09-22 04:56:20 +00:00
|
|
|
|
|
|
|
// rdar://8456391
|
|
|
|
fcmovb %st(1), %st(0) // CHECK: fcmovb %st(1), %st(0)
|
|
|
|
fcmove %st(1), %st(0) // CHECK: fcmove %st(1), %st(0)
|
|
|
|
fcmovbe %st(1), %st(0) // CHECK: fcmovbe %st(1), %st(0)
|
|
|
|
fcmovu %st(1), %st(0) // CHECK: fcmovu %st(1), %st(0)
|
|
|
|
|
|
|
|
fcmovnb %st(1), %st(0) // CHECK: fcmovnb %st(1), %st(0)
|
|
|
|
fcmovne %st(1), %st(0) // CHECK: fcmovne %st(1), %st(0)
|
|
|
|
fcmovnbe %st(1), %st(0) // CHECK: fcmovnbe %st(1), %st(0)
|
|
|
|
fcmovnu %st(1), %st(0) // CHECK: fcmovnu %st(1), %st(0)
|
|
|
|
|
|
|
|
fcmovnae %st(1), %st(0) // CHECK: fcmovb %st(1), %st(0)
|
|
|
|
fcmovna %st(1), %st(0) // CHECK: fcmovbe %st(1), %st(0)
|
|
|
|
|
|
|
|
fcmovae %st(1), %st(0) // CHECK: fcmovnb %st(1), %st(0)
|
|
|
|
fcmova %st(1), %st(0) // CHECK: fcmovnbe %st(1), %st(0)
|
2010-09-22 05:05:16 +00:00
|
|
|
|
|
|
|
// rdar://8456417
|
|
|
|
.byte 88 + 1 & 15 // CHECK: .byte 9
|
|
|
|
|
2010-09-22 05:29:50 +00:00
|
|
|
// rdar://8456412
|
|
|
|
mov %rdx, %cr0
|
|
|
|
// CHECK: movq %rdx, %cr0
|
|
|
|
// CHECK: encoding: [0x0f,0x22,0xc2]
|
|
|
|
mov %rdx, %cr4
|
|
|
|
// CHECK: movq %rdx, %cr4
|
|
|
|
// CHECK: encoding: [0x0f,0x22,0xe2]
|
|
|
|
mov %rdx, %cr8
|
|
|
|
// CHECK: movq %rdx, %cr8
|
|
|
|
// CHECK: encoding: [0x44,0x0f,0x22,0xc2]
|
|
|
|
mov %rdx, %cr15
|
|
|
|
// CHECK: movq %rdx, %cr15
|
|
|
|
// CHECK: encoding: [0x44,0x0f,0x22,0xfa]
|
2010-09-22 06:26:39 +00:00
|
|
|
|
|
|
|
// rdar://8456371 - Handle commutable instructions written backward.
|
|
|
|
// CHECK: faddp %st(1)
|
|
|
|
// CHECK: fmulp %st(2)
|
|
|
|
faddp %st, %st(1)
|
|
|
|
fmulp %st, %st(2)
|
|
|
|
|
2010-09-27 07:08:21 +00:00
|
|
|
// rdar://8468087 - Encode these accurately, they are not synonyms.
|
|
|
|
// CHECK: fmul %st(0), %st(1)
|
|
|
|
// CHECK: encoding: [0xdc,0xc9]
|
|
|
|
// CHECK: fmul %st(1)
|
|
|
|
// CHECK: encoding: [0xd8,0xc9]
|
|
|
|
fmul %st, %st(1)
|
|
|
|
fmul %st(1), %st
|
|
|
|
|
|
|
|
// CHECK: fadd %st(0), %st(1)
|
|
|
|
// CHECK: encoding: [0xdc,0xc1]
|
|
|
|
// CHECK: fadd %st(1)
|
|
|
|
// CHECK: encoding: [0xd8,0xc1]
|
|
|
|
fadd %st, %st(1)
|
|
|
|
fadd %st(1), %st
|
|
|
|
|
|
|
|
|
2010-09-27 04:23:03 +00:00
|
|
|
// rdar://8416805
|
|
|
|
// CHECK: xorb %al, %al
|
|
|
|
// CHECK: encoding: [0x30,0xc0]
|
|
|
|
// CHECK: xorw %di, %di
|
|
|
|
// CHECK: encoding: [0x66,0x31,0xff]
|
|
|
|
// CHECK: xorl %esi, %esi
|
|
|
|
// CHECK: encoding: [0x31,0xf6]
|
|
|
|
// CHECK: xorq %rsi, %rsi
|
|
|
|
// CHECK: encoding: [0x48,0x31,0xf6]
|
|
|
|
clrb %al
|
|
|
|
clr %di
|
|
|
|
clr %esi
|
|
|
|
clr %rsi
|
|
|
|
|
2010-09-27 07:21:41 +00:00
|
|
|
// rdar://8456378
|
|
|
|
cltq // CHECK: cltq
|
|
|
|
cdqe // CHECK: cltq
|
|
|
|
cwde // CHECK: cwtl
|
|
|
|
cwtl // CHECK: cwtl
|
2010-09-22 06:26:39 +00:00
|
|
|
|
2010-09-27 07:24:57 +00:00
|
|
|
// rdar://8416805
|
|
|
|
cbw // CHECK: cbtw
|
|
|
|
cwd // CHECK: cwtd
|
|
|
|
cdq // CHECK: cltd
|
2010-09-29 01:50:45 +00:00
|
|
|
|
|
|
|
// rdar://8456378 and PR7557 - fstsw
|
|
|
|
fstsw %ax
|
|
|
|
// CHECK: wait
|
|
|
|
// CHECK: fnstsw %ax
|
|
|
|
fstsw (%rax)
|
|
|
|
// CHECK: wait
|
|
|
|
// CHECK: fnstsw (%rax)
|
2010-09-29 02:24:57 +00:00
|
|
|
|
|
|
|
|
|
|
|
// rdar://8456382 - cvtsd2si support.
|
|
|
|
cvtsd2si %xmm1, %rax
|
|
|
|
// CHECK: cvtsd2si %xmm1, %rax
|
|
|
|
// CHECK: encoding: [0xf2,0x48,0x0f,0x2d,0xc1]
|
|
|
|
cvtsd2si %xmm1, %eax
|
|
|
|
// CHECK: cvtsd2si %xmm1, %eax
|
|
|
|
// CHECK: encoding: [0xf2,0x0f,0x2d,0xc1]
|
|
|
|
|