xref: /llvm-project/llvm/test/MC/X86/align-branch-mixed.s (revision 7ad46cfe41554627caa9e91313682ad9dd4b9c3a)
1# RUN: llvm-mc -filetype=obj -triple x86_64 --x86-align-branch-boundary=32 --x86-align-branch=jcc+jmp+indirect+call+ret %s | llvm-objdump -d --no-show-raw-insn - | FileCheck %s
2
3  # Exercise cases where mixed kinds of branch are asked to be aligned.
4
5  .text
6  .globl  labeled_mixed_test1
7labeled_mixed_test1:
8  .p2align  5
9  .rept 30
10  int3
11  .endr
12  # This call should have started at 0x1e and ends at 0x23, so two bytes of
13  # padding are inserted before it.
14  # CHECK:    20:          callq
15  call  bar
16  .rept 28
17  int3
18  .endr
19  # If the previous call was not aligned, this jmp should have started at 0x3f
20  # and need two bytes of padding. After the two bytes of padding are inserted
21  # for the call, this jmp starts at 0xa1 and does not need padding.
22  # CHECK:    41:          jmp
23  jmp  *%rax
24
25  .globl  labeled_mixed_test2
26labeled_mixed_test2:
27  .p2align  5
28  .rept 30
29  int3
30  .endr
31  # This jne should have started at 0x7e, so two bytes of padding are inserted
32  # before it.
33  # CHECK:    80:          jne
34  jne bar
35  .rept 28
36  int3
37  .endr
38  # If the previous jne was not aligned, this jmp should have started at 0x3c.
39  # After the two bytes of padding are inserted for the jne, this jmp should
40  # have started at 0x9e, so two bytes of padding are inserted and it starts at
41  # 0xa0.
42  # CHECK:    a0:          jmp
43  jmp bar
44
45  .globl  labeled_mixed_test3
46labeled_mixed_test3:
47  .p2align 5
48  .type   bar,@function
49bar:
50  # CHECK:    c0:          retq
51  retq
52