1@ This test has a partner (ltorg-darwin.s) that contains matching
2@ tests for the .ltorg on darwin targets. We need separate files
3@ because the syntax for switching sections and temporary labels differs
4@ between darwin and linux. Any tests added here should have a matching
5@ test added there.
6
7@RUN: llvm-mc -triple   armv7-unknown-linux-gnueabi %s | FileCheck %s
8@RUN: llvm-mc -triple thumbv5-unknown-linux-gnueabi %s | FileCheck %s
9@RUN: llvm-mc -triple thumbv7-unknown-linux-gnueabi %s | FileCheck %s
10
11@ check that ltorg dumps the constant pool at the current location
12.section a,"ax",%progbits
13@ CHECK-LABEL: f2:
14f2:
15  ldr r0, =0x10001
16@ CHECK: ldr r0, .Ltmp[[TMP0:[0-9+]]]
17  adds r0, r0, #1
18  adds r0, r0, #1
19  b f3
20.ltorg
21@ constant pool
22@ CHECK: .align 2
23@ CHECK: .Ltmp[[TMP0]]
24@ CHECK: .long 65537
25
26@ CHECK-LABEL: f3:
27f3:
28  adds r0, r0, #1
29  adds r0, r0, #1
30
31@ check that ltorg clears the constant pool after dumping it
32.section b,"ax",%progbits
33@ CHECK-LABEL: f4:
34f4:
35  ldr r0, =0x10002
36@ CHECK: ldr r0, .Ltmp[[TMP1:[0-9+]]]
37  adds r0, r0, #1
38  adds r0, r0, #1
39  b f5
40.ltorg
41@ constant pool
42@ CHECK: .align 2
43@ CHECK: .Ltmp[[TMP1]]
44@ CHECK: .long 65538
45
46@ CHECK-LABEL: f5:
47f5:
48  adds r0, r0, #1
49  adds r0, r0, #1
50  ldr r0, =0x10003
51@ CHECK: ldr r0, .Ltmp[[TMP2:[0-9+]]]
52  adds r0, r0, #1
53  b f6
54.ltorg
55@ constant pool
56@ CHECK: .align 2
57@ CHECK: .Ltmp[[TMP2]]
58@ CHECK: .long 65539
59
60@ CHECK-LABEL: f6:
61f6:
62  adds r0, r0, #1
63  adds r0, r0, #1
64
65@ check that ltorg does not issue an error if there is no constant pool
66.section c,"ax",%progbits
67@ CHECK-LABEL: f7:
68f7:
69  adds r0, r0, #1
70  b f8
71  .ltorg
72f8:
73  adds r0, r0, #1
74
75@ check that ltorg works for labels
76.section d,"ax",%progbits
77@ CHECK-LABEL: f9:
78f9:
79  adds r0, r0, #1
80  adds r0, r0, #1
81  ldr r0, =bar
82@ CHECK: ldr r0, .Ltmp[[TMP3:[0-9+]]]
83  adds r0, r0, #1
84  adds r0, r0, #1
85  adds r0, r0, #1
86  b f10
87.ltorg
88@ constant pool
89@ CHECK: .align 2
90@ CHECK: .Ltmp[[TMP3]]
91@ CHECK: .long bar
92
93@ CHECK-LABEL: f10:
94f10:
95  adds r0, r0, #1
96  adds r0, r0, #1
97
98@ check that use of ltorg does not prevent dumping non-empty constant pools at end of section
99.section e,"ax",%progbits
100@ CHECK-LABEL: f11:
101f11:
102  adds r0, r0, #1
103  adds r0, r0, #1
104  ldr r0, =0x10004
105@ CHECK: ldr r0, .Ltmp[[TMP4:[0-9+]]]
106  b f12
107  .ltorg
108@ constant pool
109@ CHECK: .align 2
110@ CHECK: .Ltmp[[TMP4]]
111@ CHECK: .long 65540
112@ CHECK-LABEL: f12:
113f12:
114  adds r0, r0, #1
115  ldr r0, =0x10005
116@ CHECK: ldr r0, .Ltmp[[TMP5:[0-9+]]]
117
118.section f,"ax",%progbits
119@ CHECK-LABEL: f13
120f13:
121  adds r0, r0, #1
122  adds r0, r0, #1
123
124@ should not have a constant pool at end of section with empty constant pools
125@ CHECK-NOT: .section a,"ax",%progbits
126@ CHECK-NOT: .section b,"ax",%progbits
127@ CHECK-NOT: .section c,"ax",%progbits
128@ CHECK-NOT: .section d,"ax",%progbits
129
130@ should have a non-empty constant pool at end of this section
131@ CHECK: .section e,"ax",%progbits
132@ constant pool
133@ CHECK: .align 2
134@ CHECK: .Ltmp[[TMP5]]
135@ CHECK: .long 65541
136
137@ should not have a constant pool at end of section with empty constant pools
138@ CHECK-NOT: .section f,"ax",%progbits
139