1 //RUN
: llvm-mc
-triple
=aarch64-linux-gnu
-print-imm-hex
%s | FileCheck
%s
4 // Check that large constants are converted to ldr from constant pool
7 .section a, "ax", @progbits
11 // CHECK
: mov x0
, #0x1234
13 // CHECK
: mov w1
, #0x4567
15 // CHECK
: mov x0
, #0x12340000
17 // CHECK
: mov w1
, #0x45670000
18 ldr x0
, =0xabc00000000
19 // CHECK
: mov x0
, #0xabc00000000
20 ldr x0
, =0xbeef000000000000
21 // CHECK
: mov x0
, #-0x4111000000000000
23 .section b,"ax",@progbits
27 // CHECK
: ldr w0
, .Ltmp[[TMP0:[0-9]+]]
29 // loading multiple constants
30 .section c,"ax",@progbits
34 // CHECK
: ldr w0
, .Ltmp[[TMP1:[0-9]+]]
40 // CHECK
: ldr w0
, .Ltmp[[TMP2:[0-9]+]]
44 // TODO
: the same constants should have the same constant pool location
45 .section d,"ax",@progbits
49 // CHECK
: ldr w0
, .Ltmp[[TMP3:[0-9]+]]
58 // CHECK
: ldr w0
, .Ltmp[[TMP3:[0-9]+]]
66 // a section defined in multiple pieces should
be merged
and use
a single constant pool
67 .section e,"ax",@progbits
71 // CHECK
: ldr w0
, .Ltmp[[TMP5:[0-9]+]]
76 .section f, "ax", @progbits
83 .section e, "ax", @progbits
88 // CHECK
: ldr w0
, .Ltmp[[TMP6:[0-9]+]]
93 // Check that symbols can
be loaded using ldr pseudo
96 // load an undefined symbol
97 .section g,"ax",@progbits
101 // CHECK
: ldr w0
, .Ltmp[[TMP7:[0-9]+]]
103 // load
a symbol from another section
104 .section h,"ax",@progbits
108 // CHECK
: ldr w0
, .Ltmp[[TMP8:[0-9]+]]
110 // load
a symbol from the same section
111 .section i,"ax",@progbits
115 // CHECK
: ldr w0
, .Ltmp[[TMP9:[0-9]+]]
117 // CHECK
: ldr w0
, .Ltmp[[TMP10:[0-9]+]]
124 .section j,"ax",@progbits
125 // mix of symbols
and constants
131 // CHECK
: mov w0
, #0x101
135 // CHECK
: ldr w0
, .Ltmp[[TMP11:[0-9]+]]
139 // Check for correct usage in other contexts
143 .macro useit_in_a_macro
147 .section k,"ax",@progbits
151 // CHECK
: ldr w0
, .Ltmp[[TMP12:[0-9]+]]
152 // CHECK
: ldr w0
, .Ltmp[[TMP13:[0-9]+]]
154 // usage with expressions
155 .section l, "ax", @progbits
159 // CHECK
: ldr w0
, .Ltmp[[TMP14:[0-9]+]]
162 // CHECK
: ldr w0
, .Ltmp[[TMP15:[0-9]+]]
165 // usage with
64-bit regs
166 .section m, "ax", @progbits
169 ldr x0
, =0x0102030405060708
170 // CHECK
: ldr x0
, .Ltmp[[TMP16:[0-9]+]]
173 // CHECK
: ldr w0
, .Ltmp[[TMP17:[0-9]+]]
175 // CHECK
: ldr x0
, .Ltmp[[TMP18:[0-9]+]]
178 // CHECK
: ldr x0
, .Ltmp[[TMP19:[0-9]+]]
180 // CHECK
: ldr x1
, .Ltmp[[TMP20:[0-9]+]]
182 // CHECK
: ldr x2
, .Ltmp[[TMP21:[0-9]+]]
184 // check range for
32-bit regs
185 .section n, "ax", @progbits
189 // CHECK
: ldr w0
, .Ltmp[[TMP22:[0-9]+]]
192 // CHECK
: ldr w1
, .Ltmp[[TMP23:[0-9]+]]
195 // CHECK
: ldr w0
, .Ltmp[[TMP24:[0-9]+]]
198 // make sure the same contant uses different pools for
32- and 64-bit registers
199 .section o, "ax", @progbits
203 // CHECK
: ldr w0
, .Ltmp[[TMP25:[0-9]+]]
206 // CHECK
: ldr x1
, .Ltmp[[TMP26:[0-9]+]]
208 // We previously used
a DenseMap with constant values as keys
, check that
209 // sentinel values can
be used.
210 ldr x0
, =0x7ffffffffffffffe
211 // CHECK
: ldr x0
, .Ltmp[[TMP27:[0-9]+]]
212 ldr x1
, =0x7fffffffffffffff
213 // CHECK
: ldr x1
, .Ltmp[[TMP28:[0-9]+]]
218 // CHECK
: .section b,"ax",@progbits
220 // CHECK
: .Ltmp[[TMP0]]
221 // CHECK
: .word 65537
223 // CHECK
: .section c,"ax",@progbits
225 // CHECK
: .Ltmp[[TMP1]]
226 // CHECK
: .word 65538
228 // CHECK
: .Ltmp[[TMP2]]
229 // CHECK
: .word 65539
231 // CHECK
: .section d,"ax",@progbits
233 // CHECK
: .Ltmp[[TMP3]]
234 // CHECK
: .word 65540
236 // CHECK
: .section e,"ax",@progbits
238 // CHECK
: .Ltmp[[TMP5]]
239 // CHECK
: .word 65542
241 // CHECK
: .Ltmp[[TMP6]]
242 // CHECK
: .word 65543
244 // Should
not switch to section because it has no constant pool
245 // CHECK-
NOT: .section f,"ax",@progbits
247 // CHECK
: .section g,"ax",@progbits
249 // CHECK
: .Ltmp[[TMP7]]
252 // CHECK
: .section h,"ax",@progbits
254 // CHECK
: .Ltmp[[TMP8]]
257 // CHECK
: .section i,"ax",@progbits
259 // CHECK
: .Ltmp[[TMP9]]
262 // CHECK
: .Ltmp[[TMP10]]
263 // CHECK
: .word 245760
265 // CHECK
: .section j,"ax",@progbits
267 // CHECK
: .Ltmp[[TMP11]]
270 // CHECK
: .section k,"ax",@progbits
272 // CHECK
: .Ltmp[[TMP12]]
273 // CHECK
: .word 65544
275 // CHECK
: .Ltmp[[TMP13]]
278 // CHECK
: .section l,"ax",@progbits
280 // CHECK
: .Ltmp[[TMP14]]
281 // CHECK
: .word 65545
283 // CHECK
: .Ltmp[[TMP15]]
284 // CHECK
: .word bar+4
286 // CHECK
: .section m,"ax",@progbits
288 // CHECK
: .Ltmp[[TMP16]]
289 // CHECK
: .xword 72623859790382856
291 // CHECK
: .Ltmp[[TMP17]]
294 // CHECK
: .Ltmp[[TMP18]]
295 // CHECK
: .xword bar+16
297 // CHECK
: .Ltmp[[TMP19]]
298 // CHECK
: .xword 4294967297
300 // CHECK
: .Ltmp[[TMP20]]
301 // CHECK
: .xword -2147483649
303 // CHECK
: .Ltmp[[TMP21]]
304 // CHECK
: .xword 65537
306 // CHECK
: .section n,"ax",@progbits
308 // CHECK
: .Ltmp[[TMP22]]
309 // CHECK
: .word 4294967295
311 // CHECK
: .Ltmp[[TMP23]]
312 // CHECK
: .word -2147483647
314 // CHECK
: .Ltmp[[TMP24]]
317 // CHECK
: .section o,"ax",@progbits
319 // CHECK
: .Ltmp[[TMP25]]
320 // CHECK
: .word 3276900
322 // CHECK
: .Ltmp[[TMP27]]
323 // CHECK
: .xword 9223372036854775806
324 // CHECK
: .Ltmp[[TMP28]]
325 // CHECK
: .xword 9223372036854775807