1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=aarch64-- -run-pass=instruction-select -O1 -verify-machineinstrs %s -o - | FileCheck %s
8 tracksRegLiveness: true
13 ; CHECK-LABEL: name: splat_4xi32
15 ; CHECK: [[COPY:%[0-9]+]]:gpr32 = COPY $w0
16 ; CHECK: [[DUPv4i32gpr:%[0-9]+]]:fpr128 = DUPv4i32gpr [[COPY]]
17 ; CHECK: $q0 = COPY [[DUPv4i32gpr]]
18 ; CHECK: RET_ReallyLR implicit $q0
19 %0:gpr(s32) = COPY $w0
20 %2:fpr(<4 x s32>) = G_IMPLICIT_DEF
21 %3:gpr(s32) = G_CONSTANT i32 0
22 %1:fpr(<4 x s32>) = G_INSERT_VECTOR_ELT %2, %0(s32), %3(s32)
23 %4:fpr(<4 x s32>) = G_SHUFFLE_VECTOR %1(<4 x s32>), %2, shufflemask(0, 0, 0, 0)
24 $q0 = COPY %4(<4 x s32>)
25 RET_ReallyLR implicit $q0
33 tracksRegLiveness: true
38 ; CHECK-LABEL: name: splat_2xi64
40 ; CHECK: [[COPY:%[0-9]+]]:gpr64 = COPY $x0
41 ; CHECK: [[DUPv2i64gpr:%[0-9]+]]:fpr128 = DUPv2i64gpr [[COPY]]
42 ; CHECK: $q0 = COPY [[DUPv2i64gpr]]
43 ; CHECK: RET_ReallyLR implicit $q0
44 %0:gpr(s64) = COPY $x0
45 %2:fpr(<2 x s64>) = G_IMPLICIT_DEF
46 %3:gpr(s32) = G_CONSTANT i32 0
47 %1:fpr(<2 x s64>) = G_INSERT_VECTOR_ELT %2, %0(s64), %3(s32)
48 %4:fpr(<2 x s64>) = G_SHUFFLE_VECTOR %1(<2 x s64>), %2, shufflemask(0, 0)
49 $q0 = COPY %4(<2 x s64>)
50 RET_ReallyLR implicit $q0
58 tracksRegLiveness: true
63 ; CHECK-LABEL: name: splat_4xf32
65 ; CHECK: [[COPY:%[0-9]+]]:fpr32 = COPY $s0
66 ; CHECK: [[DEF:%[0-9]+]]:fpr128 = IMPLICIT_DEF
67 ; CHECK: [[INSERT_SUBREG:%[0-9]+]]:fpr128 = INSERT_SUBREG [[DEF]], [[COPY]], %subreg.ssub
68 ; CHECK: [[DUPv4i32lane:%[0-9]+]]:fpr128 = DUPv4i32lane [[INSERT_SUBREG]], 0
69 ; CHECK: $q0 = COPY [[DUPv4i32lane]]
70 ; CHECK: RET_ReallyLR implicit $q0
71 %0:fpr(s32) = COPY $s0
72 %2:fpr(<4 x s32>) = G_IMPLICIT_DEF
73 %3:gpr(s32) = G_CONSTANT i32 0
74 %1:fpr(<4 x s32>) = G_INSERT_VECTOR_ELT %2, %0(s32), %3(s32)
75 %4:fpr(<4 x s32>) = G_SHUFFLE_VECTOR %1(<4 x s32>), %2, shufflemask(0, 0, 0, 0)
76 $q0 = COPY %4(<4 x s32>)
77 RET_ReallyLR implicit $q0
85 tracksRegLiveness: true
90 ; CHECK-LABEL: name: splat_2xf64
92 ; CHECK: [[COPY:%[0-9]+]]:fpr64 = COPY $d0
93 ; CHECK: [[DEF:%[0-9]+]]:fpr128 = IMPLICIT_DEF
94 ; CHECK: [[INSERT_SUBREG:%[0-9]+]]:fpr128 = INSERT_SUBREG [[DEF]], [[COPY]], %subreg.dsub
95 ; CHECK: [[DUPv2i64lane:%[0-9]+]]:fpr128 = DUPv2i64lane [[INSERT_SUBREG]], 0
96 ; CHECK: $q0 = COPY [[DUPv2i64lane]]
97 ; CHECK: RET_ReallyLR implicit $q0
98 %0:fpr(s64) = COPY $d0
99 %2:fpr(<2 x s64>) = G_IMPLICIT_DEF
100 %3:gpr(s32) = G_CONSTANT i32 0
101 %1:fpr(<2 x s64>) = G_INSERT_VECTOR_ELT %2, %0(s64), %3(s32)
102 %4:fpr(<2 x s64>) = G_SHUFFLE_VECTOR %1(<2 x s64>), %2, shufflemask(0, 0)
103 $q0 = COPY %4(<2 x s64>)
104 RET_ReallyLR implicit $q0
108 name: splat_2xf64_copies
111 regBankSelected: true
112 tracksRegLiveness: true
117 ; This test is exactly the same as splat_2xf64, except it adds two copies.
118 ; These copies shouldn't get in the way of matching the dup pattern.
119 ; CHECK-LABEL: name: splat_2xf64_copies
120 ; CHECK: liveins: $d0
121 ; CHECK: [[COPY:%[0-9]+]]:fpr64 = COPY $d0
122 ; CHECK: [[DEF:%[0-9]+]]:fpr128 = IMPLICIT_DEF
123 ; CHECK: [[INSERT_SUBREG:%[0-9]+]]:fpr128 = INSERT_SUBREG [[DEF]], [[COPY]], %subreg.dsub
124 ; CHECK: [[DUPv2i64lane:%[0-9]+]]:fpr128 = DUPv2i64lane [[INSERT_SUBREG]], 0
125 ; CHECK: $q0 = COPY [[DUPv2i64lane]]
126 ; CHECK: RET_ReallyLR implicit $q0
127 %0:fpr(s64) = COPY $d0
128 %2:fpr(<2 x s64>) = G_IMPLICIT_DEF
129 %6:fpr(<2 x s64>) = COPY %2
130 %3:gpr(s32) = G_CONSTANT i32 0
131 %1:fpr(<2 x s64>) = G_INSERT_VECTOR_ELT %6, %0(s64), %3(s32)
132 %7:fpr(<2 x s64>) = COPY %1
133 %4:fpr(<2 x s64>) = G_SHUFFLE_VECTOR %7(<2 x s64>), %2, shufflemask(0, 0)
134 $q0 = COPY %4(<2 x s64>)
135 RET_ReallyLR implicit $q0
142 regBankSelected: true
143 tracksRegLiveness: true
147 ; Make sure that we don't do the optimization when it's not all zeroes.
148 ; CHECK-LABEL: name: not_all_zeros
149 ; CHECK: liveins: $x0
150 ; CHECK: [[COPY:%[0-9]+]]:gpr64 = COPY $x0
151 ; CHECK: [[DEF:%[0-9]+]]:fpr128 = IMPLICIT_DEF
152 ; CHECK: [[INSvi64gpr:%[0-9]+]]:fpr128 = INSvi64gpr [[DEF]], 0, [[COPY]]
153 ; CHECK: [[ADRP:%[0-9]+]]:gpr64common = ADRP target-flags(aarch64-page) %const.0
154 ; CHECK: [[LDRQui:%[0-9]+]]:fpr128 = LDRQui [[ADRP]], target-flags(aarch64-pageoff, aarch64-nc) %const.0
155 ; CHECK: [[REG_SEQUENCE:%[0-9]+]]:qq = REG_SEQUENCE [[INSvi64gpr]], %subreg.qsub0, [[DEF]], %subreg.qsub1
156 ; CHECK: [[TBLv16i8Two:%[0-9]+]]:fpr128 = TBLv16i8Two [[REG_SEQUENCE]], [[LDRQui]]
157 ; CHECK: $q0 = COPY [[TBLv16i8Two]]
158 ; CHECK: RET_ReallyLR implicit $q0
159 %0:gpr(s64) = COPY $x0
160 %2:fpr(<2 x s64>) = G_IMPLICIT_DEF
161 %3:gpr(s32) = G_CONSTANT i32 0
162 %1:fpr(<2 x s64>) = G_INSERT_VECTOR_ELT %2, %0(s64), %3(s32)
163 %4:fpr(<2 x s64>) = G_SHUFFLE_VECTOR %1(<2 x s64>), %2, shufflemask(0, 1)
164 $q0 = COPY %4(<2 x s64>)
165 RET_ReallyLR implicit $q0