xref: /aosp_15_r20/external/llvm/test/MC/X86/AlignedBundling/nesting.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# Will be bundle-aligning to 16 byte boundaries
7*9880d681SAndroid Build Coastguard Worker  .bundle_align_mode 4
8*9880d681SAndroid Build Coastguard Worker  .text
9*9880d681SAndroid Build Coastguard Worker# CHECK-LABEL: foo:
10*9880d681SAndroid Build Coastguard Worker.type   foo,@function
11*9880d681SAndroid Build Coastguard Workerfoo:
12*9880d681SAndroid Build Coastguard Worker# Test that bundle alignment mode can be set more than once.
13*9880d681SAndroid Build Coastguard Worker  .bundle_align_mode 4
14*9880d681SAndroid Build Coastguard Worker# Each of these callq instructions is 5 bytes long
15*9880d681SAndroid Build Coastguard Worker  callq bar
16*9880d681SAndroid Build Coastguard Worker  callq bar
17*9880d681SAndroid Build Coastguard Worker  .bundle_lock
18*9880d681SAndroid Build Coastguard Worker  .bundle_lock
19*9880d681SAndroid Build Coastguard Worker  callq bar
20*9880d681SAndroid Build Coastguard Worker  callq bar
21*9880d681SAndroid Build Coastguard Worker  .bundle_unlock
22*9880d681SAndroid Build Coastguard Worker  .bundle_unlock
23*9880d681SAndroid Build Coastguard Worker# CHECK:      10: callq {{.*}} <bar>
24*9880d681SAndroid Build Coastguard Worker# CHECK-NEXT: 15: callq {{.*}} <bar>
25*9880d681SAndroid Build Coastguard Worker
26*9880d681SAndroid Build Coastguard Worker  .p2align 4
27*9880d681SAndroid Build Coastguard Worker# CHECK-LABEL: bar:
28*9880d681SAndroid Build Coastguard Worker.type   bar,@function
29*9880d681SAndroid Build Coastguard Workerbar:
30*9880d681SAndroid Build Coastguard Worker  callq foo
31*9880d681SAndroid Build Coastguard Worker  callq foo
32*9880d681SAndroid Build Coastguard Worker# Check that the callqs get bundled together, and that the whole group is
33*9880d681SAndroid Build Coastguard Worker# align_to_end
34*9880d681SAndroid Build Coastguard Worker  .bundle_lock
35*9880d681SAndroid Build Coastguard Worker  callq bar
36*9880d681SAndroid Build Coastguard Worker  .bundle_lock align_to_end
37*9880d681SAndroid Build Coastguard Worker  callq bar
38*9880d681SAndroid Build Coastguard Worker  .bundle_unlock
39*9880d681SAndroid Build Coastguard Worker  .bundle_unlock
40*9880d681SAndroid Build Coastguard Worker# CHECK:      36: callq {{.*}} <bar>
41*9880d681SAndroid Build Coastguard Worker# CHECK-NEXT: 3b: callq {{.*}} <bar>
42*9880d681SAndroid Build Coastguard Worker
43*9880d681SAndroid Build Coastguard Worker# CHECK-LABEL: baz:
44*9880d681SAndroid Build Coastguard Worker.type   baz,@function
45*9880d681SAndroid Build Coastguard Workerbaz:
46*9880d681SAndroid Build Coastguard Worker  callq foo
47*9880d681SAndroid Build Coastguard Worker  callq foo
48*9880d681SAndroid Build Coastguard Worker# Check that the callqs get bundled together, and that the whole group is
49*9880d681SAndroid Build Coastguard Worker# align_to_end (with the outer directive marked align_to_end)
50*9880d681SAndroid Build Coastguard Worker  .bundle_lock align_to_end
51*9880d681SAndroid Build Coastguard Worker  callq bar
52*9880d681SAndroid Build Coastguard Worker  .bundle_lock
53*9880d681SAndroid Build Coastguard Worker  callq bar
54*9880d681SAndroid Build Coastguard Worker  .bundle_unlock
55*9880d681SAndroid Build Coastguard Worker  .bundle_unlock
56*9880d681SAndroid Build Coastguard Worker# CHECK:      56: callq {{.*}} <bar>
57*9880d681SAndroid Build Coastguard Worker# CHECK-NEXT: 5b: callq {{.*}} <bar>
58*9880d681SAndroid Build Coastguard Worker
59*9880d681SAndroid Build Coastguard Worker# CHECK-LABEL: quux
60*9880d681SAndroid Build Coastguard Worker.type   quux,@function
61*9880d681SAndroid Build Coastguard Workerquux:
62*9880d681SAndroid Build Coastguard Worker  callq bar
63*9880d681SAndroid Build Coastguard Worker  callq bar
64*9880d681SAndroid Build Coastguard Worker  .bundle_lock
65*9880d681SAndroid Build Coastguard Worker  .bundle_lock
66*9880d681SAndroid Build Coastguard Worker  callq bar
67*9880d681SAndroid Build Coastguard Worker  .bundle_unlock
68*9880d681SAndroid Build Coastguard Worker  callq bar
69*9880d681SAndroid Build Coastguard Worker  .bundle_unlock
70*9880d681SAndroid Build Coastguard Worker# Check that the calls are bundled together when the second one is after the
71*9880d681SAndroid Build Coastguard Worker# inner nest is closed.
72*9880d681SAndroid Build Coastguard Worker# CHECK:      70: callq {{.*}} <bar>
73*9880d681SAndroid Build Coastguard Worker# CHECK-NEXT: 75: callq {{.*}} <bar>
74