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