1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=aarch64-- -run-pass=instruction-select -verify-machineinstrs %s -o - | FileCheck %s
5 target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
7 define void @load_s64_gpr(i64* %addr) { ret void }
8 define void @load_s32_gpr(i32* %addr) { ret void }
9 define void @load_s16_gpr_anyext(i16* %addr) { ret void }
10 define void @load_s16_gpr(i16* %addr) { ret void }
11 define void @load_s8_gpr_anyext(i8* %addr) { ret void }
12 define void @load_s8_gpr(i8* %addr) { ret void }
14 define void @load_fi_s64_gpr() {
19 define void @load_gep_128_s64_gpr(i64* %addr) { ret void }
20 define void @load_gep_512_s32_gpr(i32* %addr) { ret void }
21 define void @load_gep_64_s16_gpr(i16* %addr) { ret void }
22 define void @load_gep_1_s8_gpr(i8* %addr) { ret void }
24 define void @load_s64_fpr(i64* %addr) { ret void }
25 define void @load_s32_fpr(i32* %addr) { ret void }
26 define void @load_s16_fpr(i16* %addr) { ret void }
27 define void @load_s8_fpr(i8* %addr) { ret void }
29 define void @load_gep_8_s64_fpr(i64* %addr) { ret void }
30 define void @load_gep_16_s32_fpr(i32* %addr) { ret void }
31 define void @load_gep_64_s16_fpr(i16* %addr) { ret void }
32 define void @load_gep_32_s8_fpr(i8* %addr) { ret void }
34 define void @load_v2s32(i64 *%addr) { ret void }
43 - { id: 0, class: gpr }
44 - { id: 1, class: gpr }
50 ; CHECK-LABEL: name: load_s64_gpr
51 ; CHECK: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
52 ; CHECK: [[LDRXui:%[0-9]+]]:gpr64 = LDRXui [[COPY]], 0 :: (load 8 from %ir.addr)
53 ; CHECK: $x0 = COPY [[LDRXui]]
55 %1(s64) = G_LOAD %0 :: (load 8 from %ir.addr)
65 - { id: 0, class: gpr }
66 - { id: 1, class: gpr }
72 ; CHECK-LABEL: name: load_s32_gpr
73 ; CHECK: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
74 ; CHECK: [[LDRWui:%[0-9]+]]:gpr32 = LDRWui [[COPY]], 0 :: (load 4 from %ir.addr)
75 ; CHECK: $w0 = COPY [[LDRWui]]
77 %1(s32) = G_LOAD %0 :: (load 4 from %ir.addr)
82 name: load_s16_gpr_anyext
90 ; CHECK-LABEL: name: load_s16_gpr_anyext
91 ; CHECK: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
92 ; CHECK: [[LDRHHui:%[0-9]+]]:gpr32 = LDRHHui [[COPY]], 0 :: (load 2 from %ir.addr)
93 ; CHECK: $w0 = COPY [[LDRHHui]]
95 %1:gpr(s32) = G_LOAD %0 :: (load 2 from %ir.addr)
102 regBankSelected: true
105 - { id: 0, class: gpr }
106 - { id: 1, class: gpr }
112 ; CHECK-LABEL: name: load_s16_gpr
113 ; CHECK: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
114 ; CHECK: [[LDRHHui:%[0-9]+]]:gpr32 = LDRHHui [[COPY]], 0 :: (load 2 from %ir.addr)
115 ; CHECK: [[T0:%[0-9]+]]:gpr32all = COPY [[LDRHHui]]
116 ; CHECK: $w0 = COPY [[T0]]
118 %1(s16) = G_LOAD %0 :: (load 2 from %ir.addr)
119 %2:gpr(s32) = G_ANYEXT %1
124 name: load_s8_gpr_anyext
126 regBankSelected: true
132 ; CHECK-LABEL: name: load_s8_gpr
133 ; CHECK: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
134 ; CHECK: [[LDRBBui:%[0-9]+]]:gpr32 = LDRBBui [[COPY]], 0 :: (load 1 from %ir.addr)
135 ; CHECK: $w0 = COPY [[LDRBBui]]
136 %0:gpr(p0) = COPY $x0
137 %1:gpr(s32) = G_LOAD %0 :: (load 1 from %ir.addr)
144 regBankSelected: true
147 - { id: 0, class: gpr }
148 - { id: 1, class: gpr }
154 ; CHECK-LABEL: name: load_s8_gpr
155 ; CHECK: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
156 ; CHECK: [[LDRBBui:%[0-9]+]]:gpr32 = LDRBBui [[COPY]], 0 :: (load 1 from %ir.addr)
157 ; CHECK: [[T0:%[0-9]+]]:gpr32all = COPY [[LDRBBui]]
158 ; CHECK: $w0 = COPY [[T0]]
160 %1(s8) = G_LOAD %0 :: (load 1 from %ir.addr)
161 %2:gpr(s32) = G_ANYEXT %1
166 name: load_fi_s64_gpr
168 regBankSelected: true
171 - { id: 0, class: gpr }
172 - { id: 1, class: gpr }
175 - { id: 0, name: ptr0, offset: 0, size: 8, alignment: 8 }
181 ; CHECK-LABEL: name: load_fi_s64_gpr
182 ; CHECK: [[LDRXui:%[0-9]+]]:gpr64 = LDRXui %stack.0.ptr0, 0 :: (load 8)
183 ; CHECK: $x0 = COPY [[LDRXui]]
184 %0(p0) = G_FRAME_INDEX %stack.0.ptr0
185 %1(s64) = G_LOAD %0 :: (load 8)
190 name: load_gep_128_s64_gpr
192 regBankSelected: true
195 - { id: 0, class: gpr }
196 - { id: 1, class: gpr }
197 - { id: 2, class: gpr }
198 - { id: 3, class: gpr }
204 ; CHECK-LABEL: name: load_gep_128_s64_gpr
205 ; CHECK: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
206 ; CHECK: [[LDRXui:%[0-9]+]]:gpr64 = LDRXui [[COPY]], 16 :: (load 8 from %ir.addr)
207 ; CHECK: $x0 = COPY [[LDRXui]]
209 %1(s64) = G_CONSTANT i64 128
210 %2(p0) = G_GEP %0, %1
211 %3(s64) = G_LOAD %2 :: (load 8 from %ir.addr)
216 name: load_gep_512_s32_gpr
218 regBankSelected: true
221 - { id: 0, class: gpr }
222 - { id: 1, class: gpr }
223 - { id: 2, class: gpr }
224 - { id: 3, class: gpr }
230 ; CHECK-LABEL: name: load_gep_512_s32_gpr
231 ; CHECK: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
232 ; CHECK: [[LDRWui:%[0-9]+]]:gpr32 = LDRWui [[COPY]], 128 :: (load 4 from %ir.addr)
233 ; CHECK: $w0 = COPY [[LDRWui]]
235 %1(s64) = G_CONSTANT i64 512
236 %2(p0) = G_GEP %0, %1
237 %3(s32) = G_LOAD %2 :: (load 4 from %ir.addr)
242 name: load_gep_64_s16_gpr
244 regBankSelected: true
247 - { id: 0, class: gpr }
248 - { id: 1, class: gpr }
249 - { id: 2, class: gpr }
250 - { id: 3, class: gpr }
256 ; CHECK-LABEL: name: load_gep_64_s16_gpr
257 ; CHECK: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
258 ; CHECK: [[LDRHHui:%[0-9]+]]:gpr32 = LDRHHui [[COPY]], 32 :: (load 2 from %ir.addr)
259 ; CHECK: [[T0:%[0-9]+]]:gpr32all = COPY [[LDRHHui]]
260 ; CHECK: $w0 = COPY [[T0]]
262 %1(s64) = G_CONSTANT i64 64
263 %2(p0) = G_GEP %0, %1
264 %3(s16) = G_LOAD %2 :: (load 2 from %ir.addr)
265 %4:gpr(s32) = G_ANYEXT %3
270 name: load_gep_1_s8_gpr
272 regBankSelected: true
275 - { id: 0, class: gpr }
276 - { id: 1, class: gpr }
277 - { id: 2, class: gpr }
278 - { id: 3, class: gpr }
284 ; CHECK-LABEL: name: load_gep_1_s8_gpr
285 ; CHECK: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
286 ; CHECK: [[LDRBBui:%[0-9]+]]:gpr32 = LDRBBui [[COPY]], 1 :: (load 1 from %ir.addr)
287 ; CHECK: [[T0:%[0-9]+]]:gpr32all = COPY [[LDRBBui]]
288 ; CHECK: $w0 = COPY [[T0]]
290 %1(s64) = G_CONSTANT i64 1
291 %2(p0) = G_GEP %0, %1
292 %3(s8) = G_LOAD %2 :: (load 1 from %ir.addr)
293 %4:gpr(s32) = G_ANYEXT %3
300 regBankSelected: true
303 - { id: 0, class: gpr }
304 - { id: 1, class: fpr }
310 ; CHECK-LABEL: name: load_s64_fpr
311 ; CHECK: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
312 ; CHECK: [[LDRDui:%[0-9]+]]:fpr64 = LDRDui [[COPY]], 0 :: (load 8 from %ir.addr)
313 ; CHECK: $d0 = COPY [[LDRDui]]
315 %1(s64) = G_LOAD %0 :: (load 8 from %ir.addr)
322 regBankSelected: true
325 - { id: 0, class: gpr }
326 - { id: 1, class: fpr }
332 ; CHECK-LABEL: name: load_s32_fpr
333 ; CHECK: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
334 ; CHECK: [[LDRSui:%[0-9]+]]:fpr32 = LDRSui [[COPY]], 0 :: (load 4 from %ir.addr)
335 ; CHECK: $s0 = COPY [[LDRSui]]
337 %1(s32) = G_LOAD %0 :: (load 4 from %ir.addr)
344 regBankSelected: true
347 - { id: 0, class: gpr }
348 - { id: 1, class: fpr }
354 ; CHECK-LABEL: name: load_s16_fpr
355 ; CHECK: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
356 ; CHECK: [[LDRHui:%[0-9]+]]:fpr16 = LDRHui [[COPY]], 0 :: (load 2 from %ir.addr)
357 ; CHECK: $h0 = COPY [[LDRHui]]
359 %1(s16) = G_LOAD %0 :: (load 2 from %ir.addr)
366 regBankSelected: true
369 - { id: 0, class: gpr }
370 - { id: 1, class: fpr }
376 ; CHECK-LABEL: name: load_s8_fpr
377 ; CHECK: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
378 ; CHECK: [[LDRBui:%[0-9]+]]:fpr8 = LDRBui [[COPY]], 0 :: (load 1 from %ir.addr)
379 ; CHECK: $b0 = COPY [[LDRBui]]
381 %1(s8) = G_LOAD %0 :: (load 1 from %ir.addr)
386 name: load_gep_8_s64_fpr
388 regBankSelected: true
391 - { id: 0, class: gpr }
392 - { id: 1, class: gpr }
393 - { id: 2, class: gpr }
394 - { id: 3, class: fpr }
400 ; CHECK-LABEL: name: load_gep_8_s64_fpr
401 ; CHECK: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
402 ; CHECK: [[LDRDui:%[0-9]+]]:fpr64 = LDRDui [[COPY]], 1 :: (load 8 from %ir.addr)
403 ; CHECK: $d0 = COPY [[LDRDui]]
405 %1(s64) = G_CONSTANT i64 8
406 %2(p0) = G_GEP %0, %1
407 %3(s64) = G_LOAD %2 :: (load 8 from %ir.addr)
412 name: load_gep_16_s32_fpr
414 regBankSelected: true
417 - { id: 0, class: gpr }
418 - { id: 1, class: gpr }
419 - { id: 2, class: gpr }
420 - { id: 3, class: fpr }
426 ; CHECK-LABEL: name: load_gep_16_s32_fpr
427 ; CHECK: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
428 ; CHECK: [[LDRSui:%[0-9]+]]:fpr32 = LDRSui [[COPY]], 4 :: (load 4 from %ir.addr)
429 ; CHECK: $s0 = COPY [[LDRSui]]
431 %1(s64) = G_CONSTANT i64 16
432 %2(p0) = G_GEP %0, %1
433 %3(s32) = G_LOAD %2 :: (load 4 from %ir.addr)
438 name: load_gep_64_s16_fpr
440 regBankSelected: true
443 - { id: 0, class: gpr }
444 - { id: 1, class: gpr }
445 - { id: 2, class: gpr }
446 - { id: 3, class: fpr }
452 ; CHECK-LABEL: name: load_gep_64_s16_fpr
453 ; CHECK: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
454 ; CHECK: [[LDRHui:%[0-9]+]]:fpr16 = LDRHui [[COPY]], 32 :: (load 2 from %ir.addr)
455 ; CHECK: $h0 = COPY [[LDRHui]]
457 %1(s64) = G_CONSTANT i64 64
458 %2(p0) = G_GEP %0, %1
459 %3(s16) = G_LOAD %2 :: (load 2 from %ir.addr)
464 name: load_gep_32_s8_fpr
466 regBankSelected: true
469 - { id: 0, class: gpr }
470 - { id: 1, class: gpr }
471 - { id: 2, class: gpr }
472 - { id: 3, class: fpr }
478 ; CHECK-LABEL: name: load_gep_32_s8_fpr
479 ; CHECK: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
480 ; CHECK: [[LDRBui:%[0-9]+]]:fpr8 = LDRBui [[COPY]], 32 :: (load 1 from %ir.addr)
481 ; CHECK: $b0 = COPY [[LDRBui]]
483 %1(s64) = G_CONSTANT i64 32
484 %2(p0) = G_GEP %0, %1
485 %3(s8) = G_LOAD %2 :: (load 1 from %ir.addr)
491 regBankSelected: true
494 - { id: 0, class: gpr }
495 - { id: 1, class: fpr }
501 ; CHECK-LABEL: name: load_v2s32
502 ; CHECK: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
503 ; CHECK: [[LDRDui:%[0-9]+]]:fpr64 = LDRDui [[COPY]], 0 :: (load 8 from %ir.addr)
504 ; CHECK: $d0 = COPY [[LDRDui]]
506 %1(<2 x s32>) = G_LOAD %0 :: (load 8 from %ir.addr)
507 $d0 = COPY %1(<2 x s32>)