1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 19:23:23 +01:00
llvm-mirror/test/MC/Disassembler/X86/x86-64.txt
Vedant Kumar 89ece8e139 [llvm-mc] Ignore opcode size prefix in 64-bit CALL disassembly
This is a fix for disassembling unusual instruction sequences in 64-bit
mode w.r.t the CALL rel16 instruction. It might be desirable to move the
check somewhere else, but it essentially mimics the special case
handling with JCXZ in 16-bit mode.

The current behavior accepts the opcode size prefix and causes the
call's immediate to stop disassembling after 2 bytes. When debugging
sequences of instructions with this pattern, the disassembler output
becomes extremely unreliable and essentially useless (if you jump midway
into what lldb thinks is a unified instruction, you'll lose %rip). So we
ignore the prefix and consume all 4 bytes when disassembling a 64-bit
mode binary.

Note: in Vol. 2A 3-99 the Intel spec states that CALL rel16 is N.S. N.S.
is defined as:

    Indicates an instruction syntax that requires an address override
    prefix in 64-bit mode and is not supported. Using an address
    override prefix in 64-bit mode may result in model-specific
    execution behavior. (Vol. 2A 3-7)

Since 0x66 is an operand override prefix we should be OK (although we
may want to warn about 0x67 prefixes to 0xe8). On the CPUs I tested
with, they all ignore the 0x66 prefix in 64-bit mode.

Patch by Matthew Barney!

Differential Revision: http://reviews.llvm.org/D9573

llvm-svn: 246038
2015-08-26 16:20:29 +00:00

459 lines
9.1 KiB
Plaintext

# RUN: llvm-mc --disassemble %s -triple=x86_64 | FileCheck %s
# Coverage
# CHECK: vcmptrue_usps
0xc5 0x04 0xc2 0xc7 0x1f
# CHECK: vcmptrue_uspd
0xc5 0x05 0xc2 0xc7 0x1f
# CHECK: vcmptrue_usss
0xc5 0x06 0xc2 0xc7 0x1f
# CHECK: vcmptrue_ussd
0xc5 0x07 0xc2 0xc7 0x1f
# CHECK: vcmpeq_uqps
0xc5 0x04 0xc2 0xc7 0x08
# CHECK: vcmpeq_uqpd
0xc5 0x05 0xc2 0xc7 0x08
# CHECK: vcmpeq_uqss
0xc5 0x06 0xc2 0xc7 0x08
# CHECK: vcmpeq_uqsd
0xc5 0x07 0xc2 0xc7 0x08
# CHECK: vcmpeqps
0xc5 0x04 0xc2 0xc7 0x00
# CHECK: vcmpeqpd
0xc5 0x05 0xc2 0xc7 0x00
# CHECK: vcmpeqss
0xc5 0x06 0xc2 0xc7 0x00
# CHECK: vcmpeqsd
0xc5 0x07 0xc2 0xc7 0x00
# CHECK: cmpeqps
0x0f 0xc2 0xc7 0x00
# CHECK: cmpeqpd
0x66 0x0f 0xc2 0xc7 0x00
# CHECK: cmpeqss
0xf3 0x0f 0xc2 0xc7 0x00
# CHECK: cmpeqsd
0xf2 0x0f 0xc2 0xc7 0x00
# CHECK: cmpordps
0x0f 0xc2 0xc7 0x07
# CHECK: cmpordpd
0x66 0x0f 0xc2 0xc7 0x07
# CHECK: cmpordss
0xf3 0x0f 0xc2 0xc7 0x07
# CHECK: cmpordsd
0xf2 0x0f 0xc2 0xc7 0x07
# CHECK: extrq $2, $3, %xmm0
0x66 0x0f 0x78 0xc0 0x03 0x02
# CHECK: extrq %xmm1, %xmm0
0x66 0x0f 0x79 0xc1
# CHECK: insertq $6, $5, %xmm1, %xmm0
0xf2 0x0f 0x78 0xc1 0x05 0x06
# CHECK: insertq %xmm1, %xmm0
0xf2 0x0f 0x79 0xc1
# CHECK: movntsd %xmm0, (%rdi)
0xf2 0x0f 0x2b 0x07
# CHECK: movntss %xmm0, (%rdi)
0xf3 0x0f 0x2b 0x07
# CHECK: adcxl %eax, %eax
0x66 0x0f 0x38 0xf6 0xc0
# CHECK: adcxl (%rax), %eax
0x66 0x0f 0x38 0xf6 0x00
# CHECK: adcxq %rax, %rax
0x66 0x48 0x0f 0x38 0xf6 0xc0
# CHECK: adcxq (%rax), %rax
0x66 0x48 0x0f 0x38 0xf6 0x00
# CHECK: adoxl %eax, %eax
0xf3 0x0f 0x38 0xf6 0xc0
# CHECK: adoxl (%rax), %eax
0xf3 0x0f 0x38 0xf6 0x00
# CHECK: adoxq %rax, %rax
0xf3 0x48 0x0f 0x38 0xf6 0xc0
# CHECK: adoxq (%rax), %rax
0xf3 0x48 0x0f 0x38 0xf6 0x00
# CHECK: xbegin 53
0xc7 0xf8 0x35 0x00 0x00 0x00
# CHECK: xbegin 53
0x66 0xc7 0xf8 0x35 0x00
# CHECK: xend
0x0f 0x01 0xd5
# CHECK: xabort $13
0xc6 0xf8 0x0d
# CHECK: xsave64 (%rax)
0x48 0x0f 0xae 0x20
# CHECK: xrstor64 (%rax)
0x48 0x0f 0xae 0x28
# CHECK: xsaveopt64 (%rax)
0x48 0x0f 0xae 0x30
# CHECK: clac
0x0f 0x01 0xca
# CHECK: stac
0x0f 0x01 0xcb
# CHECK: movabsb -6066930261531658096, %al
0xa0 0x90 0x78 0x56 0x34 0x12 0xef 0xcd 0xab
# CHECK: movabsb -6066930261531658096, %al
0x48 0xa0 0x90 0x78 0x56 0x34 0x12 0xef 0xcd 0xab
# CHECK: movabsw -6066930261531658096, %ax
0x66 0xa1 0x90 0x78 0x56 0x34 0x12 0xef 0xcd 0xab
# CHECK: movabsl -6066930261531658096, %eax
0xa1 0x90 0x78 0x56 0x34 0x12 0xef 0xcd 0xab
# CHECK: movabsq -6066930261531658096, %rax
0x48 0xa1 0x90 0x78 0x56 0x34 0x12 0xef 0xcd 0xab
# CHECK: movabsb %al, -6066930261531658096
0xa2 0x90 0x78 0x56 0x34 0x12 0xef 0xcd 0xab
# CHECK: movabsb %al, -6066930261531658096
0x48 0xa2 0x90 0x78 0x56 0x34 0x12 0xef 0xcd 0xab
# CHECK: movabsw %ax, -6066930261531658096
0x66 0xa3 0x90 0x78 0x56 0x34 0x12 0xef 0xcd 0xab
# CHECK: movabsl %eax, -6066930261531658096
0xa3 0x90 0x78 0x56 0x34 0x12 0xef 0xcd 0xab
# CHECK: movabsq %rax, -6066930261531658096
0x48 0xa3 0x90 0x78 0x56 0x34 0x12 0xef 0xcd 0xab
# CHECK: sha1rnds4 $1, %xmm1, %xmm2
0x0f 0x3a 0xcc 0xd1 0x01
# CHECK: sha1rnds4 $1, (%rax), %xmm2
0x0f 0x3a 0xcc 0x10 0x01
# CHECK: sha1nexte %xmm1, %xmm2
0x0f 0x38 0xc8 0xd1
# CHECK: sha1nexte (%rax), %xmm2
0x0f 0x38 0xc8 0x10
# CHECK: sha1msg1 %xmm1, %xmm2
0x0f 0x38 0xc9 0xd1
# CHECK: sha1msg1 (%rax), %xmm2
0x0f 0x38 0xc9 0x10
# CHECK: sha1msg2 %xmm1, %xmm2
0x0f 0x38 0xca 0xd1
# CHECK: sha1msg2 (%rax), %xmm2
0x0f 0x38 0xca 0x10
# CHECK: sha256rnds2 (%rax), %xmm2
0x0f 0x38 0xcb 0x10
# CHECK: sha256rnds2 %xmm1, %xmm2
0x0f 0x38 0xcb 0xd1
# CHECK: sha256msg1 %xmm1, %xmm2
0x0f 0x38 0xcc 0xd1
# CHECK: sha256msg1 (%rax), %xmm2
0x0f 0x38 0xcc 0x10
# CHECK: sha256msg2 %xmm1, %xmm2
0x0f 0x38 0xcd 0xd1
# CHECK: sha256msg2 (%rax), %xmm2
0x0f 0x38 0xcd 0x10
# CHECK: incl %ecx
0xff 0xc1
# CHECK: decl %ecx
0xff 0xc9
# CHECK: incw %cx
0x66 0xff 0xc1
# CHECK: decw %cx
0x66 0xff 0xc9
# CHECK: incb %cl
0xfe 0xc1
# CHECK: decb %cl
0xfe 0xc9
# CHECK: incq %rcx
0x48 0xff 0xc1
# CHECK: decq %rcx
0x48 0xff 0xc9
# CHECK: movq %xmm0, %xmm0
0xf3 0x0f 0x7e 0xc0
# CHECK: vmovq %xmm0, %xmm0
0xc5 0xfa 0x7e 0xc0
# CHECK: vmovq %xmm0, %rax
0xc4 0xe1 0xf9 0x7e 0xc0
# CHECK: movd (%rax), %mm0
0x48 0x0f 0x6e 0x00
# CHECK: movd %rax, %mm0
0x48 0x0f 0x6e 0xc0
# CHECK: movd %mm0, (%rax)
0x48 0x0f 0x7e 0x00
# CHECK: movd %mm0, %rax
0x48 0x0f 0x7e 0xc0
# CHECK: movd (%rax), %xmm0
0x66 0x48 0x0f 0x6e 0x00
# CHECK: movd %rax, %xmm0
0x66 0x48 0x0f 0x6e 0xc0
# CHECK: movd %xmm0, (%rax)
0x66 0x48 0x0f 0x7e 0x00
# CHECK: movd %xmm0, %rax
0x66 0x48 0x0f 0x7e 0xc0
# CHECK: pextrw $3, %xmm3, %ecx
0x66 0x0f 0x3a 0x15 0xd9 0x03
# CHECK: pextrw $3, %xmm3, (%rax)
0x66 0x0f 0x3a 0x15 0x18 0x03
# CHECK: $0, 305419896(,%r8)
0x43 0x80 0x04 0x05 0x78 0x56 0x34 0x12 0x00
# CHECK: $0, 305419896(%r13,%r8)
0x43 0x80 0x84 0x05 0x78 0x56 0x34 0x12 0x00
# CHECK: $0, 305419896(,%r8)
0x42 0x80 0x04 0x05 0x78 0x56 0x34 0x12 0x00
# CHECK: $0, 305419896(%rbp,%r8)
0x42 0x80 0x84 0x05 0x78 0x56 0x34 0x12 0x00
# CHECK: $0, 305419896(,%r12)
0x42 0x80 0x04 0x25 0x78 0x56 0x34 0x12 0x00
# CHECK: $0, 305419896(%rbp,%r12)
0x42 0x80 0x84 0x25 0x78 0x56 0x34 0x12 0x00
# CHECK: $0, 305419896
0x80 0x04 0x25 0x78 0x56 0x34 0x12 0x00
# CHECK: $0, 305419896(%rbp)
0x80 0x84 0x25 0x78 0x56 0x34 0x12 0x00
# CHECK: movabsq 6510615555426900570, %rax
0x48 0xa1 0x5a 0x5a 0x5a 0x5a 0x5a 0x5a 0x5a 0x5a
# CHECK: movq 1515870810, %rax
0x67, 0x48 0xa1 0x5a 0x5a 0x5a 0x5a
# CHECK: movabsq %rax, 6510615555426900570
0x48 0xa3 0x5a 0x5a 0x5a 0x5a 0x5a 0x5a 0x5a 0x5a
# CHECK: movq %rax, 1515870810
0x67, 0x48 0xa3 0x5a 0x5a 0x5a 0x5a
# CHECK: callq -32769
0x66 0xe8 0xff 0x7f 0xff 0xff
# CHECK: callq -32769
0x66 0x66 0x48 0xe8 0xff 0x7f 0xff 0xff
# CHECK: jmp -32769
0xe9 0xff 0x7f 0xff 0xff
# CHECK: jmp -32769
0x66 0xe9 0xff 0x7f 0xff 0xff
# CHECK: jmp -32769
0x66 0x66 0x48 0xe9 0xff 0x7f 0xff 0xff
# CHECK: jb -32769
0x0f 0x82 0xff 0x7f 0xff 0xff
# CHECK: jb -32769
0x66 0x0f 0x82 0xff 0x7f 0xff 0xff
# CHECK: jae -32769
0x0f 0x83 0xff 0x7f 0xff 0xff
# CHECK: jae -32769
0x66 0x0f 0x83 0xff 0x7f 0xff 0xff
# CHECK: je -32769
0x0f 0x84 0xff 0x7f 0xff 0xff
# CHECK: je -32769
0x66 0x0f 0x84 0xff 0x7f 0xff 0xff
# CHECK: jne -32769
0x0f 0x85 0xff 0x7f 0xff 0xff
# CHECK: jne -32769
0x66 0x0f 0x85 0xff 0x7f 0xff 0xff
# CHECK: jbe -32769
0x0f 0x86 0xff 0x7f 0xff 0xff
# CHECK: jbe -32769
0x66 0x0f 0x86 0xff 0x7f 0xff 0xff
# CHECK: ja -32769
0x0f 0x87 0xff 0x7f 0xff 0xff
# CHECK: ja -32769
0x66 0x0f 0x87 0xff 0x7f 0xff 0xff
# CHECK: js -32769
0x0f 0x88 0xff 0x7f 0xff 0xff
# CHECK: js -32769
0x66 0x0f 0x88 0xff 0x7f 0xff 0xff
# CHECK: jns -32769
0x0f 0x89 0xff 0x7f 0xff 0xff
# CHECK: jns -32769
0x66 0x0f 0x89 0xff 0x7f 0xff 0xff
# CHECK: jp -32769
0x0f 0x8a 0xff 0x7f 0xff 0xff
# CHECK: jp -32769
0x66 0x0f 0x8a 0xff 0x7f 0xff 0xff
# CHECK: jnp -32769
0x0f 0x8b 0xff 0x7f 0xff 0xff
# CHECK: jnp -32769
0x66 0x0f 0x8b 0xff 0x7f 0xff 0xff
# CHECK: jl -32769
0x0f 0x8c 0xff 0x7f 0xff 0xff
# CHECK: jl -32769
0x66 0x0f 0x8c 0xff 0x7f 0xff 0xff
# CHECK: jge -32769
0x0f 0x8d 0xff 0x7f 0xff 0xff
# CHECK: jge -32769
0x66 0x0f 0x8d 0xff 0x7f 0xff 0xff
# CHECK: jle -32769
0x0f 0x8e 0xff 0x7f 0xff 0xff
# CHECK: jle -32769
0x66 0x0f 0x8e 0xff 0x7f 0xff 0xff
# CHECK: jg -32769
0x0f 0x8f 0xff 0x7f 0xff 0xff
# CHECK: jg -32769
0x66 0x0f 0x8f 0xff 0x7f 0xff 0xff
# CHECK: lcallw *-32769(%rip)
0x66 0xff 0x1d 0xff 0x7f 0xff 0xff
# CHECK: ljmpw *-32769(%rip)
0x66 0xff 0x2d 0xff 0x7f 0xff 0xff
# CHECK: psubsb (%rdx), %mm3
0x0f 0xe8 0x1a
# CHECK: psubsb (%rdx), %xmm3
0x66 0x0f 0xe8 0x1a
# CHECK: addq 255(%rip), %rbx
0x49, 0x03, 0x1d, 0xff, 0x00, 0x00, 0x00
# The following 4 encodings are equivalent, as confirmed by the 'xed64'
# decoder tool provided by Intel, which we assume to be canonical even
# if the real silicon does something different. If that should happen,
# then we'll all have disassembler bugs to repair.
# Try all combinations of EVEX.x and REX.b:
# CHECK: vaddps 287453952(%rip), %zmm20, %zmm15
0x62 0x11 0x5c 0x40 0x58 0x3d 0x00 0x33 0x22 0x11
# CHECK: vaddps 287453952(%rip), %zmm20, %zmm15
0x62 0x31 0x5c 0x40 0x58 0x3d 0x00 0x33 0x22 0x11
# CHECK: vaddps 287453952(%rip), %zmm20, %zmm15
0x62 0x51 0x5c 0x40 0x58 0x3d 0x00 0x33 0x22 0x11
# CHECK: vaddps 287453952(%rip), %zmm20, %zmm15
0x62 0x71 0x5c 0x40 0x58 0x3d 0x00 0x33 0x22 0x11
# Known bugs: these use a SIB byte. The index register is incorrectly
# printed as an xmm register. Indeed there are "gather" load instructions
# taking a vector of indices, but ONLY those instructions can do that.
# The CHECK lines test the current incorrect output; FIXME is desired.
# CHECK: vaddps (%r10,%xmm9), %zmm20, %zmm15
# FIXME: vaddps (%r10,%r9), %zmm20, %zmm15
0x62 0x11 0x5c 0x40 0x58 0x3c 0x0a
# CHECK: vaddps (%rdx,%xmm9), %zmm20, %zmm15
# FIXME: vaddps (%rdx,%r9), %zmm20, %zmm15
0x62 0x31 0x5c 0x40 0x58 0x3c 0x0a
# CHECK: vaddps (%r10,%xmm1), %zmm20, %zmm15
# FIXME: vaddps (%r10,%rcx), %zmm20, %zmm15
0x62 0x51 0x5c 0x40 0x58 0x3c 0x0a
# CHECK: vaddps (%rdx,%xmm1), %zmm20, %zmm15
# FIXME: vaddps (%rdx,%rcx), %zmm20, %zmm15
0x62 0x71 0x5c 0x40 0x58 0x3c 0x0a
# CHECK: callq 32767
0xe8 0xff 0x7f 0x00 0x00
# CHECK: callq -32769
0xe8 0xff 0x7f 0xff 0xff