Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / llvm / test / MC / X86 / align-branch-enhanced-relaxation.s
blob4720e35a64b0d32f42c85bc1c82159fc516b1041
1 # RUN: llvm-mc -mcpu=skylake -filetype=obj -triple x86_64-pc-linux-gnu %s -x86-pad-max-prefix-size=1 --x86-align-branch-boundary=32 --x86-align-branch=jmp+indirect | llvm-objdump -d - | FileCheck %s
2 # RUN: llvm-mc -mcpu=skylake -filetype=obj -triple x86_64-pc-linux-gnu %s --mc-relax-all | llvm-objdump -d - | FileCheck --check-prefixes=RELAX-ALL %s
4 # Exercise cases where we are allowed to increase the length of unrelaxable
5 # instructions (by adding prefixes) for alignment purposes.
7 # The first test checks instructions 'int3', 'push %rbp', which will be padded
8 # later are unrelaxable (their encoding size is still 1 byte when
9 # --mc-relax-all is passed).
10 .text
11 .globl labeled_unrelaxable_test
12 labeled_unrelaxable_test:
13 # RELAX-ALL: 0: cc int3
14 # RELAX-ALL: 1: 54 pushq %rsp
15 int3
16 push %rsp
18 # The second test is a basic test, we just check the jmp is aligned by prefix
19 # padding the previous instructions.
20 .text
21 .globl labeled_basic_test
22 labeled_basic_test:
23 .p2align 5
24 .rept 28
25 int3
26 .endr
27 # CHECK: 3c: 2e cc int3
28 # CHECK: 3e: 2e 54 pushq %rsp
29 # CHECK: 40: eb 00 jmp
30 int3
31 push %rsp
32 jmp foo
33 foo:
34 ret
36 # The third test check the correctness cornercase - can't add prefixes on a
37 # prefix or a instruction following by a prefix.
38 .globl labeled_prefix_test
39 labeled_prefix_test:
40 .p2align 5
41 .rept 28
42 int3
43 .endr
44 # CHECK: 7c: 2e cc int3
45 int3
46 # CHECK: 7e: 3e cc int3
48 int3
49 # CHECK: 80: eb 00 jmp
50 jmp bar
51 bar:
52 ret