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
4 # GPR variants should not use INSERT_SUBREG. FPR variants (DUP<ty>lane) should.
11 tracksRegLiveness: true
15 ; CHECK-LABEL: name: DUPv4i32gpr
17 ; CHECK: %copy:gpr32 = COPY $w0
18 ; CHECK: %dup:fpr128 = DUPv4i32gpr %copy
19 ; CHECK: $q0 = COPY %dup
20 ; CHECK: RET_ReallyLR implicit $q0
21 %copy:gpr(s32) = COPY $w0
22 %dup:fpr(<4 x s32>) = G_DUP %copy(s32)
23 $q0 = COPY %dup(<4 x s32>)
24 RET_ReallyLR implicit $q0
32 tracksRegLiveness: true
36 ; CHECK-LABEL: name: DUPv2i64gpr
38 ; CHECK: %copy:gpr64 = COPY $x0
39 ; CHECK: %dup:fpr128 = DUPv2i64gpr %copy
40 ; CHECK: $q0 = COPY %dup
41 ; CHECK: RET_ReallyLR implicit $q0
42 %copy:gpr(s64) = COPY $x0
43 %dup:fpr(<2 x s64>) = G_DUP %copy(s64)
44 $q0 = COPY %dup(<2 x s64>)
45 RET_ReallyLR implicit $q0
53 tracksRegLiveness: true
57 ; CHECK-LABEL: name: DUPv2i32gpr
59 ; CHECK: %copy:gpr32 = COPY $w0
60 ; CHECK: %dup:fpr64 = DUPv2i32gpr %copy
61 ; CHECK: $d0 = COPY %dup
62 ; CHECK: RET_ReallyLR implicit $d0
63 %copy:gpr(s32) = COPY $w0
64 %dup:fpr(<2 x s32>) = G_DUP %copy(s32)
65 $d0 = COPY %dup(<2 x s32>)
66 RET_ReallyLR implicit $d0
74 tracksRegLiveness: true
79 ; CHECK-LABEL: name: DUPv4i32lane
81 ; CHECK: %copy:fpr32 = COPY $s0
82 ; CHECK: [[DEF:%[0-9]+]]:fpr128 = IMPLICIT_DEF
83 ; CHECK: [[INSERT_SUBREG:%[0-9]+]]:fpr128 = INSERT_SUBREG [[DEF]], %copy, %subreg.ssub
84 ; CHECK: %dup:fpr128 = DUPv4i32lane [[INSERT_SUBREG]], 0
85 ; CHECK: $q0 = COPY %dup
86 ; CHECK: RET_ReallyLR implicit $q0
87 %copy:fpr(s32) = COPY $s0
88 %dup:fpr(<4 x s32>) = G_DUP %copy(s32)
89 $q0 = COPY %dup(<4 x s32>)
90 RET_ReallyLR implicit $q0
98 tracksRegLiveness: true
102 ; CHECK-LABEL: name: DUPv2i64lane
103 ; CHECK: liveins: $d0
104 ; CHECK: %copy:fpr64 = COPY $d0
105 ; CHECK: [[DEF:%[0-9]+]]:fpr128 = IMPLICIT_DEF
106 ; CHECK: [[INSERT_SUBREG:%[0-9]+]]:fpr128 = INSERT_SUBREG [[DEF]], %copy, %subreg.dsub
107 ; CHECK: %dup:fpr128 = DUPv2i64lane [[INSERT_SUBREG]], 0
108 ; CHECK: $q0 = COPY %dup
109 ; CHECK: RET_ReallyLR implicit $q0
110 %copy:fpr(s64) = COPY $d0
111 %dup:fpr(<2 x s64>) = G_DUP %copy(s64)
112 $q0 = COPY %dup(<2 x s64>)
113 RET_ReallyLR implicit $q0
120 regBankSelected: true
121 tracksRegLiveness: true
125 ; CHECK-LABEL: name: DUPv2i32lane
126 ; CHECK: liveins: $s0
127 ; CHECK: %copy:fpr32 = COPY $s0
128 ; CHECK: [[DEF:%[0-9]+]]:fpr128 = IMPLICIT_DEF
129 ; CHECK: [[INSERT_SUBREG:%[0-9]+]]:fpr128 = INSERT_SUBREG [[DEF]], %copy, %subreg.ssub
130 ; CHECK: %dup:fpr64 = DUPv2i32lane [[INSERT_SUBREG]], 0
131 ; CHECK: $d0 = COPY %dup
132 ; CHECK: RET_ReallyLR implicit $d0
133 %copy:fpr(s32) = COPY $s0
134 %dup:fpr(<2 x s32>) = G_DUP %copy(s32)
135 $d0 = COPY %dup(<2 x s32>)
136 RET_ReallyLR implicit $d0
144 regBankSelected: true
145 tracksRegLiveness: true
149 ; CHECK-LABEL: name: DUPv4i16lane
150 ; CHECK: liveins: $h0
151 ; CHECK: %copy:fpr16 = COPY $h0
152 ; CHECK: [[DEF:%[0-9]+]]:fpr128 = IMPLICIT_DEF
153 ; CHECK: [[INSERT_SUBREG:%[0-9]+]]:fpr128 = INSERT_SUBREG [[DEF]], %copy, %subreg.hsub
154 ; CHECK: %dup:fpr64 = DUPv4i16lane [[INSERT_SUBREG]], 0
155 ; CHECK: $d0 = COPY %dup
156 ; CHECK: RET_ReallyLR implicit $d0
157 %copy:fpr(s16) = COPY $h0
158 %dup:fpr(<4 x s16>) = G_DUP %copy(s16)
159 $d0 = COPY %dup(<4 x s16>)
160 RET_ReallyLR implicit $d0
166 regBankSelected: true
167 tracksRegLiveness: true
171 ; CHECK-LABEL: name: DUPv4i16gpr
172 ; CHECK: liveins: $w0
173 ; CHECK: %copy:gpr32 = COPY $w0
174 ; CHECK: %dup:fpr64 = DUPv4i16gpr %copy
175 ; CHECK: $d0 = COPY %dup
176 ; CHECK: RET_ReallyLR implicit $d0
177 %copy:gpr(s32) = COPY $w0
178 %dup:fpr(<4 x s16>) = G_DUP %copy(s32)
179 $d0 = COPY %dup(<4 x s16>)
180 RET_ReallyLR implicit $d0
187 regBankSelected: true
188 tracksRegLiveness: true
192 ; CHECK-LABEL: name: DUPv8i16lane
193 ; CHECK: liveins: $h0
194 ; CHECK: %copy:fpr16 = COPY $h0
195 ; CHECK: [[DEF:%[0-9]+]]:fpr128 = IMPLICIT_DEF
196 ; CHECK: [[INSERT_SUBREG:%[0-9]+]]:fpr128 = INSERT_SUBREG [[DEF]], %copy, %subreg.hsub
197 ; CHECK: %dup:fpr128 = DUPv8i16lane [[INSERT_SUBREG]], 0
198 ; CHECK: $q0 = COPY %dup
199 ; CHECK: RET_ReallyLR implicit $q0
200 %copy:fpr(s16) = COPY $h0
201 %dup:fpr(<8 x s16>) = G_DUP %copy(s16)
202 $q0 = COPY %dup(<8 x s16>)
203 RET_ReallyLR implicit $q0
210 regBankSelected: true
211 tracksRegLiveness: true
215 ; CHECK-LABEL: name: DUPv8i16gpr
216 ; CHECK: liveins: $w0
217 ; CHECK: %copy:gpr32 = COPY $w0
218 ; CHECK: %dup:fpr128 = DUPv8i16gpr %copy
219 ; CHECK: $q0 = COPY %dup
220 ; CHECK: RET_ReallyLR implicit $q0
221 %copy:gpr(s32) = COPY $w0
222 %dup:fpr(<8 x s16>) = G_DUP %copy(s32)
223 $q0 = COPY %dup(<8 x s16>)
224 RET_ReallyLR implicit $q0
228 name: DUPv8i16gpr_s16_src
231 regBankSelected: true
232 tracksRegLiveness: true
236 ; Checks that we can still select the gpr variant if the scalar is an s16.
237 ; CHECK-LABEL: name: DUPv8i16gpr_s16_src
238 ; CHECK: liveins: $w0
239 ; CHECK: %copy:gpr32 = COPY $w0
240 ; CHECK: %dup:fpr128 = DUPv8i16gpr %copy
241 ; CHECK: $q0 = COPY %dup
242 ; CHECK: RET_ReallyLR implicit $q0
243 %copy:gpr(s32) = COPY $w0
244 %trunc:gpr(s16) = G_TRUNC %copy
245 %dup:fpr(<8 x s16>) = G_DUP %trunc(s16)
246 $q0 = COPY %dup(<8 x s16>)
247 RET_ReallyLR implicit $q0
251 name: DUPv4s16gpr_s16_src
254 regBankSelected: true
255 tracksRegLiveness: true
259 ; CHECK-LABEL: name: DUPv4s16gpr_s16_src
260 ; CHECK: liveins: $w0
261 ; CHECK: %copy:gpr32 = COPY $w0
262 ; CHECK: %dup:fpr64 = DUPv4i16gpr %copy
263 ; CHECK: $d0 = COPY %dup
264 ; CHECK: RET_ReallyLR implicit $d0
265 %copy:gpr(s32) = COPY $w0
266 %trunc:gpr(s16) = G_TRUNC %copy
267 %dup:fpr(<4 x s16>) = G_DUP %trunc(s16)
268 $d0 = COPY %dup(<4 x s16>)
269 RET_ReallyLR implicit $d0
276 regBankSelected: true
277 tracksRegLiveness: true
281 ; CHECK-LABEL: name: DUPv8i8gpr
282 ; CHECK: liveins: $w0
283 ; CHECK: %copy:gpr32 = COPY $w0
284 ; CHECK: %dup:fpr64 = DUPv8i8gpr %copy
285 ; CHECK: $d0 = COPY %dup
286 ; CHECK: RET_ReallyLR implicit $d0
287 %copy:gpr(s32) = COPY $w0
288 %dup:fpr(<8 x s8>) = G_DUP %copy(s32)
289 $d0 = COPY %dup(<8 x s8>)
290 RET_ReallyLR implicit $d0
294 name: DUPv8i8gpr_s8_src
297 regBankSelected: true
298 tracksRegLiveness: true
302 ; CHECK-LABEL: name: DUPv8i8gpr_s8_src
303 ; CHECK: liveins: $w0
304 ; CHECK: %copy:gpr32 = COPY $w0
305 ; CHECK: %dup:fpr64 = DUPv8i8gpr %copy
306 ; CHECK: $d0 = COPY %dup
307 ; CHECK: RET_ReallyLR implicit $d0
308 %copy:gpr(s32) = COPY $w0
309 %trunc:gpr(s8) = G_TRUNC %copy(s32)
310 %dup:fpr(<8 x s8>) = G_DUP %trunc(s8)
311 $d0 = COPY %dup(<8 x s8>)
312 RET_ReallyLR implicit $d0
319 regBankSelected: true
320 tracksRegLiveness: true
324 ; CHECK-LABEL: name: DUPv16i8gpr
325 ; CHECK: liveins: $w0
326 ; CHECK: %copy:gpr32 = COPY $w0
327 ; CHECK: %dup:fpr128 = DUPv16i8gpr %copy
328 ; CHECK: $q0 = COPY %dup
329 ; CHECK: RET_ReallyLR implicit $q0
330 %copy:gpr(s32) = COPY $w0
331 %dup:fpr(<16 x s8>) = G_DUP %copy(s32)
332 $q0 = COPY %dup(<16 x s8>)
333 RET_ReallyLR implicit $q0
336 name: DUPv16i8gpr_s8_src
339 regBankSelected: true
340 tracksRegLiveness: true
344 ; Check we still select the gpr variant when scalar is an s8.
345 ; CHECK-LABEL: name: DUPv16i8gpr_s8_src
346 ; CHECK: liveins: $w0
347 ; CHECK: %copy:gpr32 = COPY $w0
348 ; CHECK: %dup:fpr128 = DUPv16i8gpr %copy
349 ; CHECK: $q0 = COPY %dup
350 ; CHECK: RET_ReallyLR implicit $q0
351 %copy:gpr(s32) = COPY $w0
352 %trunc:gpr(s8) = G_TRUNC %copy
353 %dup:fpr(<16 x s8>) = G_DUP %trunc(s8)
354 $q0 = COPY %dup(<16 x s8>)
355 RET_ReallyLR implicit $q0
361 regBankSelected: true
362 tracksRegLiveness: true
369 ; CHECK-LABEL: name: dup_v2p0
370 ; CHECK: liveins: $x0
371 ; CHECK: [[COPY:%[0-9]+]]:gpr64all = COPY $x0
372 ; CHECK: [[COPY1:%[0-9]+]]:gpr64 = COPY [[COPY]]
373 ; CHECK: [[DUPv2i64gpr:%[0-9]+]]:fpr128 = DUPv2i64gpr [[COPY1]]
374 ; CHECK: $q0 = COPY [[DUPv2i64gpr]]
375 ; CHECK: RET_ReallyLR implicit $q0
376 %0:gpr(p0) = COPY $x0
377 %4:fpr(<2 x p0>) = G_DUP %0(p0)
378 $q0 = COPY %4(<2 x p0>)
379 RET_ReallyLR implicit $q0
385 regBankSelected: true
386 tracksRegLiveness: true
390 ; CHECK-LABEL: name: cst_v4s32
391 ; CHECK: liveins: $w0
392 ; CHECK: [[ADRP:%[0-9]+]]:gpr64common = ADRP target-flags(aarch64-page) %const.0
393 ; CHECK: [[LDRQui:%[0-9]+]]:fpr128 = LDRQui [[ADRP]], target-flags(aarch64-pageoff, aarch64-nc) %const.0
394 ; CHECK: $q0 = COPY [[LDRQui]]
395 ; CHECK: RET_ReallyLR implicit $q0
396 %cst:gpr(s32) = G_CONSTANT i32 3
397 %dup:fpr(<4 x s32>) = G_DUP %cst(s32)
398 $q0 = COPY %dup(<4 x s32>)
399 RET_ReallyLR implicit $q0
405 regBankSelected: true
406 tracksRegLiveness: true
410 ; CHECK-LABEL: name: cst_v8s8
411 ; CHECK: liveins: $w0
412 ; CHECK: [[ADRP:%[0-9]+]]:gpr64common = ADRP target-flags(aarch64-page) %const.0
413 ; CHECK: [[LDRDui:%[0-9]+]]:fpr64 = LDRDui [[ADRP]], target-flags(aarch64-pageoff, aarch64-nc) %const.0
414 ; CHECK: $d0 = COPY [[LDRDui]]
415 ; CHECK: RET_ReallyLR implicit $d0
416 %cst:gpr(s8) = G_CONSTANT i8 3
417 %dup:fpr(<8 x s8>) = G_DUP %cst(s8)
418 $d0 = COPY %dup(<8 x s8>)
419 RET_ReallyLR implicit $d0
424 regBankSelected: true
425 tracksRegLiveness: true
429 ; CHECK-LABEL: name: cst_v2p0
430 ; CHECK: liveins: $w0
431 ; CHECK: %cst:gpr64 = MOVi64imm 3
432 ; CHECK: [[ADRP:%[0-9]+]]:gpr64common = ADRP target-flags(aarch64-page) %const.0
433 ; CHECK: [[LDRQui:%[0-9]+]]:fpr128 = LDRQui [[ADRP]], target-flags(aarch64-pageoff, aarch64-nc) %const.0
434 ; CHECK: $q0 = COPY [[LDRQui]]
435 ; CHECK: RET_ReallyLR implicit $q0
436 %cst:gpr(p0) = G_CONSTANT i64 3
437 %dup:fpr(<2 x p0>) = G_DUP %cst(p0)
438 $q0 = COPY %dup(<2 x p0>)
439 RET_ReallyLR implicit $q0