1 @ This test has
a partner
(ldr-pseudo-darwin.s
) that contains matching
2 @ tests for the ldr-pseudo 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
7 @RUN
: llvm-mc
-triple armv7-unknown-linux-gnueabi
%s | FileCheck
--check-prefix
=CHECK-ARM
--check-prefix
=CHECK
%s
8 @RUN
: llvm-mc
-triple armv5-unknown-linux-gnueabi
%s | FileCheck
--check-prefix
=CHECK-ARMV5
--check-prefix
=CHECK
%s
9 @RUN
: llvm-mc
-triple thumbv5-unknown-linux-gnueabi
%s | FileCheck
--check-prefix
=CHECK-THUMB
--check-prefix
=CHECK
%s
10 @RUN
: llvm-mc
-triple thumbv7-unknown-linux-gnueabi
%s | FileCheck
--check-prefix
=CHECK-THUMB2
--check-prefix
=CHECK
%s
11 @RUN
: llvm-mc
-triple thumbv8m.base-unknown-linux-gnueabi
%s | FileCheck
--check-prefix
=CHECK-BASELINE
--check-prefix
=CHECK
%s
13 @ Check that large constants are converted to ldr from constant pool
16 .section b,"ax",%progbits
20 @ CHECK
: ldr
r0, .Ltmp[[TMP0:[0-9]+]]
22 @ loading multiple constants
23 .section c,"ax",%progbits
27 @ CHECK
: ldr
r0, .Ltmp[[TMP1:[0-9]+]]
33 @ CHECK
: ldr
r0, .Ltmp[[TMP2:[0-9]+]]
37 @ TODO
: the same constants should have the same constant pool location
38 .section d,"ax",%progbits
42 @ CHECK
: ldr
r0, .Ltmp[[TMP3:[0-9]+]]
51 @ CHECK
: ldr
r0, .Ltmp[[TMP3:[0-9]+]]
59 @
a section defined in multiple pieces should
be merged
and use
a single constant pool
60 .section e,"ax",%progbits
64 @ CHECK
: ldr
r0, .Ltmp[[TMP5:[0-9]+]]
69 .section f, "ax", %progbits
76 .section e, "ax", %progbits
81 @ CHECK
: ldr
r0, .Ltmp[[TMP6:[0-9]+]]
86 @ Check that symbols can
be loaded using ldr pseudo
89 @ load an undefined symbol
90 .section g,"ax",%progbits
94 @ CHECK
: ldr
r0, .Ltmp[[TMP7:[0-9]+]]
96 @ load
a symbol from another section
97 .section h,"ax",%progbits
101 @ CHECK
: ldr
r0, .Ltmp[[TMP8:[0-9]+]]
103 @ load
a symbol from the same section
104 .section i,"ax",%progbits
108 @ CHECK
: ldr
r0, .Ltmp[[TMP9:[0-9]+]]
115 .section j,"ax",%progbits
116 @ mix of symbols
and constants
122 @ CHECK
: ldr
r0, .Ltmp[[TMP10:[0-9]+]]
126 @ CHECK
: ldr
r0, .Ltmp[[TMP11:[0-9]+]]
130 @ Check for correct usage in other contexts
134 .macro useit_in_a_macro
138 .section k,"ax",%progbits
142 @ CHECK
: ldr
r0, .Ltmp[[TMP12:[0-9]+]]
143 @ CHECK
: ldr
r0, .Ltmp[[TMP13:[0-9]+]]
145 @ usage with expressions
146 .section l, "ax", %progbits
150 @ CHECK
: ldr
r0, .Ltmp[[TMP14:[0-9]+]]
153 @ CHECK
: ldr
r0, .Ltmp[[TMP15:[0-9]+]]
156 @ transformation to mov
157 .section m, "ax", %progbits
161 @ Representable in ARM
, and Thumb with support mov.w
or movw
163 @ CHECK-ARM
: mov
r1, #1
164 @ CHECK-ARMV5
: mov
r1, #1
165 @ CHECK-THUMB
: ldr
r1, .Ltmp[[TMP16:[0-9]+]]
166 @ CHECK-THUMB2
: mov.w
r1, #1
167 @ CHECK-BASELINE
: movw
r1, #1
169 @ Immediate is representable in A1
and T2 modified immediate only
not movw
171 @ CHECK-ARM
: mov
r2, #1179648
172 @ CHECK-ARMV5
: mov
r2, #1179648
173 @ CHECK-THUMB
: ldr
r2, .Ltmp[[TMP17:[0-9]+]]
174 @ CHECK-THUMB2
: mov.w
r2, #1179648
175 @ CHECK-BASELINE
: ldr
r2, .Ltmp[[TMP16:[0-9]+]]
177 @ Immediate can
be represented only with movw instruction
179 @ CHECK-ARM
: movw
r3, #4660
180 @ CHECK-ARMV5
: ldr
r3, .Ltmp[[TMP16:[0-9]+]]
181 @ CHECK-THUMB
: ldr
r3, .Ltmp[[TMP18:[0-9]+]]
182 @ CHECK-THUMB2
: movw
r3, #4660
183 @ CHECK-BASELINE
: movw
r3, #4660
185 @ Immediate can
be represented only with T2 modified immediate
187 @ CHECK-ARM
: ldr
r4, .Ltmp[[TMP16:[0-9]+]]
188 @ CHECK-ARMV5
: ldr
r4, .Ltmp[[TMP17:[0-9]+]]
189 @ CHECK-THUMB
: ldr
r4, .Ltmp[[TMP19:[0-9]+]]
190 @ CHECK-THUMB2
: mov.w
r4, #2880154539
191 @ CHECK-BASELINE
: ldr
r4, .Ltmp[[TMP17:[0-9]+]]
193 @ Immediate can
be represented only with A1 modified immediate
195 @ CHECK-ARM
: mov
r5, #268435467
196 @ CHECK-ARMV5
: mov
r5, #268435467
197 @ CHECK-THUMB
: ldr
r5, .Ltmp[[TMP20:[0-9]+]]
198 @ CHECK-THUMB2
: ldr
r5, .Ltmp[[TMP16:[0-9]+]]
199 @ CHECK-BASELINE
: ldr
r5, .Ltmp[[TMP18:[0-9]+]]
201 @ Negative numbers can
be used with MVN
or in Thumb2 with modified immediate
203 @ CHECK-ARM
: mvn
r6, #0
204 @ CHECK-ARMV5
: mvn
r6, #0
205 @ CHECK-THUMB
: ldr
r6, .Ltmp[[TMP21:[0-9]+]]
206 @ CHECK-THUMB2
: mov.w
r6, #-1
207 @ CHECK-BASELINE
: ldr
r6, .Ltmp[[TMP19:[0-9]+]]
209 @ CHECK-ARM
: mvn
r7, #255
210 @ CHECK-ARMV5
: mvn
r7, #255
211 @ CHECK-THUMB
: ldr
r7, .Ltmp[[TMP22:[0-9]+]]
212 @ CHECK-THUMB2
: mvn
r7, #255
213 @ CHECK-BASELINE
: ldr
r7, .Ltmp[[TMP20:[0-9]+]]
215 @ Constant expressions can
be used
216 .equ expr, 0x10 + 0x10
218 @ CHECK-ARM
: mov
r0, #32
219 @ CHECK-ARMV5
: mov
r0, #32
220 @ CHECK-THUMB
: ldr
r0, .Ltmp[[TMP23:[0-9]+]]
221 @ CHECK-THUMB2
: mov.w
r0, #32
222 @ CHECK-BASELINE
: movw
r0, #32
223 ldr
r1, = expr
- 0x10
224 @ CHECK-ARM
: mov
r1, #16
225 @ CHECK-ARMV5
: mov
r1, #16
226 @ CHECK-THUMB
: ldr
r1, .Ltmp[[TMP24:[0-9]+]]
227 @ CHECK-THUMB2
: mov.w
r1, #16
228 @ CHECK-BASELINE
: movw
r1, #16
230 @ usage of translation in macro
231 .macro usemov_in_a_macro
238 @ CHECK-ARM
: mov
r2, #3
239 @ CHECK-ARM
: mov
r3, #32
240 @ CHECK-ARMV5
: mov
r2, #3
241 @ CHECK-ARMV5
: mov
r3, #32
242 @ CHECK-THUMB
: ldr
r2, .Ltmp[[TMP25:[0-9]+]]
243 @ CHECK-THUMB
: ldr
r3, .Ltmp[[TMP26:[0-9]+]]
244 @ CHECK-THUMB2
: mov.w
r2, #3
245 @ CHECK-THUMB2
: mov.w
r3, #32
246 @ CHECK-BASELINE
: movw
r2, #3
247 @ CHECK-BASELINE
: movw
r3, #32
251 @ CHECK
: .section b,"ax",%progbits
253 @ CHECK
: .Ltmp[[TMP0]]
256 @ CHECK
: .section c,"ax",%progbits
258 @ CHECK
: .Ltmp[[TMP1]]
260 @ CHECK
: .Ltmp[[TMP2]]
263 @ CHECK
: .section d,"ax",%progbits
265 @ CHECK
: .Ltmp[[TMP3]]
268 @ CHECK
: .section e,"ax",%progbits
270 @ CHECK
: .Ltmp[[TMP5]]
272 @ CHECK
: .Ltmp[[TMP6]]
275 @ Should
not switch to section because it has no constant pool
276 @ CHECK-
NOT: .section f,"ax",%progbits
278 @ CHECK
: .section g,"ax",%progbits
280 @ CHECK
: .Ltmp[[TMP7]]
283 @ CHECK
: .section h,"ax",%progbits
285 @ CHECK
: .Ltmp[[TMP8]]
288 @ CHECK
: .section i,"ax",%progbits
290 @ CHECK
: .Ltmp[[TMP9]]
293 @ CHECK
: .section j,"ax",%progbits
295 @ CHECK
: .Ltmp[[TMP10]]
297 @ CHECK
: .Ltmp[[TMP11]]
300 @ CHECK
: .section k,"ax",%progbits
302 @ CHECK
: .Ltmp[[TMP12]]
304 @ CHECK
: .Ltmp[[TMP13]]
307 @ CHECK
: .section l,"ax",%progbits
309 @ CHECK
: .Ltmp[[TMP14]]
311 @ CHECK
: .Ltmp[[TMP15]]