xref: /aosp_15_r20/external/llvm/test/MC/X86/AlignedBundling/pad-align-to-bundle-end.s (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker# RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - \
2*9880d681SAndroid Build Coastguard Worker# RUN:   | llvm-objdump -disassemble -no-show-raw-insn - | FileCheck %s
3*9880d681SAndroid Build Coastguard Worker# RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu -mc-relax-all %s -o - \
4*9880d681SAndroid Build Coastguard Worker# RUN:   | llvm-objdump -disassemble -no-show-raw-insn - | FileCheck %s
5*9880d681SAndroid Build Coastguard Worker
6*9880d681SAndroid Build Coastguard Worker# Test some variations of padding to the end of a bundle.
7*9880d681SAndroid Build Coastguard Worker
8*9880d681SAndroid Build Coastguard Worker  .text
9*9880d681SAndroid Build Coastguard Workerfoo:
10*9880d681SAndroid Build Coastguard Worker  .bundle_align_mode 4
11*9880d681SAndroid Build Coastguard Worker
12*9880d681SAndroid Build Coastguard Worker# Each of these callq instructions is 5 bytes long
13*9880d681SAndroid Build Coastguard Worker  callq   bar
14*9880d681SAndroid Build Coastguard Worker  callq   bar
15*9880d681SAndroid Build Coastguard Worker  .bundle_lock align_to_end
16*9880d681SAndroid Build Coastguard Worker  callq   bar
17*9880d681SAndroid Build Coastguard Worker  .bundle_unlock
18*9880d681SAndroid Build Coastguard Worker# To align this group to a bundle end, we need a 1-byte NOP.
19*9880d681SAndroid Build Coastguard Worker# CHECK:        a:  nop
20*9880d681SAndroid Build Coastguard Worker# CHECK-NEXT:   b: callq
21*9880d681SAndroid Build Coastguard Worker
22*9880d681SAndroid Build Coastguard Worker  callq   bar
23*9880d681SAndroid Build Coastguard Worker  callq   bar
24*9880d681SAndroid Build Coastguard Worker  .bundle_lock align_to_end
25*9880d681SAndroid Build Coastguard Worker  callq   bar
26*9880d681SAndroid Build Coastguard Worker  callq   bar
27*9880d681SAndroid Build Coastguard Worker  .bundle_unlock
28*9880d681SAndroid Build Coastguard Worker# Here we have to pad until the end of the *next* boundary because
29*9880d681SAndroid Build Coastguard Worker# otherwise the group crosses a boundary.
30*9880d681SAndroid Build Coastguard Worker# CHECK:      1a: nop
31*9880d681SAndroid Build Coastguard Worker# The nop sequence may be implemented as one instruction or many, but if
32*9880d681SAndroid Build Coastguard Worker# it's one instruction, that instruction cannot itself cross the boundary.
33*9880d681SAndroid Build Coastguard Worker# CHECK:      20: nop
34*9880d681SAndroid Build Coastguard Worker# CHECK-NEXT: 26: callq
35*9880d681SAndroid Build Coastguard Worker# CHECK-NEXT: 2b: callq
36