xref: /llvm-project/llvm/test/MC/X86/align-branch-single.s (revision 4168233badd4de41fee1bdc0a9701c5360ea1ead)
1# RUN: llvm-mc -filetype=obj -triple x86_64 --x86-align-branch-boundary=32 --x86-align-branch=jcc %s | llvm-objdump -d --no-show-raw-insn - | FileCheck %s --check-prefixes=JCC
2# RUN: llvm-mc -filetype=obj -triple x86_64 --x86-align-branch-boundary=32 --x86-align-branch=jmp %s | llvm-objdump -d --no-show-raw-insn - | FileCheck %s --check-prefixes=JMP
3# RUN: llvm-mc -filetype=obj -triple x86_64 --x86-align-branch-boundary=32 --x86-align-branch=indirect %s | llvm-objdump -d --no-show-raw-insn - | FileCheck %s --check-prefixes=IND
4# RUN: llvm-mc -filetype=obj -triple x86_64 --x86-align-branch-boundary=32 --x86-align-branch=call %s | llvm-objdump -d --no-show-raw-insn - | FileCheck %s --check-prefixes=CAL
5# RUN: llvm-mc -filetype=obj -triple x86_64 --x86-align-branch-boundary=32 --x86-align-branch=ret %s | llvm-objdump -d --no-show-raw-insn - | FileCheck %s --check-prefixes=RET
6# RUN: llvm-mc -filetype=obj -triple x86_64-pc-win32 --x86-align-branch-boundary=32 --x86-align-branch=ret %s | llvm-objdump -d --no-show-raw-insn - | FileCheck %s --check-prefixes=RET
7
8  # Exercise cases where only one kind of instruction is asked to be aligned.
9  # Fused instruction cases are excluded.
10
11  .text
12  .globl  foo
13  .p2align  5
14foo:
15  .p2align  5
16  .rept 30
17  int3
18  .endr
19  # JCC:    20:          jne
20  # JMP:    1e:          jne
21  # IND:    1e:          jne
22  # CAL:    1e:          jne
23  # RET:    1e:          jne
24  jne foo
25  int3
26
27  .p2align  5
28  .rept 30
29  int3
30  .endr
31  # JCC:    5e:          jmp
32  # JMP:    60:          jmp
33  # IND:    5e:          jmp
34  # CAL:    5e:          jmp
35  # RET:    5e:          jmp
36  jmp foo
37  int3
38
39  .p2align  5
40  .rept 30
41  int3
42  .endr
43  # JCC:    9e:          jmpq    *%rax
44  # JMP:    9e:          jmpq    *%rax
45  # IND:    a0:          jmpq    *%rax
46  # CAL:    9e:          jmpq    *%rax
47  # RET:    9e:          jmpq    *%rax
48  jmp  *%rax
49  int3
50
51
52  .p2align  5
53  .rept 30
54  int3
55  .endr
56  # JCC:    de:          callq    *%rax
57  # JMP:    de:          callq    *%rax
58  # IND:    de:          callq    *%rax
59  # CAL:    e0:          callq    *%rax
60  # RET:    de:          callq    *%rax
61  call  *%rax
62  int3
63
64
65  .p2align  5
66  .rept 30
67  int3
68  .endr
69  # JCC:   11e:          retq
70  # JMP:   11e:          retq
71  # IND:   11e:          retq
72  # CAL:   11e:          retq
73  # RET:   120:          retq
74  ret $0
75  int3
76
77
78  .p2align  5
79  .rept 29
80  int3
81  .endr
82  # JCC:   15d:          cmpq    %rax, %rbp
83  # JCC:   160:          je
84  # JMP:   15d:          cmpq    %rax, %rbp
85  # JMP:   160:          je
86  # IND:   15d:          cmpq    %rax, %rbp
87  # IND:   160:          je
88  # CAL:   15d:          cmpq    %rax, %rbp
89  # CAL:   160:          je
90  # RET:   15d:          cmpq    %rax, %rbp
91  # RET:   160:          je
92  cmp  %rax, %rbp
93  je  foo
94  int3
95