xref: /aosp_15_r20/external/llvm/test/MC/X86/AlignedBundling/long-nop-pad.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 that long nops are generated for padding where possible.
7*9880d681SAndroid Build Coastguard Worker
8*9880d681SAndroid Build Coastguard Worker  .text
9*9880d681SAndroid Build Coastguard Workerfoo:
10*9880d681SAndroid Build Coastguard Worker  .bundle_align_mode 5
11*9880d681SAndroid Build Coastguard Worker
12*9880d681SAndroid Build Coastguard Worker# This callq instruction is 5 bytes long
13*9880d681SAndroid Build Coastguard Worker  .bundle_lock align_to_end
14*9880d681SAndroid Build Coastguard Worker  callq   bar
15*9880d681SAndroid Build Coastguard Worker  .bundle_unlock
16*9880d681SAndroid Build Coastguard Worker# To align this group to a bundle end, we need a 15-byte NOP and a 12-byte NOP.
17*9880d681SAndroid Build Coastguard Worker# CHECK:        0:  nop
18*9880d681SAndroid Build Coastguard Worker# CHECK-NEXT:   f:  nop
19*9880d681SAndroid Build Coastguard Worker# CHECK:   1b: callq
20*9880d681SAndroid Build Coastguard Worker
21*9880d681SAndroid Build Coastguard Worker# This push instruction is 1 byte long
22*9880d681SAndroid Build Coastguard Worker  .bundle_lock align_to_end
23*9880d681SAndroid Build Coastguard Worker  push %rax
24*9880d681SAndroid Build Coastguard Worker  .bundle_unlock
25*9880d681SAndroid Build Coastguard Worker# To align this group to a bundle end, we need two 15-byte NOPs, and a 1-byte.
26*9880d681SAndroid Build Coastguard Worker# CHECK:        20:  nop
27*9880d681SAndroid Build Coastguard Worker# CHECK-NEXT:   2f:  nop
28*9880d681SAndroid Build Coastguard Worker# CHECK-NEXT:   3e:  nop
29*9880d681SAndroid Build Coastguard Worker# CHECK-NEXT:   3f: pushq
30