forked from OSchip/llvm-project
[Tests] Add test coverage for prefix selection logic
Note that I'm not asserting this code is correct; I'm simply adding coverage for what's there already. I'm reasonable sure the logic works for existing relaxable instructions, but I wouldn't be suprised if there were incorrect cases for other instructions. (i.e. is it legal to add prefixes to all instructions?)
This commit is contained in:
parent
fbb23c9714
commit
5f7772004b
|
@ -0,0 +1,50 @@
|
|||
# RUN: llvm-mc -filetype=obj -triple i386-pc-linux-gnu %s -x86-pad-max-prefix-size=15 | llvm-objdump -d --section=.text - | FileCheck %s
|
||||
|
||||
# Check prefix padding generation for all cases on 32 bit x86.
|
||||
|
||||
# CHECK: 1: 3e 3e 3e 3e 3e 3e 3e 3e 3e 81 e1 01 00 00 00 andl $1, %ecx
|
||||
# CHECK: 10: 3e 3e 3e 3e 3e 3e 3e 3e 3e 81 21 01 00 00 00 andl $1, %ds:(%ecx)
|
||||
# CHECK: 1f: 2e 2e 2e 2e 2e 2e 2e 2e 2e 81 21 01 00 00 00 andl $1, %cs:(%ecx)
|
||||
# CHECK: 2e: 3e 3e 3e 3e 3e 3e 3e 3e 3e 81 21 01 00 00 00 andl $1, %ds:(%ecx)
|
||||
# CHECK: 3d: 26 26 26 26 26 26 26 26 26 81 21 01 00 00 00 andl $1, %es:(%ecx)
|
||||
# CHECK: 4c: 64 64 64 64 64 64 64 64 64 81 21 01 00 00 00 andl $1, %fs:(%ecx)
|
||||
# CHECK: 5b: 65 65 65 65 65 65 65 65 65 81 21 01 00 00 00 andl $1, %gs:(%ecx)
|
||||
# CHECK: 6a: 36 36 36 36 36 36 36 36 36 81 21 01 00 00 00 andl $1, %ss:(%ecx)
|
||||
# CHECK: 79: 3e 3e 3e 3e 3e 81 a1 00 00 00 00 01 00 00 00 andl $1, %ds:(%ecx)
|
||||
# CHECK: 88: 3e 3e 3e 3e 3e 81 a1 00 00 00 00 01 00 00 00 andl $1, %ds:(%ecx)
|
||||
# CHECK: 97: 36 36 36 36 36 36 36 36 81 24 24 01 00 00 00 andl $1, %ss:(%esp)
|
||||
# CHECK: a6: 65 65 65 65 65 65 65 65 81 24 24 01 00 00 00 andl $1, %gs:(%esp)
|
||||
# CHECK: b5: 36 36 36 36 81 a4 24 00 00 00 00 01 00 00 00 andl $1, %ss:(%esp)
|
||||
# CHECK: c4: 36 36 36 36 36 36 36 36 81 65 00 01 00 00 00 andl $1, %ss:(%ebp)
|
||||
# CHECK: d3: 65 65 65 65 65 65 65 65 81 65 00 01 00 00 00 andl $1, %gs:(%ebp)
|
||||
# CHECK: e2: 36 36 36 36 36 81 a5 00 00 00 00 01 00 00 00 andl $1, %ss:(%ebp)
|
||||
.text
|
||||
.section .text
|
||||
.p2align 8
|
||||
bar:
|
||||
int3
|
||||
foo:
|
||||
# non-memory
|
||||
andl $foo, %ecx
|
||||
# memory, non-esp/ebp
|
||||
andl $foo, (%ecx)
|
||||
andl $foo, %cs:(%ecx)
|
||||
andl $foo, %ds:(%ecx)
|
||||
andl $foo, %es:(%ecx)
|
||||
andl $foo, %fs:(%ecx)
|
||||
andl $foo, %gs:(%ecx)
|
||||
andl $foo, %ss:(%ecx)
|
||||
andl $foo, data16 (%ecx)
|
||||
andl $foo, data32 (%ecx)
|
||||
# esp w/o segment override
|
||||
andl $foo, (%esp)
|
||||
andl $foo, %gs:(%esp)
|
||||
andl $foo, data32 (%esp)
|
||||
# ebp w/o segment override
|
||||
andl $foo, (%ebp)
|
||||
andl $foo, %gs:(%ebp)
|
||||
andl $foo, data32 (%ebp)
|
||||
|
||||
# Request enough padding to justify padding all of the above
|
||||
.p2align 8
|
||||
int3
|
|
@ -0,0 +1,53 @@
|
|||
# RUN: llvm-mc -mcpu=skylake -filetype=obj -triple x86_64-pc-linux-gnu %s -x86-pad-max-prefix-size=15 | llvm-objdump -d --section=.text - | FileCheck %s
|
||||
|
||||
# Check prefix padding generation for all cases on 64 bit x86.
|
||||
|
||||
# CHECK: 0: 2e 2e 2e 2e 2e 2e 2e 2e 48 81 e1 00 00 00 00 andq $0, %rcx
|
||||
# CHECK: f: 2e 2e 2e 2e 2e 2e 2e 2e 48 81 21 00 00 00 00 andq $0, %cs:(%rcx)
|
||||
# CHECK: 1e: 2e 2e 2e 2e 2e 2e 2e 2e 48 81 21 00 00 00 00 andq $0, %cs:(%rcx)
|
||||
# CHECK: 2d: 3e 3e 3e 3e 3e 3e 3e 3e 48 81 21 00 00 00 00 andq $0, %ds:(%rcx)
|
||||
# CHECK: 3c: 26 26 26 26 26 26 26 26 48 81 21 00 00 00 00 andq $0, %es:(%rcx)
|
||||
# CHECK: 4b: 64 64 64 64 64 64 64 64 48 81 21 00 00 00 00 andq $0, %fs:(%rcx)
|
||||
# CHECK: 5a: 65 65 65 65 65 65 65 65 48 81 21 00 00 00 00 andq $0, %gs:(%rcx)
|
||||
# CHECK: 69: 36 36 36 36 36 36 36 36 48 81 21 00 00 00 00 andq $0, %ss:(%rcx)
|
||||
# CHECK: 78: 2e 2e 2e 2e 48 81 a1 00 00 00 00 00 00 00 00 andq $0, %cs:(%rcx)
|
||||
# CHECK: 87: 2e 2e 2e 2e 48 81 a1 00 00 00 00 00 00 00 00 andq $0, %cs:(%rcx)
|
||||
# CHECK: 96: 2e 2e 2e 2e 2e 2e 2e 48 81 24 24 00 00 00 00 andq $0, %cs:(%rsp)
|
||||
# CHECK: a5: 65 65 65 65 65 65 65 48 81 24 24 00 00 00 00 andq $0, %gs:(%rsp)
|
||||
# CHECK: b4: 2e 2e 2e 48 81 a4 24 00 00 00 00 00 00 00 00 andq $0, %cs:(%rsp)
|
||||
# CHECK: c3: 2e 2e 2e 2e 2e 2e 2e 48 81 65 00 00 00 00 00 andq $0, %cs:(%rbp)
|
||||
# CHECK: d2: 65 65 65 65 65 65 65 48 81 65 00 00 00 00 00 andq $0, %gs:(%rbp)
|
||||
# CHECK: e1: 2e 2e 2e 2e 48 81 a5 00 00 00 00 00 00 00 00 andq $0, %cs:(%rbp)
|
||||
.text
|
||||
.section .text
|
||||
.p2align 8
|
||||
# non-memory
|
||||
andq $foo, %rcx
|
||||
# memory, non-esp/ebp
|
||||
andq $foo, (%rcx)
|
||||
andq $foo, %cs:(%rcx)
|
||||
andq $foo, %ds:(%rcx)
|
||||
andq $foo, %es:(%rcx)
|
||||
andq $foo, %fs:(%rcx)
|
||||
andq $foo, %gs:(%rcx)
|
||||
andq $foo, %ss:(%rcx)
|
||||
andq $foo, data16 (%rcx)
|
||||
andq $foo, data32 (%rcx)
|
||||
# esp w/o segment override
|
||||
andq $foo, (%rsp)
|
||||
andq $foo, %gs:(%rsp)
|
||||
andq $foo, data32 (%rsp)
|
||||
# ebp w/o segment override
|
||||
andq $foo, (%rbp)
|
||||
andq $foo, %gs:(%rbp)
|
||||
andq $foo, data32 (%rbp)
|
||||
|
||||
# Request enough padding to justify padding all of the above
|
||||
.p2align 8
|
||||
int3
|
||||
|
||||
.section "other"
|
||||
bar:
|
||||
.p2align 3
|
||||
int3
|
||||
foo:
|
Loading…
Reference in New Issue