1# RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - \
2# RUN:   | llvm-objdump -disassemble -no-show-raw-insn - | FileCheck %s
3# RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu -mc-relax-all %s -o - \
4# RUN:   | llvm-objdump -disassemble -no-show-raw-insn - | FileCheck %s
5
6# Will be bundle-aligning to 16 byte boundaries
7  .bundle_align_mode 4
8  .text
9# CHECK-LABEL: foo
10foo:
11# Test that bundle alignment mode can be set more than once.
12  .bundle_align_mode 4
13# Each of these callq instructions is 5 bytes long
14  callq bar
15  callq bar
16  .bundle_lock
17  .bundle_lock
18  callq bar
19  callq bar
20  .bundle_unlock
21  .bundle_unlock
22# CHECK:      10: callq
23# CHECK-NEXT: 15: callq
24
25  .p2align 4
26# CHECK-LABEL: bar
27bar:
28  callq foo
29  callq foo
30# Check that the callqs get bundled together, and that the whole group is
31# align_to_end
32  .bundle_lock
33  callq bar
34  .bundle_lock align_to_end
35  callq bar
36  .bundle_unlock
37  .bundle_unlock
38# CHECK:      36: callq
39# CHECK-NEXT: 3b: callq
40
41# CHECK-LABEL: baz
42baz:
43  callq foo
44  callq foo
45# Check that the callqs get bundled together, and that the whole group is
46# align_to_end (with the outer directive marked align_to_end)
47  .bundle_lock align_to_end
48  callq bar
49  .bundle_lock
50  callq bar
51  .bundle_unlock
52  .bundle_unlock
53# CHECK:      56: callq
54# CHECK-NEXT: 5b: callq
55
56# CHECK-LABEL: quux
57quux:
58  callq bar
59  callq bar
60  .bundle_lock
61  .bundle_lock
62  callq bar
63  .bundle_unlock
64  callq bar
65  .bundle_unlock
66# Check that the calls are bundled together when the second one is after the
67# inner nest is closed.
68# CHECK:      70: callq
69# CHECK-NEXT: 75: callq
70