1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -O0 -debugify-and-strip-all-safe -mtriple=aarch64 -run-pass=legalizer -global-isel-abort=1 %s -o - | FileCheck %s
7 ; CHECK-LABEL: name: test_shift
8 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
9 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x1
10 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 255
11 ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:_(s32) = G_TRUNC [[COPY1]](s64)
12 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[TRUNC]], [[C]]
13 ; CHECK-NEXT: [[TRUNC1:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
14 ; CHECK-NEXT: [[SEXT_INREG:%[0-9]+]]:_(s32) = G_SEXT_INREG [[TRUNC1]], 8
15 ; CHECK-NEXT: [[ASHR:%[0-9]+]]:_(s32) = G_ASHR [[SEXT_INREG]], [[AND]](s32)
16 ; CHECK-NEXT: $w0 = COPY [[ASHR]](s32)
17 ; CHECK-NEXT: [[TRUNC2:%[0-9]+]]:_(s32) = G_TRUNC [[COPY1]](s64)
18 ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s32) = G_AND [[TRUNC2]], [[C]]
19 ; CHECK-NEXT: [[TRUNC3:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
20 ; CHECK-NEXT: [[AND2:%[0-9]+]]:_(s32) = G_AND [[TRUNC3]], [[C]]
21 ; CHECK-NEXT: [[LSHR:%[0-9]+]]:_(s32) = G_LSHR [[AND2]], [[AND1]](s32)
22 ; CHECK-NEXT: $w0 = COPY [[LSHR]](s32)
23 ; CHECK-NEXT: [[TRUNC4:%[0-9]+]]:_(s32) = G_TRUNC [[COPY1]](s64)
24 ; CHECK-NEXT: [[AND3:%[0-9]+]]:_(s32) = G_AND [[TRUNC4]], [[C]]
25 ; CHECK-NEXT: [[TRUNC5:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
26 ; CHECK-NEXT: [[SHL:%[0-9]+]]:_(s32) = G_SHL [[TRUNC5]], [[AND3]](s32)
27 ; CHECK-NEXT: $w0 = COPY [[SHL]](s32)
30 %2:_(s8) = G_TRUNC %0(s64)
31 %3:_(s8) = G_TRUNC %1(s64)
32 %4:_(s8) = G_ASHR %2, %3
33 %7:_(s32) = G_ANYEXT %4(s8)
35 %5:_(s8) = G_LSHR %2, %3
36 %8:_(s32) = G_ANYEXT %5(s8)
38 %6:_(s8) = G_SHL %2, %3
39 %9:_(s32) = G_ANYEXT %6(s8)
44 name: test_shl_i64_i32
47 ; CHECK-LABEL: name: test_shl_i64_i32
48 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
49 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $w1
50 ; CHECK-NEXT: [[ZEXT:%[0-9]+]]:_(s64) = G_ZEXT [[COPY1]](s32)
51 ; CHECK-NEXT: [[SHL:%[0-9]+]]:_(s64) = G_SHL [[COPY]], [[ZEXT]](s64)
52 ; CHECK-NEXT: $x0 = COPY [[SHL]](s64)
55 %2:_(s64) = G_SHL %0, %1
60 name: test_ashr_i64_i32
63 ; CHECK-LABEL: name: test_ashr_i64_i32
64 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
65 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $w1
66 ; CHECK-NEXT: [[ZEXT:%[0-9]+]]:_(s64) = G_ZEXT [[COPY1]](s32)
67 ; CHECK-NEXT: [[ASHR:%[0-9]+]]:_(s64) = G_ASHR [[COPY]], [[ZEXT]](s64)
68 ; CHECK-NEXT: $x0 = COPY [[ASHR]](s64)
71 %2:_(s64) = G_ASHR %0, %1
76 name: test_lshr_i64_i32
79 ; CHECK-LABEL: name: test_lshr_i64_i32
80 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
81 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $w1
82 ; CHECK-NEXT: [[ZEXT:%[0-9]+]]:_(s64) = G_ZEXT [[COPY1]](s32)
83 ; CHECK-NEXT: [[LSHR:%[0-9]+]]:_(s64) = G_LSHR [[COPY]], [[ZEXT]](s64)
84 ; CHECK-NEXT: $x0 = COPY [[LSHR]](s64)
87 %2:_(s64) = G_LSHR %0, %1
93 name: test_shl_s128_s128
96 ; CHECK-LABEL: name: test_shl_s128_s128
97 ; CHECK: [[COPY:%[0-9]+]]:_(s128) = COPY $q0
98 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s128) = COPY $q1
99 ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:_(s64) = G_TRUNC [[COPY1]](s128)
100 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 64
101 ; CHECK-NEXT: [[UV:%[0-9]+]]:_(s64), [[UV1:%[0-9]+]]:_(s64) = G_UNMERGE_VALUES [[COPY]](s128)
102 ; CHECK-NEXT: [[SUB:%[0-9]+]]:_(s64) = G_SUB [[TRUNC]], [[C]]
103 ; CHECK-NEXT: [[SUB1:%[0-9]+]]:_(s64) = G_SUB [[C]], [[TRUNC]]
104 ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 0
105 ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(ult), [[TRUNC]](s64), [[C]]
106 ; CHECK-NEXT: [[ICMP1:%[0-9]+]]:_(s32) = G_ICMP intpred(eq), [[TRUNC]](s64), [[C1]]
107 ; CHECK-NEXT: [[SHL:%[0-9]+]]:_(s64) = G_SHL [[UV]], [[TRUNC]](s64)
108 ; CHECK-NEXT: [[LSHR:%[0-9]+]]:_(s64) = G_LSHR [[UV]], [[SUB1]](s64)
109 ; CHECK-NEXT: [[SHL1:%[0-9]+]]:_(s64) = G_SHL [[UV1]], [[TRUNC]](s64)
110 ; CHECK-NEXT: [[OR:%[0-9]+]]:_(s64) = G_OR [[LSHR]], [[SHL1]]
111 ; CHECK-NEXT: [[SHL2:%[0-9]+]]:_(s64) = G_SHL [[UV]], [[SUB]](s64)
112 ; CHECK-NEXT: [[C2:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
113 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[ICMP]], [[C2]]
114 ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s64) = G_SELECT [[AND]](s32), [[SHL]], [[C1]]
115 ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s32) = G_AND [[ICMP]], [[C2]]
116 ; CHECK-NEXT: [[SELECT1:%[0-9]+]]:_(s64) = G_SELECT [[AND1]](s32), [[OR]], [[SHL2]]
117 ; CHECK-NEXT: [[AND2:%[0-9]+]]:_(s32) = G_AND [[ICMP1]], [[C2]]
118 ; CHECK-NEXT: [[SELECT2:%[0-9]+]]:_(s64) = G_SELECT [[AND2]](s32), [[UV1]], [[SELECT1]]
119 ; CHECK-NEXT: [[MV:%[0-9]+]]:_(s128) = G_MERGE_VALUES [[SELECT]](s64), [[SELECT2]](s64)
120 ; CHECK-NEXT: $q0 = COPY [[MV]](s128)
121 %0:_(s128) = COPY $q0
122 %1:_(s128) = COPY $q1
123 %2:_(s128) = G_SHL %0, %1
129 name: test_lshr_s128_s128
132 ; CHECK-LABEL: name: test_lshr_s128_s128
133 ; CHECK: [[COPY:%[0-9]+]]:_(s128) = COPY $q0
134 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s128) = COPY $q1
135 ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:_(s64) = G_TRUNC [[COPY1]](s128)
136 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 64
137 ; CHECK-NEXT: [[UV:%[0-9]+]]:_(s64), [[UV1:%[0-9]+]]:_(s64) = G_UNMERGE_VALUES [[COPY]](s128)
138 ; CHECK-NEXT: [[SUB:%[0-9]+]]:_(s64) = G_SUB [[TRUNC]], [[C]]
139 ; CHECK-NEXT: [[SUB1:%[0-9]+]]:_(s64) = G_SUB [[C]], [[TRUNC]]
140 ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 0
141 ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(ult), [[TRUNC]](s64), [[C]]
142 ; CHECK-NEXT: [[ICMP1:%[0-9]+]]:_(s32) = G_ICMP intpred(eq), [[TRUNC]](s64), [[C1]]
143 ; CHECK-NEXT: [[LSHR:%[0-9]+]]:_(s64) = G_LSHR [[UV1]], [[TRUNC]](s64)
144 ; CHECK-NEXT: [[LSHR1:%[0-9]+]]:_(s64) = G_LSHR [[UV]], [[TRUNC]](s64)
145 ; CHECK-NEXT: [[SHL:%[0-9]+]]:_(s64) = G_SHL [[UV1]], [[SUB1]](s64)
146 ; CHECK-NEXT: [[OR:%[0-9]+]]:_(s64) = G_OR [[LSHR1]], [[SHL]]
147 ; CHECK-NEXT: [[LSHR2:%[0-9]+]]:_(s64) = G_LSHR [[UV1]], [[SUB]](s64)
148 ; CHECK-NEXT: [[C2:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
149 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[ICMP]], [[C2]]
150 ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s64) = G_SELECT [[AND]](s32), [[OR]], [[LSHR2]]
151 ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s32) = G_AND [[ICMP1]], [[C2]]
152 ; CHECK-NEXT: [[SELECT1:%[0-9]+]]:_(s64) = G_SELECT [[AND1]](s32), [[UV]], [[SELECT]]
153 ; CHECK-NEXT: [[AND2:%[0-9]+]]:_(s32) = G_AND [[ICMP]], [[C2]]
154 ; CHECK-NEXT: [[SELECT2:%[0-9]+]]:_(s64) = G_SELECT [[AND2]](s32), [[LSHR]], [[C1]]
155 ; CHECK-NEXT: [[MV:%[0-9]+]]:_(s128) = G_MERGE_VALUES [[SELECT1]](s64), [[SELECT2]](s64)
156 ; CHECK-NEXT: $q0 = COPY [[MV]](s128)
157 %0:_(s128) = COPY $q0
158 %1:_(s128) = COPY $q1
159 %2:_(s128) = G_LSHR %0, %1
165 name: test_ashr_s128_s128
168 ; CHECK-LABEL: name: test_ashr_s128_s128
169 ; CHECK: [[COPY:%[0-9]+]]:_(s128) = COPY $q0
170 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s128) = COPY $q1
171 ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:_(s64) = G_TRUNC [[COPY1]](s128)
172 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 64
173 ; CHECK-NEXT: [[UV:%[0-9]+]]:_(s64), [[UV1:%[0-9]+]]:_(s64) = G_UNMERGE_VALUES [[COPY]](s128)
174 ; CHECK-NEXT: [[SUB:%[0-9]+]]:_(s64) = G_SUB [[TRUNC]], [[C]]
175 ; CHECK-NEXT: [[SUB1:%[0-9]+]]:_(s64) = G_SUB [[C]], [[TRUNC]]
176 ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 0
177 ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(ult), [[TRUNC]](s64), [[C]]
178 ; CHECK-NEXT: [[ICMP1:%[0-9]+]]:_(s32) = G_ICMP intpred(eq), [[TRUNC]](s64), [[C1]]
179 ; CHECK-NEXT: [[ASHR:%[0-9]+]]:_(s64) = G_ASHR [[UV1]], [[TRUNC]](s64)
180 ; CHECK-NEXT: [[LSHR:%[0-9]+]]:_(s64) = G_LSHR [[UV]], [[TRUNC]](s64)
181 ; CHECK-NEXT: [[SHL:%[0-9]+]]:_(s64) = G_SHL [[UV1]], [[SUB1]](s64)
182 ; CHECK-NEXT: [[OR:%[0-9]+]]:_(s64) = G_OR [[LSHR]], [[SHL]]
183 ; CHECK-NEXT: [[C2:%[0-9]+]]:_(s64) = G_CONSTANT i64 63
184 ; CHECK-NEXT: [[ASHR1:%[0-9]+]]:_(s64) = G_ASHR [[UV1]], [[C2]](s64)
185 ; CHECK-NEXT: [[ASHR2:%[0-9]+]]:_(s64) = G_ASHR [[UV1]], [[SUB]](s64)
186 ; CHECK-NEXT: [[C3:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
187 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[ICMP]], [[C3]]
188 ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s64) = G_SELECT [[AND]](s32), [[OR]], [[ASHR2]]
189 ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s32) = G_AND [[ICMP1]], [[C3]]
190 ; CHECK-NEXT: [[SELECT1:%[0-9]+]]:_(s64) = G_SELECT [[AND1]](s32), [[UV]], [[SELECT]]
191 ; CHECK-NEXT: [[AND2:%[0-9]+]]:_(s32) = G_AND [[ICMP]], [[C3]]
192 ; CHECK-NEXT: [[SELECT2:%[0-9]+]]:_(s64) = G_SELECT [[AND2]](s32), [[ASHR]], [[ASHR1]]
193 ; CHECK-NEXT: [[MV:%[0-9]+]]:_(s128) = G_MERGE_VALUES [[SELECT1]](s64), [[SELECT2]](s64)
194 ; CHECK-NEXT: $q0 = COPY [[MV]](s128)
195 %0:_(s128) = COPY $q0
196 %1:_(s128) = COPY $q1
197 %2:_(s128) = G_ASHR %0, %1
203 name: test_ashr_v2i32
206 ; CHECK-LABEL: name: test_ashr_v2i32
207 ; CHECK: [[COPY:%[0-9]+]]:_(<2 x s32>) = COPY $d0
208 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<2 x s32>) = COPY $d1
209 ; CHECK-NEXT: [[ASHR:%[0-9]+]]:_(<2 x s32>) = G_ASHR [[COPY]], [[COPY1]](<2 x s32>)
210 ; CHECK-NEXT: $d0 = COPY [[ASHR]](<2 x s32>)
211 %0:_(<2 x s32>) = COPY $d0
212 %1:_(<2 x s32>) = COPY $d1
213 %2:_(<2 x s32>) = G_ASHR %0, %1
218 name: test_ashr_v4i32
221 ; CHECK-LABEL: name: test_ashr_v4i32
222 ; CHECK: [[COPY:%[0-9]+]]:_(<4 x s32>) = COPY $q0
223 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<4 x s32>) = COPY $q1
224 ; CHECK-NEXT: [[ASHR:%[0-9]+]]:_(<4 x s32>) = G_ASHR [[COPY]], [[COPY1]](<4 x s32>)
225 ; CHECK-NEXT: $q0 = COPY [[ASHR]](<4 x s32>)
226 %0:_(<4 x s32>) = COPY $q0
227 %1:_(<4 x s32>) = COPY $q1
228 %2:_(<4 x s32>) = G_ASHR %0, %1
238 ; CHECK-LABEL: name: shl_cimm_32
239 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $w0
240 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 8
241 ; CHECK-NEXT: [[SHL:%[0-9]+]]:_(s32) = G_SHL [[COPY]], [[C]](s64)
242 ; CHECK-NEXT: $w0 = COPY [[SHL]](s32)
243 ; CHECK-NEXT: RET_ReallyLR implicit $w0
245 %1:_(s32) = G_CONSTANT i32 8
246 %2:_(s32) = G_SHL %0, %1(s32)
248 RET_ReallyLR implicit $w0
257 ; CHECK-LABEL: name: lshr_cimm_32
258 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $w0
259 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 8
260 ; CHECK-NEXT: [[LSHR:%[0-9]+]]:_(s32) = G_LSHR [[COPY]], [[C]](s64)
261 ; CHECK-NEXT: $w0 = COPY [[LSHR]](s32)
262 ; CHECK-NEXT: RET_ReallyLR implicit $w0
264 %1:_(s32) = G_CONSTANT i32 8
265 %2:_(s32) = G_LSHR %0, %1(s32)
267 RET_ReallyLR implicit $w0
276 ; CHECK-LABEL: name: ashr_cimm_32
277 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $w0
278 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 8
279 ; CHECK-NEXT: [[ASHR:%[0-9]+]]:_(s32) = G_ASHR [[COPY]], [[C]](s64)
280 ; CHECK-NEXT: $w0 = COPY [[ASHR]](s32)
281 ; CHECK-NEXT: RET_ReallyLR implicit $w0
283 %1:_(s32) = G_CONSTANT i32 8
284 %2:_(s32) = G_ASHR %0, %1(s32)
286 RET_ReallyLR implicit $w0
290 name: test_ashr_v16i8
293 ; CHECK-LABEL: name: test_ashr_v16i8
294 ; CHECK: [[COPY:%[0-9]+]]:_(<16 x s8>) = COPY $q0
295 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<16 x s8>) = COPY $q1
296 ; CHECK-NEXT: [[ASHR:%[0-9]+]]:_(<16 x s8>) = G_ASHR [[COPY]], [[COPY1]](<16 x s8>)
297 ; CHECK-NEXT: $q0 = COPY [[ASHR]](<16 x s8>)
298 %0:_(<16 x s8>) = COPY $q0
299 %1:_(<16 x s8>) = COPY $q1
300 %2:_(<16 x s8>) = G_ASHR %0, %1
304 name: test_ashr_v8i16
307 ; CHECK-LABEL: name: test_ashr_v8i16
308 ; CHECK: [[COPY:%[0-9]+]]:_(<8 x s16>) = COPY $q0
309 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<8 x s16>) = COPY $q1
310 ; CHECK-NEXT: [[ASHR:%[0-9]+]]:_(<8 x s16>) = G_ASHR [[COPY]], [[COPY1]](<8 x s16>)
311 ; CHECK-NEXT: $q0 = COPY [[ASHR]](<8 x s16>)
312 %0:_(<8 x s16>) = COPY $q0
313 %1:_(<8 x s16>) = COPY $q1
314 %2:_(<8 x s16>) = G_ASHR %0, %1
321 ; CHECK-LABEL: name: test_shl_v16i8
322 ; CHECK: [[COPY:%[0-9]+]]:_(<16 x s8>) = COPY $q0
323 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<16 x s8>) = COPY $q1
324 ; CHECK-NEXT: [[SHL:%[0-9]+]]:_(<16 x s8>) = G_SHL [[COPY]], [[COPY1]](<16 x s8>)
325 ; CHECK-NEXT: $q0 = COPY [[SHL]](<16 x s8>)
326 %0:_(<16 x s8>) = COPY $q0
327 %1:_(<16 x s8>) = COPY $q1
328 %2:_(<16 x s8>) = G_SHL %0, %1
335 ; CHECK-LABEL: name: test_shl_v8i16
336 ; CHECK: [[COPY:%[0-9]+]]:_(<8 x s16>) = COPY $q0
337 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<8 x s16>) = COPY $q1
338 ; CHECK-NEXT: [[SHL:%[0-9]+]]:_(<8 x s16>) = G_SHL [[COPY]], [[COPY1]](<8 x s16>)
339 ; CHECK-NEXT: $q0 = COPY [[SHL]](<8 x s16>)
340 %0:_(<8 x s16>) = COPY $q0
341 %1:_(<8 x s16>) = COPY $q1
342 %2:_(<8 x s16>) = G_SHL %0, %1
346 name: test_lshr_v16i8
349 ; CHECK-LABEL: name: test_lshr_v16i8
350 ; CHECK: [[COPY:%[0-9]+]]:_(<16 x s8>) = COPY $q0
351 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<16 x s8>) = COPY $q1
352 ; CHECK-NEXT: [[LSHR:%[0-9]+]]:_(<16 x s8>) = G_LSHR [[COPY]], [[COPY1]](<16 x s8>)
353 ; CHECK-NEXT: $q0 = COPY [[LSHR]](<16 x s8>)
354 %0:_(<16 x s8>) = COPY $q0
355 %1:_(<16 x s8>) = COPY $q1
356 %2:_(<16 x s8>) = G_LSHR %0, %1
360 name: test_lshr_v8i16
363 ; CHECK-LABEL: name: test_lshr_v8i16
364 ; CHECK: [[COPY:%[0-9]+]]:_(<8 x s16>) = COPY $q0
365 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<8 x s16>) = COPY $q1
366 ; CHECK-NEXT: [[LSHR:%[0-9]+]]:_(<8 x s16>) = G_LSHR [[COPY]], [[COPY1]](<8 x s16>)
367 ; CHECK-NEXT: $q0 = COPY [[LSHR]](<8 x s16>)
368 %0:_(<8 x s16>) = COPY $q0
369 %1:_(<8 x s16>) = COPY $q1
370 %2:_(<8 x s16>) = G_LSHR %0, %1
377 ; CHECK-LABEL: name: test_shl_v4i16
378 ; CHECK: [[COPY:%[0-9]+]]:_(<4 x s16>) = COPY $d0
379 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<4 x s16>) = COPY $d1
380 ; CHECK-NEXT: [[SHL:%[0-9]+]]:_(<4 x s16>) = G_SHL [[COPY]], [[COPY1]](<4 x s16>)
381 ; CHECK-NEXT: $d0 = COPY [[SHL]](<4 x s16>)
382 %0:_(<4 x s16>) = COPY $d0
383 %1:_(<4 x s16>) = COPY $d1
384 %2:_(<4 x s16>) = G_SHL %0, %1
388 name: test_lshr_v4i16
391 ; CHECK-LABEL: name: test_lshr_v4i16
392 ; CHECK: [[COPY:%[0-9]+]]:_(<4 x s16>) = COPY $d0
393 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<4 x s16>) = COPY $d1
394 ; CHECK-NEXT: [[LSHR:%[0-9]+]]:_(<4 x s16>) = G_LSHR [[COPY]], [[COPY1]](<4 x s16>)
395 ; CHECK-NEXT: $d0 = COPY [[LSHR]](<4 x s16>)
396 %0:_(<4 x s16>) = COPY $d0
397 %1:_(<4 x s16>) = COPY $d1
398 %2:_(<4 x s16>) = G_LSHR %0, %1
402 name: test_ashr_v4i16
405 ; CHECK-LABEL: name: test_ashr_v4i16
406 ; CHECK: [[COPY:%[0-9]+]]:_(<4 x s16>) = COPY $d0
407 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<4 x s16>) = COPY $d1
408 ; CHECK-NEXT: [[ASHR:%[0-9]+]]:_(<4 x s16>) = G_ASHR [[COPY]], [[COPY1]](<4 x s16>)
409 ; CHECK-NEXT: $d0 = COPY [[ASHR]](<4 x s16>)
410 %0:_(<4 x s16>) = COPY $d0
411 %1:_(<4 x s16>) = COPY $d1
412 %2:_(<4 x s16>) = G_ASHR %0, %1
416 name: test_ashr_v8s32
419 ; CHECK-LABEL: name: test_ashr_v8s32
420 ; CHECK: [[DEF:%[0-9]+]]:_(s32) = G_IMPLICIT_DEF
421 ; CHECK-NEXT: [[BUILD_VECTOR:%[0-9]+]]:_(<4 x s32>) = G_BUILD_VECTOR [[DEF]](s32), [[DEF]](s32), [[DEF]](s32), [[DEF]](s32)
422 ; CHECK-NEXT: [[BUILD_VECTOR1:%[0-9]+]]:_(<4 x s32>) = G_BUILD_VECTOR [[DEF]](s32), [[DEF]](s32), [[DEF]](s32), [[DEF]](s32)
423 ; CHECK-NEXT: [[BUILD_VECTOR2:%[0-9]+]]:_(<4 x s32>) = G_BUILD_VECTOR [[DEF]](s32), [[DEF]](s32), [[DEF]](s32), [[DEF]](s32)
424 ; CHECK-NEXT: [[BUILD_VECTOR3:%[0-9]+]]:_(<4 x s32>) = G_BUILD_VECTOR [[DEF]](s32), [[DEF]](s32), [[DEF]](s32), [[DEF]](s32)
425 ; CHECK-NEXT: [[ASHR:%[0-9]+]]:_(<4 x s32>) = G_ASHR [[BUILD_VECTOR]], [[BUILD_VECTOR2]](<4 x s32>)
426 ; CHECK-NEXT: [[ASHR1:%[0-9]+]]:_(<4 x s32>) = G_ASHR [[BUILD_VECTOR1]], [[BUILD_VECTOR3]](<4 x s32>)
427 ; CHECK-NEXT: $q0 = COPY [[ASHR]](<4 x s32>)
428 ; CHECK-NEXT: $q1 = COPY [[ASHR1]](<4 x s32>)
429 %0:_(<8 x s32>) = G_IMPLICIT_DEF
430 %1:_(<8 x s32>) = G_IMPLICIT_DEF
431 %2:_(<8 x s32>) = G_ASHR %0, %1
432 %3:_(<4 x s32>), %4:_(<4 x s32>) = G_UNMERGE_VALUES %2
433 $q0 = COPY %3(<4 x s32>)
434 $q1 = COPY %4(<4 x s32>)
440 ; CHECK-LABEL: name: test_shl_v8s8
441 ; CHECK: [[COPY:%[0-9]+]]:_(<8 x s8>) = COPY $d0
442 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<8 x s8>) = COPY $d1
443 ; CHECK-NEXT: [[SHL:%[0-9]+]]:_(<8 x s8>) = G_SHL [[COPY]], [[COPY1]](<8 x s8>)
444 ; CHECK-NEXT: $d0 = COPY [[SHL]](<8 x s8>)
445 %0:_(<8 x s8>) = COPY $d0
446 %1:_(<8 x s8>) = COPY $d1
447 %2:_(<8 x s8>) = G_SHL %0, %1
454 ; CHECK-LABEL: name: test_ashr_v8s8
455 ; CHECK: [[COPY:%[0-9]+]]:_(<8 x s8>) = COPY $d0
456 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<8 x s8>) = COPY $d1
457 ; CHECK-NEXT: [[ASHR:%[0-9]+]]:_(<8 x s8>) = G_ASHR [[COPY]], [[COPY1]](<8 x s8>)
458 ; CHECK-NEXT: $d0 = COPY [[ASHR]](<8 x s8>)
459 %0:_(<8 x s8>) = COPY $d0
460 %1:_(<8 x s8>) = COPY $d1
461 %2:_(<8 x s8>) = G_ASHR %0, %1
469 ; CHECK-LABEL: name: test_lshr_v8s8
470 ; CHECK: [[COPY:%[0-9]+]]:_(<8 x s8>) = COPY $d0
471 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<8 x s8>) = COPY $d1
472 ; CHECK-NEXT: [[LSHR:%[0-9]+]]:_(<8 x s8>) = G_LSHR [[COPY]], [[COPY1]](<8 x s8>)
473 ; CHECK-NEXT: $d0 = COPY [[LSHR]](<8 x s8>)
474 %0:_(<8 x s8>) = COPY $d0
475 %1:_(<8 x s8>) = COPY $d1
476 %2:_(<8 x s8>) = G_LSHR %0, %1
480 name: test_lshr_nonpow2
483 ; CHECK-LABEL: name: test_lshr_nonpow2
484 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
485 ; CHECK-NEXT: %a:_(s32) = COPY $w1
486 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
487 ; CHECK-NEXT: [[MV:%[0-9]+]]:_(s64) = G_MERGE_VALUES %a(s32), %a(s32)
488 ; CHECK-NEXT: [[MV1:%[0-9]+]]:_(s64) = G_MERGE_VALUES %a(s32), [[C]](s32)
489 ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 64
490 ; CHECK-NEXT: [[SUB:%[0-9]+]]:_(s64) = G_SUB [[COPY]], [[C1]]
491 ; CHECK-NEXT: [[SUB1:%[0-9]+]]:_(s64) = G_SUB [[C1]], [[COPY]]
492 ; CHECK-NEXT: [[C2:%[0-9]+]]:_(s64) = G_CONSTANT i64 0
493 ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(ult), [[COPY]](s64), [[C1]]
494 ; CHECK-NEXT: [[ICMP1:%[0-9]+]]:_(s32) = G_ICMP intpred(eq), [[COPY]](s64), [[C2]]
495 ; CHECK-NEXT: [[LSHR:%[0-9]+]]:_(s64) = G_LSHR [[MV]], [[COPY]](s64)
496 ; CHECK-NEXT: [[SHL:%[0-9]+]]:_(s64) = G_SHL [[MV1]], [[SUB1]](s64)
497 ; CHECK-NEXT: [[OR:%[0-9]+]]:_(s64) = G_OR [[LSHR]], [[SHL]]
498 ; CHECK-NEXT: [[LSHR1:%[0-9]+]]:_(s64) = G_LSHR [[MV1]], [[SUB]](s64)
499 ; CHECK-NEXT: [[C3:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
500 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[ICMP]], [[C3]]
501 ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s64) = G_SELECT [[AND]](s32), [[OR]], [[LSHR1]]
502 ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s32) = G_AND [[ICMP1]], [[C3]]
503 ; CHECK-NEXT: [[SELECT1:%[0-9]+]]:_(s64) = G_SELECT [[AND1]](s32), [[MV]], [[SELECT]]
504 ; CHECK-NEXT: %d1:_(s32), %d2:_(s32) = G_UNMERGE_VALUES [[SELECT1]](s64)
505 ; CHECK-NEXT: $w0 = COPY %d2(s32)
508 %merge:_(s96) = G_MERGE_VALUES %a, %a, %a
509 %lshr:_(s96) = G_LSHR %merge, %0
510 %d1:_(s32), %d2:_(s32), %d3:_(s32) = G_UNMERGE_VALUES %lshr
515 name: test_lshr_nonpow2_wide
518 ; CHECK-LABEL: name: test_lshr_nonpow2_wide
519 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
520 ; CHECK-NEXT: %a:_(s32) = COPY $w1
521 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
522 ; CHECK-NEXT: [[MV:%[0-9]+]]:_(s64) = G_MERGE_VALUES %a(s32), %a(s32)
523 ; CHECK-NEXT: [[MV1:%[0-9]+]]:_(s64) = G_MERGE_VALUES %a(s32), %a(s32)
524 ; CHECK-NEXT: [[MV2:%[0-9]+]]:_(s64) = G_MERGE_VALUES %a(s32), [[C]](s32)
525 ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 0
526 ; CHECK-NEXT: [[C2:%[0-9]+]]:_(s64) = G_CONSTANT i64 128
527 ; CHECK-NEXT: [[SUB:%[0-9]+]]:_(s64) = G_SUB [[COPY]], [[C2]]
528 ; CHECK-NEXT: [[SUB1:%[0-9]+]]:_(s64) = G_SUB [[C2]], [[COPY]]
529 ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(ult), [[COPY]](s64), [[C2]]
530 ; CHECK-NEXT: [[ICMP1:%[0-9]+]]:_(s32) = G_ICMP intpred(eq), [[COPY]](s64), [[C1]]
531 ; CHECK-NEXT: [[C3:%[0-9]+]]:_(s64) = G_CONSTANT i64 64
532 ; CHECK-NEXT: [[C4:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
533 ; CHECK-NEXT: [[SUB2:%[0-9]+]]:_(s64) = G_SUB [[COPY]], [[C3]]
534 ; CHECK-NEXT: [[SUB3:%[0-9]+]]:_(s64) = G_SUB [[C3]], [[COPY]]
535 ; CHECK-NEXT: [[ICMP2:%[0-9]+]]:_(s32) = G_ICMP intpred(ult), [[COPY]](s64), [[C3]]
536 ; CHECK-NEXT: [[ICMP3:%[0-9]+]]:_(s32) = G_ICMP intpred(eq), [[COPY]](s64), [[C1]]
537 ; CHECK-NEXT: [[LSHR:%[0-9]+]]:_(s64) = G_LSHR [[MV]], [[COPY]](s64)
538 ; CHECK-NEXT: [[SHL:%[0-9]+]]:_(s64) = G_SHL [[MV1]], [[SUB3]](s64)
539 ; CHECK-NEXT: [[OR:%[0-9]+]]:_(s64) = G_OR [[LSHR]], [[SHL]]
540 ; CHECK-NEXT: [[LSHR1:%[0-9]+]]:_(s64) = G_LSHR [[MV1]], [[SUB2]](s64)
541 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[ICMP2]], [[C4]]
542 ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s64) = G_SELECT [[AND]](s32), [[OR]], [[LSHR1]]
543 ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s32) = G_AND [[ICMP3]], [[C4]]
544 ; CHECK-NEXT: [[SELECT1:%[0-9]+]]:_(s64) = G_SELECT [[AND1]](s32), [[MV]], [[SELECT]]
545 ; CHECK-NEXT: [[ICMP4:%[0-9]+]]:_(s32) = G_ICMP intpred(ult), [[SUB1]](s64), [[C3]]
546 ; CHECK-NEXT: [[SHL1:%[0-9]+]]:_(s64) = G_SHL [[MV2]], [[SUB1]](s64)
547 ; CHECK-NEXT: [[AND2:%[0-9]+]]:_(s32) = G_AND [[ICMP4]], [[C4]]
548 ; CHECK-NEXT: [[SELECT2:%[0-9]+]]:_(s64) = G_SELECT [[AND2]](s32), [[SHL1]], [[C1]]
549 ; CHECK-NEXT: [[OR1:%[0-9]+]]:_(s64) = G_OR [[SELECT1]], [[SELECT2]]
550 ; CHECK-NEXT: [[SUB4:%[0-9]+]]:_(s64) = G_SUB [[SUB]], [[C3]]
551 ; CHECK-NEXT: [[SUB5:%[0-9]+]]:_(s64) = G_SUB [[C3]], [[SUB]]
552 ; CHECK-NEXT: [[ICMP5:%[0-9]+]]:_(s32) = G_ICMP intpred(ult), [[SUB]](s64), [[C3]]
553 ; CHECK-NEXT: [[ICMP6:%[0-9]+]]:_(s32) = G_ICMP intpred(eq), [[SUB]](s64), [[C1]]
554 ; CHECK-NEXT: [[LSHR2:%[0-9]+]]:_(s64) = G_LSHR [[MV2]], [[SUB]](s64)
555 ; CHECK-NEXT: [[SHL2:%[0-9]+]]:_(s64) = G_SHL [[C1]], [[SUB5]](s64)
556 ; CHECK-NEXT: [[OR2:%[0-9]+]]:_(s64) = G_OR [[LSHR2]], [[SHL2]]
557 ; CHECK-NEXT: [[LSHR3:%[0-9]+]]:_(s64) = G_LSHR [[C1]], [[SUB4]](s64)
558 ; CHECK-NEXT: [[AND3:%[0-9]+]]:_(s32) = G_AND [[ICMP5]], [[C4]]
559 ; CHECK-NEXT: [[SELECT3:%[0-9]+]]:_(s64) = G_SELECT [[AND3]](s32), [[OR2]], [[LSHR3]]
560 ; CHECK-NEXT: [[AND4:%[0-9]+]]:_(s32) = G_AND [[ICMP6]], [[C4]]
561 ; CHECK-NEXT: [[SELECT4:%[0-9]+]]:_(s64) = G_SELECT [[AND4]](s32), [[MV2]], [[SELECT3]]
562 ; CHECK-NEXT: [[AND5:%[0-9]+]]:_(s32) = G_AND [[ICMP]], [[C4]]
563 ; CHECK-NEXT: [[SELECT5:%[0-9]+]]:_(s64) = G_SELECT [[AND5]](s32), [[OR1]], [[SELECT4]]
564 ; CHECK-NEXT: [[AND6:%[0-9]+]]:_(s32) = G_AND [[ICMP1]], [[C4]]
565 ; CHECK-NEXT: [[SELECT6:%[0-9]+]]:_(s64) = G_SELECT [[AND6]](s32), [[MV]], [[SELECT5]]
566 ; CHECK-NEXT: %d1:_(s32), %d2:_(s32) = G_UNMERGE_VALUES [[SELECT6]](s64)
567 ; CHECK-NEXT: $w0 = COPY %d2(s32)
570 %merge:_(s160) = G_MERGE_VALUES %a, %a, %a, %a, %a
571 %lshr:_(s160) = G_LSHR %merge, %0
572 %d1:_(s32), %d2:_(s32), %d3:_(s32), %d4:_(s32), %d5:_(s32) = G_UNMERGE_VALUES %lshr