blob: e3480520c6792476b0a3fe9d98fd110399ffd153 [file] [log] [blame]
David Peixotto80c083a2013-12-19 18:26:07 +00001@ This test has a partner (ltorg.s) that contains matching
2@ tests for the .ltorg on linux 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-apple-darwin %s | FileCheck %s
8@RUN: llvm-mc -triple thumbv5-apple-darwin %s | FileCheck %s
9@RUN: llvm-mc -triple thumbv7-apple-darwin %s | FileCheck %s
10
11@ check that ltorg dumps the constant pool at the current location
12.section __TEXT,a,regular,pure_instructions
13@ CHECK-LABEL: f2:
14f2:
15 ldr r0, =0x10001
16@ CHECK: ldr r0, Ltmp0
17 adds r0, r0, #1
18 adds r0, r0, #1
19 b f3
20.ltorg
21@ constant pool
David Peixotto80c083a2013-12-19 18:26:07 +000022@ CHECK: .data_region
Dan Gohman14d84362016-01-26 00:27:59 +000023@ CHECK: .p2align 2
David Peixotto80c083a2013-12-19 18:26:07 +000024@ CHECK-LABEL: Ltmp0:
25@ CHECK: .long 65537
26@ CHECK: .end_data_region
27
28@ CHECK-LABEL: f3:
29f3:
30 adds r0, r0, #1
31 adds r0, r0, #1
32
33@ check that ltorg clears the constant pool after dumping it
34.section __TEXT,b,regular,pure_instructions
35@ CHECK-LABEL: f4:
36f4:
37 ldr r0, =0x10002
38@ CHECK: ldr r0, Ltmp1
39 adds r0, r0, #1
40 adds r0, r0, #1
41 b f5
42.ltorg
43@ constant pool
David Peixotto80c083a2013-12-19 18:26:07 +000044@ CHECK: .data_region
Dan Gohman14d84362016-01-26 00:27:59 +000045@ CHECK: .p2align 2
David Peixotto80c083a2013-12-19 18:26:07 +000046@ CHECK-LABEL: Ltmp1:
47@ CHECK: .long 65538
48@ CHECK: .end_data_region
49
50@ CHECK-LABEL: f5:
51f5:
52 adds r0, r0, #1
53 adds r0, r0, #1
54 ldr r0, =0x10003
55@ CHECK: ldr r0, Ltmp2
56 adds r0, r0, #1
57 b f6
58.ltorg
59@ constant pool
David Peixotto80c083a2013-12-19 18:26:07 +000060@ CHECK: .data_region
Dan Gohman14d84362016-01-26 00:27:59 +000061@ CHECK: .p2align 2
David Peixotto80c083a2013-12-19 18:26:07 +000062@ CHECK-LABEL: Ltmp2:
63@ CHECK: .long 65539
64@ CHECK: .end_data_region
65
66@ CHECK-LABEL: f6:
67f6:
68 adds r0, r0, #1
69 adds r0, r0, #1
70
71@ check that ltorg does not issue an error if there is no constant pool
72.section __TEXT,c,regular,pure_instructions
73@ CHECK-LABEL: f7:
74f7:
75 adds r0, r0, #1
76 b f8
77 .ltorg
78f8:
79 adds r0, r0, #1
80
81@ check that ltorg works for labels
82.section __TEXT,d,regular,pure_instructions
83@ CHECK-LABEL: f9:
84f9:
85 adds r0, r0, #1
86 adds r0, r0, #1
87 ldr r0, =bar
88@ CHECK: ldr r0, Ltmp3
89 adds r0, r0, #1
90 adds r0, r0, #1
91 adds r0, r0, #1
92 b f10
93.ltorg
94@ constant pool
David Peixotto80c083a2013-12-19 18:26:07 +000095@ CHECK: .data_region
Dan Gohman14d84362016-01-26 00:27:59 +000096@ CHECK: .p2align 2
David Peixotto80c083a2013-12-19 18:26:07 +000097@ CHECK-LABEL: Ltmp3:
98@ CHECK: .long bar
99@ CHECK: .end_data_region
100
101@ CHECK-LABEL: f10:
102f10:
103 adds r0, r0, #1
104 adds r0, r0, #1
105
106@ check that use of ltorg does not prevent dumping non-empty constant pools at end of section
107.section __TEXT,e,regular,pure_instructions
108@ CHECK-LABEL: f11:
109f11:
110 adds r0, r0, #1
111 adds r0, r0, #1
112 ldr r0, =0x10004
113@ CHECK: ldr r0, Ltmp4
114 b f12
115 .ltorg
116@ constant pool
David Peixotto80c083a2013-12-19 18:26:07 +0000117@ CHECK: .data_region
Dan Gohman14d84362016-01-26 00:27:59 +0000118@ CHECK: .p2align 2
David Peixotto80c083a2013-12-19 18:26:07 +0000119@ CHECK-LABEL: Ltmp4:
120@ CHECK: .long 65540
121@ CHECK: .end_data_region
122
123@ CHECK-LABEL: f12:
124f12:
125 adds r0, r0, #1
126 ldr r0, =0x10005
127@ CHECK: ldr r0, Ltmp5
128
129.section __TEXT,f,regular,pure_instructions
130@ CHECK-LABEL: f13
131f13:
132 adds r0, r0, #1
133 adds r0, r0, #1
134
135@ should not have a constant pool at end of section with empty constant pools
136@ CHECK-NOT: .section __TEXT,a,regular,pure_instructions
137@ CHECK-NOT: .section __TEXT,b,regular,pure_instructions
138@ CHECK-NOT: .section __TEXT,c,regular,pure_instructions
139@ CHECK-NOT: .section __TEXT,d,regular,pure_instructions
140
141@ should have a non-empty constant pool at end of this section
142@ CHECK: .section __TEXT,e,regular,pure_instructions
143@ constant pool
David Peixotto80c083a2013-12-19 18:26:07 +0000144@ CHECK: .data_region
Dan Gohman14d84362016-01-26 00:27:59 +0000145@ CHECK: .p2align 2
David Peixotto80c083a2013-12-19 18:26:07 +0000146@ CHECK-LABEL: Ltmp5:
147@ CHECK: .long 65541
148@ CHECK: .end_data_region
149
150@ should not have a constant pool at end of section with empty constant pools
151@ CHECK-NOT: .section __TEXT,f,regular,pure_instructions