1 @ This test has
a partner
(ldr-pseudo.s
) that contains matching
2 @ tests for the ldr-pseudo 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
7 @RUN
: llvm-mc
-triple armv7-base-apple-darwin
%s | FileCheck
--check-prefix
=CHECK-ARM
--check-prefix
=CHECK
%s
8 @RUN
: llvm-mc
-triple armv5-base-apple-darwin
%s | FileCheck
--check-prefix
=CHECK-ARMV5
--check-prefix
=CHECK
%s
9 @RUN
: llvm-mc
-triple thumbv5-base-apple-darwin
%s | FileCheck
--check-prefix
=CHECK-THUMB
--check-prefix
=CHECK
%s
10 @RUN
: llvm-mc
-triple thumbv7-base-apple-darwin
%s | FileCheck
--check-prefix
=CHECK-THUMB2
--check-prefix
=CHECK
%s
11 @RUN
: llvm-mc
-triple thumbv8m.base-base-apple-darwin
%s | FileCheck
--check-prefix
=CHECK-BASELINE
--check-prefix
=CHECK
%s
13 @ Check that large constants are converted to ldr from constant pool
16 .section __TEXT,b,regular,pure_instructions
20 @ CHECK
: ldr
r0, Ltmp0
22 @ loading multiple constants
23 .section __TEXT,c,regular,pure_instructions
27 @ CHECK
: ldr
r0, Ltmp1
33 @ CHECK
: ldr
r0, Ltmp2
37 @ TODO
: the same constants should have the same constant pool location
38 .section __TEXT,d,regular,pure_instructions
42 @ CHECK
: ldr
r0, Ltmp3
51 @ CHECK
: ldr
r0, Ltmp3
59 @
a section defined in multiple pieces should
be merged
and use
a single constant pool
60 .section __TEXT,e,regular,pure_instructions
64 @ CHECK
: ldr
r0, Ltmp4
69 .section __TEXT,f,regular,pure_instructions
76 .section __TEXT,e,regular,pure_instructions
81 @ CHECK
: ldr
r0, Ltmp5
86 @ Check that symbols can
be loaded using ldr pseudo
89 @ load an undefined symbol
90 .section __TEXT,g,regular,pure_instructions
94 @ CHECK
: ldr
r0, Ltmp6
96 @ load
a symbol from another section
97 .section __TEXT,h,regular,pure_instructions
101 @ CHECK
: ldr
r0, Ltmp7
103 @ load
a symbol from the same section
104 .section __TEXT,i,regular,pure_instructions
108 @ CHECK
: ldr
r0, Ltmp8
115 .section __TEXT,j,regular,pure_instructions
116 @ mix of symbols
and constants
122 @ CHECK
: ldr
r0, Ltmp9
126 @ CHECK
: ldr
r0, Ltmp10
130 @ Check for correct usage in other contexts
134 .macro useit_in_a_macro
138 .section __TEXT,k,regular,pure_instructions
142 @ CHECK
: ldr
r0, Ltmp11
143 @ CHECK
: ldr
r0, Ltmp12
145 @ usage with expressions
146 .section __TEXT,l,regular,pure_instructions
150 @ CHECK
: ldr
r0, Ltmp13
153 @ CHECK
: ldr
r0, Ltmp14
156 @ transformation to mov
157 .section __TEXT,m,regular,pure_instructions
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, Ltmp15
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, Ltmp16
174 @ CHECK-THUMB2
: mov.w
r2, #1179648
175 @ CHECK-BASELINE
: ldr
r2, Ltmp15
177 @ Immediate can
be represented only with movw instruction
179 @ CHECK-ARM
: movw
r3, #4660
180 @ CHECK-ARMV5
: ldr
r3, Ltmp15
181 @ CHECK-THUMB
: ldr
r3, Ltmp17
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, Ltmp15
188 @ CHECK-ARMV5
: ldr
r4, Ltmp16
189 @ CHECK-THUMB
: ldr
r4, Ltmp18
190 @ CHECK-THUMB2
: mov.w
r4, #2880154539
191 @ CHECK-BASELINE
: ldr
r4, Ltmp16
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, Ltmp19
198 @ CHECK-THUMB2
: ldr
r5, Ltmp15
199 @ CHECK-BASELINE
: ldr
r5, Ltmp17
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, Ltmp20
206 @ CHECK-THUMB2
: mov.w
r6, #-1
207 @ CHECK-BASELINE
: ldr
r6, Ltmp18
209 @ CHECK-ARM
: mvn
r7, #255
210 @ CHECK-ARMV5
: mvn
r7, #255
211 @ CHECK-THUMB
: ldr
r7, Ltmp21
212 @ CHECK-THUMB2
: mvn
r7, #255
213 @ CHECK-BASELINE
: ldr
r7, Ltmp19
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, Ltmp22
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, Ltmp23
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, Ltmp24
243 @ CHECK-THUMB
: ldr
r3, Ltmp22
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 __TEXT,b,regular,pure_instructions
252 @ CHECK
: .data_region
254 @ CHECK-LABEL
: Ltmp0
:
256 @ CHECK
: .end_data_region
258 @ CHECK
: .section __TEXT,c,regular,pure_instructions
259 @ CHECK
: .data_region
261 @ CHECK-LABEL
: Ltmp1
:
264 @ CHECK-LABEL
: Ltmp2
:
266 @ CHECK
: .end_data_region
268 @ CHECK
: .section __TEXT,d,regular,pure_instructions
269 @ CHECK
: .data_region
271 @ CHECK-LABEL
: Ltmp3
:
273 @ CHECK
: .end_data_region
275 @ CHECK
: .section __TEXT,e,regular,pure_instructions
276 @ CHECK
: .data_region
278 @ CHECK-LABEL
: Ltmp4
:
281 @ CHECK-LABEL
: Ltmp5
:
283 @ CHECK
: .end_data_region
285 @ Should
not switch to section because it has no constant pool
286 @ CHECK-
NOT: .section __TEXT,f,regular,pure_instructions
288 @ CHECK
: .section __TEXT,g,regular,pure_instructions
289 @ CHECK
: .data_region
291 @ CHECK-LABEL
: Ltmp6
:
293 @ CHECK
: .end_data_region
295 @ CHECK
: .section __TEXT,h,regular,pure_instructions
296 @ CHECK
: .data_region
298 @ CHECK-LABEL
: Ltmp7
:
300 @ CHECK
: .end_data_region
302 @ CHECK
: .section __TEXT,i,regular,pure_instructions
303 @ CHECK
: .data_region
305 @ CHECK-LABEL
: Ltmp8
:
307 @ CHECK
: .end_data_region
309 @ CHECK
: .section __TEXT,j,regular,pure_instructions
310 @ CHECK
: .data_region
312 @ CHECK-LABEL
: Ltmp9
:
315 @ CHECK-LABEL
: Ltmp10
:
317 @ CHECK
: .end_data_region
319 @ CHECK
: .section __TEXT,k,regular,pure_instructions
320 @ CHECK
: .data_region
322 @ CHECK-LABEL
: Ltmp11
:
325 @ CHECK-LABEL
: Ltmp12
:
327 @ CHECK
: .end_data_region
329 @ CHECK
: .section __TEXT,l,regular,pure_instructions
330 @ CHECK
: .data_region
332 @ CHECK-LABEL
: Ltmp13
:
335 @ CHECK-LABEL
: Ltmp14
:
337 @ CHECK
: .end_data_region