1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple aarch64 -run-pass=aarch64-postlegalizer-lowering -verify-machineinstrs %s -o - | FileCheck %s
4 # Check that we produce G_TRN1 or G_TRN2 when we have an appropriate shuffle
13 tracksRegLiveness: true
17 ; CHECK-LABEL: name: trn1_v8s8
18 ; CHECK: liveins: $d0, $d1
19 ; CHECK: [[COPY:%[0-9]+]]:_(<8 x s8>) = COPY $d0
20 ; CHECK: [[COPY1:%[0-9]+]]:_(<8 x s8>) = COPY $d1
21 ; CHECK: [[TRN1_:%[0-9]+]]:_(<8 x s8>) = G_TRN1 [[COPY]], [[COPY1]]
22 ; CHECK: $d0 = COPY [[TRN1_]](<8 x s8>)
23 ; CHECK: RET_ReallyLR implicit $q0
24 %0:_(<8 x s8>) = COPY $d0
25 %1:_(<8 x s8>) = COPY $d1
26 %2:_(<8 x s8>) = G_SHUFFLE_VECTOR %0(<8 x s8>), %1, shufflemask(0, 8, 2, 10, 4, 12, 6, 14)
27 $d0 = COPY %2(<8 x s8>)
28 RET_ReallyLR implicit $q0
35 tracksRegLiveness: true
39 ; CHECK-LABEL: name: trn2_v8s8
40 ; CHECK: liveins: $d0, $d1
41 ; CHECK: [[COPY:%[0-9]+]]:_(<8 x s8>) = COPY $d0
42 ; CHECK: [[COPY1:%[0-9]+]]:_(<8 x s8>) = COPY $d1
43 ; CHECK: [[TRN2_:%[0-9]+]]:_(<8 x s8>) = G_TRN2 [[COPY]], [[COPY1]]
44 ; CHECK: $d0 = COPY [[TRN2_]](<8 x s8>)
45 ; CHECK: RET_ReallyLR implicit $q0
46 %0:_(<8 x s8>) = COPY $d0
47 %1:_(<8 x s8>) = COPY $d1
48 %2:_(<8 x s8>) = G_SHUFFLE_VECTOR %0(<8 x s8>), %1, shufflemask(1, 9, 3, 11, 5, 13, 7, 15)
49 $d0 = COPY %2(<8 x s8>)
50 RET_ReallyLR implicit $q0
57 tracksRegLiveness: true
61 ; CHECK-LABEL: name: trn1_v16s8
62 ; CHECK: liveins: $q0, $q1
63 ; CHECK: [[COPY:%[0-9]+]]:_(<16 x s8>) = COPY $q0
64 ; CHECK: [[COPY1:%[0-9]+]]:_(<16 x s8>) = COPY $q1
65 ; CHECK: [[TRN1_:%[0-9]+]]:_(<16 x s8>) = G_TRN1 [[COPY]], [[COPY1]]
66 ; CHECK: $q0 = COPY [[TRN1_]](<16 x s8>)
67 ; CHECK: RET_ReallyLR implicit $q0
68 %0:_(<16 x s8>) = COPY $q0
69 %1:_(<16 x s8>) = COPY $q1
70 %2:_(<16 x s8>) = G_SHUFFLE_VECTOR %0(<16 x s8>), %1, shufflemask(0, 16, 2, 18, 4, 20, 6, 22, 8, 24, 10, 26, 12, 28, 14, 30)
71 $q0 = COPY %2(<16 x s8>)
72 RET_ReallyLR implicit $q0
79 tracksRegLiveness: true
83 ; CHECK-LABEL: name: trn2_v16s8
84 ; CHECK: liveins: $q0, $q1
85 ; CHECK: [[COPY:%[0-9]+]]:_(<16 x s8>) = COPY $q0
86 ; CHECK: [[COPY1:%[0-9]+]]:_(<16 x s8>) = COPY $q1
87 ; CHECK: [[TRN2_:%[0-9]+]]:_(<16 x s8>) = G_TRN2 [[COPY]], [[COPY1]]
88 ; CHECK: $q0 = COPY [[TRN2_]](<16 x s8>)
89 ; CHECK: RET_ReallyLR implicit $q0
90 %0:_(<16 x s8>) = COPY $q0
91 %1:_(<16 x s8>) = COPY $q1
92 %2:_(<16 x s8>) = G_SHUFFLE_VECTOR %0(<16 x s8>), %1, shufflemask(1, 17, 3, 19, 5, 21, 7, 23, 9, 25, 11, 27, 13, 29, 15, 31)
93 $q0 = COPY %2(<16 x s8>)
94 RET_ReallyLR implicit $q0
101 tracksRegLiveness: true
105 ; CHECK-LABEL: name: trn1_v4s32
106 ; CHECK: liveins: $q0, $q1
107 ; CHECK: [[COPY:%[0-9]+]]:_(<4 x s32>) = COPY $q0
108 ; CHECK: [[COPY1:%[0-9]+]]:_(<4 x s32>) = COPY $q1
109 ; CHECK: [[TRN1_:%[0-9]+]]:_(<4 x s32>) = G_TRN1 [[COPY]], [[COPY1]]
110 ; CHECK: $q0 = COPY [[TRN1_]](<4 x s32>)
111 ; CHECK: RET_ReallyLR implicit $q0
112 %0:_(<4 x s32>) = COPY $q0
113 %1:_(<4 x s32>) = COPY $q1
114 %2:_(<4 x s32>) = G_SHUFFLE_VECTOR %0(<4 x s32>), %1, shufflemask(0, 4, 2, 6)
115 $q0 = COPY %2(<4 x s32>)
116 RET_ReallyLR implicit $q0
123 tracksRegLiveness: true
127 ; CHECK-LABEL: name: trn2_v4s32
128 ; CHECK: liveins: $q0, $q1
129 ; CHECK: [[COPY:%[0-9]+]]:_(<4 x s32>) = COPY $q0
130 ; CHECK: [[COPY1:%[0-9]+]]:_(<4 x s32>) = COPY $q1
131 ; CHECK: [[TRN2_:%[0-9]+]]:_(<4 x s32>) = G_TRN2 [[COPY]], [[COPY1]]
132 ; CHECK: $q0 = COPY [[TRN2_]](<4 x s32>)
133 ; CHECK: RET_ReallyLR implicit $q0
134 %0:_(<4 x s32>) = COPY $q0
135 %1:_(<4 x s32>) = COPY $q1
136 %2:_(<4 x s32>) = G_SHUFFLE_VECTOR %0(<4 x s32>), %1, shufflemask(1, 5, 3, 7)
137 $q0 = COPY %2(<4 x s32>)
138 RET_ReallyLR implicit $q0
142 name: redundant_with_zip1
145 tracksRegLiveness: true
149 ; 2 x s32 TRN is redundant with ZIP. Make sure we prioritize ZIP.
151 ; CHECK-LABEL: name: redundant_with_zip1
152 ; CHECK: liveins: $d0, $d1
153 ; CHECK: [[COPY:%[0-9]+]]:_(<2 x s32>) = COPY $d0
154 ; CHECK: [[COPY1:%[0-9]+]]:_(<2 x s32>) = COPY $d1
155 ; CHECK: [[ZIP1_:%[0-9]+]]:_(<2 x s32>) = G_ZIP1 [[COPY]], [[COPY1]]
156 ; CHECK: $d0 = COPY [[ZIP1_]](<2 x s32>)
157 ; CHECK: RET_ReallyLR implicit $d0
158 %0:_(<2 x s32>) = COPY $d0
159 %1:_(<2 x s32>) = COPY $d1
160 %2:_(<2 x s32>) = G_SHUFFLE_VECTOR %0(<2 x s32>), %1, shufflemask(0, 2)
161 $d0 = COPY %2(<2 x s32>)
162 RET_ReallyLR implicit $d0
166 name: redundant_with_zip2
169 tracksRegLiveness: true
173 ; 2 x s32 TRN is redundant with ZIP. Make sure we prioritize ZIP.
175 ; CHECK-LABEL: name: redundant_with_zip2
176 ; CHECK: liveins: $d0, $d1
177 ; CHECK: [[COPY:%[0-9]+]]:_(<2 x s32>) = COPY $d0
178 ; CHECK: [[COPY1:%[0-9]+]]:_(<2 x s32>) = COPY $d1
179 ; CHECK: [[ZIP2_:%[0-9]+]]:_(<2 x s32>) = G_ZIP2 [[COPY]], [[COPY1]]
180 ; CHECK: $d0 = COPY [[ZIP2_]](<2 x s32>)
181 ; CHECK: RET_ReallyLR implicit $d0
182 %0:_(<2 x s32>) = COPY $d0
183 %1:_(<2 x s32>) = COPY $d1
184 %2:_(<2 x s32>) = G_SHUFFLE_VECTOR %0(<2 x s32>), %1, shufflemask(1, 3)
185 $d0 = COPY %2(<2 x s32>)
186 RET_ReallyLR implicit $d0
193 tracksRegLiveness: true
197 ; Undef shuffle indices should not prevent matching to G_TRN1.
199 ; CHECK-LABEL: name: trn1_undef
200 ; CHECK: liveins: $d0, $d1
201 ; CHECK: [[COPY:%[0-9]+]]:_(<8 x s8>) = COPY $d0
202 ; CHECK: [[COPY1:%[0-9]+]]:_(<8 x s8>) = COPY $d1
203 ; CHECK: [[TRN1_:%[0-9]+]]:_(<8 x s8>) = G_TRN1 [[COPY]], [[COPY1]]
204 ; CHECK: $d0 = COPY [[TRN1_]](<8 x s8>)
205 ; CHECK: RET_ReallyLR implicit $d0
206 %0:_(<8 x s8>) = COPY $d0
207 %1:_(<8 x s8>) = COPY $d1
208 %2:_(<8 x s8>) = G_SHUFFLE_VECTOR %0(<8 x s8>), %1, shufflemask(0, 8, -1, -1, 4, 12, 6, 14)
209 $d0 = COPY %2(<8 x s8>)
210 RET_ReallyLR implicit $d0
217 tracksRegLiveness: true
221 ; Undef shuffle indices should not prevent matching to G_TRN2.
223 ; CHECK-LABEL: name: trn2_undef
224 ; CHECK: liveins: $d0, $d1
225 ; CHECK: [[COPY:%[0-9]+]]:_(<8 x s8>) = COPY $d0
226 ; CHECK: [[COPY1:%[0-9]+]]:_(<8 x s8>) = COPY $d1
227 ; CHECK: [[TRN2_:%[0-9]+]]:_(<8 x s8>) = G_TRN2 [[COPY]], [[COPY1]]
228 ; CHECK: $d0 = COPY [[TRN2_]](<8 x s8>)
229 ; CHECK: RET_ReallyLR implicit $d0
230 %0:_(<8 x s8>) = COPY $d0
231 %1:_(<8 x s8>) = COPY $d1
232 %2:_(<8 x s8>) = G_SHUFFLE_VECTOR %0(<8 x s8>), %1, shufflemask(1, -1, 3, 11, 5, 13, -1, -1)
233 $d0 = COPY %2(<8 x s8>)
234 RET_ReallyLR implicit $d0