1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=aarch64 -run-pass=legalizer -global-isel-abort=1 %s -o - | FileCheck %s
4 name: test_scalar_mul_small
7 ; CHECK-LABEL: name: test_scalar_mul_small
8 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
9 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x1
10 ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
11 ; CHECK-NEXT: [[TRUNC1:%[0-9]+]]:_(s32) = G_TRUNC [[COPY1]](s64)
12 ; CHECK-NEXT: [[MUL:%[0-9]+]]:_(s32) = G_MUL [[TRUNC]], [[TRUNC1]]
13 ; CHECK-NEXT: [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT [[MUL]](s32)
14 ; CHECK-NEXT: $x0 = COPY [[ANYEXT]](s64)
17 %2:_(s8) = G_TRUNC %0(s64)
18 %3:_(s8) = G_TRUNC %1(s64)
19 %4:_(s8) = G_MUL %2, %3
20 %5:_(s64) = G_ANYEXT %4(s8)
25 name: test_smul_overflow
28 ; CHECK-LABEL: name: test_smul_overflow
29 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
30 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x1
31 ; CHECK-NEXT: [[SMULH:%[0-9]+]]:_(s64) = G_SMULH [[COPY]], [[COPY1]]
32 ; CHECK-NEXT: [[MUL:%[0-9]+]]:_(s64) = G_MUL [[COPY]], [[COPY1]]
33 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 63
34 ; CHECK-NEXT: [[ASHR:%[0-9]+]]:_(s64) = G_ASHR [[MUL]], [[C]](s64)
35 ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(ne), [[SMULH]](s64), [[ASHR]]
36 ; CHECK-NEXT: $x0 = COPY [[MUL]](s64)
37 ; CHECK-NEXT: $w0 = COPY [[ICMP]](s32)
40 %2:_(s64), %3:_(s1) = G_SMULO %0, %1
42 %4:_(s32) = G_ANYEXT %3(s1)
47 name: test_umul_overflow
50 ; CHECK-LABEL: name: test_umul_overflow
51 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
52 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x1
53 ; CHECK-NEXT: [[UMULH:%[0-9]+]]:_(s64) = G_UMULH [[COPY]], [[COPY1]]
54 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 0
55 ; CHECK-NEXT: [[MUL:%[0-9]+]]:_(s64) = G_MUL [[COPY]], [[COPY1]]
56 ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(ne), [[UMULH]](s64), [[C]]
57 ; CHECK-NEXT: $x0 = COPY [[MUL]](s64)
58 ; CHECK-NEXT: $w0 = COPY [[ICMP]](s32)
61 %2:_(s64), %3:_(s1) = G_UMULO %0, %1
63 %4:_(s32) = G_ANYEXT %3(s1)
68 name: test_smul_overflow_s32
71 ; CHECK-LABEL: name: test_smul_overflow_s32
72 ; CHECK: %lhs:_(s32) = COPY $w0
73 ; CHECK-NEXT: %rhs:_(s32) = COPY $w1
74 ; CHECK-NEXT: [[SEXT:%[0-9]+]]:_(s64) = G_SEXT %lhs(s32)
75 ; CHECK-NEXT: [[SEXT1:%[0-9]+]]:_(s64) = G_SEXT %rhs(s32)
76 ; CHECK-NEXT: [[MUL:%[0-9]+]]:_(s64) = G_MUL [[SEXT]], [[SEXT1]]
77 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 32
78 ; CHECK-NEXT: [[ASHR:%[0-9]+]]:_(s64) = G_ASHR [[MUL]], [[C]](s64)
79 ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:_(s32) = G_TRUNC [[ASHR]](s64)
80 ; CHECK-NEXT: %mul:_(s32) = G_MUL %lhs, %rhs
81 ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 31
82 ; CHECK-NEXT: [[ASHR1:%[0-9]+]]:_(s32) = G_ASHR %mul, [[C1]](s64)
83 ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(ne), [[TRUNC]](s32), [[ASHR1]]
84 ; CHECK-NEXT: $w0 = COPY %mul(s32)
85 ; CHECK-NEXT: $w0 = COPY [[ICMP]](s32)
86 ; CHECK-NEXT: RET_ReallyLR implicit $w0
87 %lhs:_(s32) = COPY $w0
88 %rhs:_(s32) = COPY $w1
89 %mul:_(s32), %overflow:_(s1) = G_SMULO %lhs, %rhs
91 %ext_overflow:_(s32) = G_ANYEXT %overflow(s1)
92 $w0 = COPY %ext_overflow(s32)
93 RET_ReallyLR implicit $w0
97 name: test_umul_overflow_s32
100 ; CHECK-LABEL: name: test_umul_overflow_s32
101 ; CHECK: %lhs:_(s32) = COPY $w0
102 ; CHECK-NEXT: %rhs:_(s32) = COPY $w1
103 ; CHECK-NEXT: [[ZEXT:%[0-9]+]]:_(s64) = G_ZEXT %lhs(s32)
104 ; CHECK-NEXT: [[ZEXT1:%[0-9]+]]:_(s64) = G_ZEXT %rhs(s32)
105 ; CHECK-NEXT: [[MUL:%[0-9]+]]:_(s64) = G_MUL [[ZEXT]], [[ZEXT1]]
106 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 32
107 ; CHECK-NEXT: [[LSHR:%[0-9]+]]:_(s64) = G_LSHR [[MUL]], [[C]](s64)
108 ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:_(s32) = G_TRUNC [[LSHR]](s64)
109 ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
110 ; CHECK-NEXT: %mul:_(s32) = G_MUL %lhs, %rhs
111 ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(ne), [[TRUNC]](s32), [[C1]]
112 ; CHECK-NEXT: $w0 = COPY %mul(s32)
113 ; CHECK-NEXT: $w0 = COPY [[ICMP]](s32)
114 ; CHECK-NEXT: RET_ReallyLR implicit $w0
115 %lhs:_(s32) = COPY $w0
116 %rhs:_(s32) = COPY $w1
117 %mul:_(s32), %overflow:_(s1) = G_UMULO %lhs, %rhs
119 %ext_overflow:_(s32) = G_ANYEXT %overflow(s1)
120 $w0 = COPY %ext_overflow(s32)
121 RET_ReallyLR implicit $w0
125 name: test_umul_overflow_s24
128 ; CHECK-LABEL: name: test_umul_overflow_s24
129 ; CHECK: %lhs_wide:_(s32) = COPY $w0
130 ; CHECK-NEXT: %rhs_wide:_(s32) = COPY $w1
131 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 16777215
132 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND %lhs_wide, [[C]]
133 ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s32) = G_AND %rhs_wide, [[C]]
134 ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 16777215
135 ; CHECK-NEXT: [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT %lhs_wide(s32)
136 ; CHECK-NEXT: [[AND2:%[0-9]+]]:_(s64) = G_AND [[ANYEXT]], [[C1]]
137 ; CHECK-NEXT: [[ANYEXT1:%[0-9]+]]:_(s64) = G_ANYEXT %rhs_wide(s32)
138 ; CHECK-NEXT: [[AND3:%[0-9]+]]:_(s64) = G_AND [[ANYEXT1]], [[C1]]
139 ; CHECK-NEXT: [[MUL:%[0-9]+]]:_(s64) = G_MUL [[AND2]], [[AND3]]
140 ; CHECK-NEXT: [[C2:%[0-9]+]]:_(s64) = G_CONSTANT i64 32
141 ; CHECK-NEXT: [[LSHR:%[0-9]+]]:_(s64) = G_LSHR [[MUL]], [[C2]](s64)
142 ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:_(s32) = G_TRUNC [[LSHR]](s64)
143 ; CHECK-NEXT: [[C3:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
144 ; CHECK-NEXT: [[MUL1:%[0-9]+]]:_(s32) = G_MUL [[AND]], [[AND1]]
145 ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(ne), [[TRUNC]](s32), [[C3]]
146 ; CHECK-NEXT: [[AND4:%[0-9]+]]:_(s32) = G_AND [[MUL1]], [[C]]
147 ; CHECK-NEXT: [[ICMP1:%[0-9]+]]:_(s32) = G_ICMP intpred(ne), [[MUL1]](s32), [[AND4]]
148 ; CHECK-NEXT: [[OR:%[0-9]+]]:_(s32) = G_OR [[ICMP]], [[ICMP1]]
149 ; CHECK-NEXT: $w0 = COPY [[MUL1]](s32)
150 ; CHECK-NEXT: $w0 = COPY [[OR]](s32)
151 ; CHECK-NEXT: RET_ReallyLR implicit $w0
152 %lhs_wide:_(s32) = COPY $w0
153 %rhs_wide:_(s32) = COPY $w1
154 %lhs:_(s24) = G_TRUNC %lhs_wide
155 %rhs:_(s24) = G_TRUNC %rhs_wide
156 %mul:_(s24), %overflow:_(s1) = G_UMULO %lhs, %rhs
157 %ext_mul:_(s32) = G_ANYEXT %mul
158 $w0 = COPY %ext_mul(s32)
159 %ext_overflow:_(s32) = G_ANYEXT %overflow(s1)
160 $w0 = COPY %ext_overflow(s32)
161 RET_ReallyLR implicit $w0
165 name: vector_mul_scalarize
173 ; CHECK-LABEL: name: vector_mul_scalarize
174 ; CHECK: liveins: $q0, $q1
176 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<2 x s64>) = COPY $q0
177 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<2 x s64>) = COPY $q1
178 ; CHECK-NEXT: [[MUL:%[0-9]+]]:_(<2 x s64>) = G_MUL [[COPY]], [[COPY1]]
179 ; CHECK-NEXT: $q0 = COPY [[MUL]](<2 x s64>)
180 ; CHECK-NEXT: RET_ReallyLR implicit $q0
181 %0:_(<2 x s64>) = COPY $q0
182 %1:_(<2 x s64>) = COPY $q1
183 %2:_(<2 x s64>) = G_MUL %0, %1
184 $q0 = COPY %2(<2 x s64>)
185 RET_ReallyLR implicit $q0
188 name: test_umulo_overflow_no_invalid_mir
190 tracksRegLiveness: true
198 - { id: 0, size: 8, alignment: 8 }
199 - { id: 1, size: 8, alignment: 8 }
200 - { id: 2, size: 16, alignment: 16 }
201 - { id: 3, size: 16, alignment: 8 }
202 machineFunctionInfo: {}
205 liveins: $x0, $x1, $x2
206 ; Check that the overflow result doesn't generate incorrect MIR by using a G_CONSTANT 0
207 ; before it's been defined.
208 ; CHECK-LABEL: name: test_umulo_overflow_no_invalid_mir
209 ; CHECK: liveins: $x0, $x1, $x2
211 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $x0
212 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x1
213 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s64) = COPY $x2
214 ; CHECK-NEXT: [[FRAME_INDEX:%[0-9]+]]:_(p0) = G_FRAME_INDEX %stack.0
215 ; CHECK-NEXT: [[FRAME_INDEX1:%[0-9]+]]:_(p0) = G_FRAME_INDEX %stack.1
216 ; CHECK-NEXT: [[FRAME_INDEX2:%[0-9]+]]:_(p0) = G_FRAME_INDEX %stack.3
217 ; CHECK-NEXT: G_STORE [[COPY2]](s64), [[FRAME_INDEX]](p0) :: (store (s64))
218 ; CHECK-NEXT: G_STORE [[COPY1]](s64), [[FRAME_INDEX1]](p0) :: (store (s64))
219 ; CHECK-NEXT: [[LOAD:%[0-9]+]]:_(s64) = G_LOAD [[FRAME_INDEX]](p0) :: (dereferenceable load (s64))
220 ; CHECK-NEXT: [[LOAD1:%[0-9]+]]:_(s64) = G_LOAD [[FRAME_INDEX1]](p0) :: (dereferenceable load (s64))
221 ; CHECK-NEXT: [[UMULH:%[0-9]+]]:_(s64) = G_UMULH [[LOAD]], [[LOAD1]]
222 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 0
223 ; CHECK-NEXT: [[MUL:%[0-9]+]]:_(s64) = G_MUL [[LOAD]], [[LOAD1]]
224 ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(ne), [[UMULH]](s64), [[C]]
225 ; CHECK-NEXT: G_STORE [[C]](s64), [[FRAME_INDEX2]](p0) :: (store (s64), align 1)
226 ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 1
227 ; CHECK-NEXT: [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT [[ICMP]](s32)
228 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[ANYEXT]], [[C1]]
229 ; CHECK-NEXT: $x0 = COPY [[MUL]](s64)
230 ; CHECK-NEXT: $x1 = COPY [[AND]](s64)
231 ; CHECK-NEXT: RET_ReallyLR implicit $x0
235 %25:_(s32) = G_CONSTANT i32 0
236 %3:_(p0) = G_FRAME_INDEX %stack.0
237 %4:_(p0) = G_FRAME_INDEX %stack.1
238 %6:_(p0) = G_FRAME_INDEX %stack.3
239 G_STORE %2(s64), %3(p0) :: (store (s64))
240 G_STORE %1(s64), %4(p0) :: (store (s64))
241 %7:_(s64) = G_LOAD %3(p0) :: (dereferenceable load (s64))
242 %8:_(s64) = G_LOAD %4(p0) :: (dereferenceable load (s64))
243 %9:_(s64), %10:_(s1) = G_UMULO %7, %8
244 %31:_(s64) = G_CONSTANT i64 0
245 G_STORE %31(s64), %6(p0) :: (store (s64), align 1)
246 %16:_(s64) = G_ZEXT %10(s1)
249 RET_ReallyLR implicit $x0
254 exposesReturnsTwice: false
255 tracksRegLiveness: true
260 ; CHECK-LABEL: name: umulh_s32
261 ; CHECK: liveins: $w0, $w1
263 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $w0
264 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $w1
265 ; CHECK-NEXT: [[ZEXT:%[0-9]+]]:_(s64) = G_ZEXT [[COPY]](s32)
266 ; CHECK-NEXT: [[ZEXT1:%[0-9]+]]:_(s64) = G_ZEXT [[COPY1]](s32)
267 ; CHECK-NEXT: [[MUL:%[0-9]+]]:_(s64) = G_MUL [[ZEXT]], [[ZEXT1]]
268 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 32
269 ; CHECK-NEXT: [[LSHR:%[0-9]+]]:_(s64) = G_LSHR [[MUL]], [[C]](s64)
270 ; CHECK-NEXT: %mul:_(s32) = G_TRUNC [[LSHR]](s64)
271 ; CHECK-NEXT: $w0 = COPY %mul(s32)
272 ; CHECK-NEXT: RET_ReallyLR implicit $w0
275 %mul:_(s32) = G_UMULH %0, %1
277 RET_ReallyLR implicit $w0
282 exposesReturnsTwice: false
283 tracksRegLiveness: true
288 ; CHECK-LABEL: name: smulh_s32
289 ; CHECK: liveins: $w0, $w1
291 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $w0
292 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $w1
293 ; CHECK-NEXT: [[SEXT:%[0-9]+]]:_(s64) = G_SEXT [[COPY]](s32)
294 ; CHECK-NEXT: [[SEXT1:%[0-9]+]]:_(s64) = G_SEXT [[COPY1]](s32)
295 ; CHECK-NEXT: [[MUL:%[0-9]+]]:_(s64) = G_MUL [[SEXT]], [[SEXT1]]
296 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 32
297 ; CHECK-NEXT: [[ASHR:%[0-9]+]]:_(s64) = G_ASHR [[MUL]], [[C]](s64)
298 ; CHECK-NEXT: %mul:_(s32) = G_TRUNC [[ASHR]](s64)
299 ; CHECK-NEXT: $w0 = COPY %mul(s32)
300 ; CHECK-NEXT: RET_ReallyLR implicit $w0
303 %mul:_(s32) = G_SMULH %0, %1
305 RET_ReallyLR implicit $w0
310 exposesReturnsTwice: false
311 tracksRegLiveness: true
313 - { reg: '$q0', virtual-reg: '' }
318 ; CHECK-LABEL: name: umulh_v8s16
319 ; CHECK: liveins: $q0, $q1
321 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<8 x s16>) = COPY $q0
322 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<8 x s16>) = COPY $q1
323 ; CHECK-NEXT: %mul:_(<8 x s16>) = G_UMULH [[COPY]], [[COPY1]]
324 ; CHECK-NEXT: $q0 = COPY %mul(<8 x s16>)
325 ; CHECK-NEXT: RET_ReallyLR implicit $q0
326 %0:_(<8 x s16>) = COPY $q0
327 %1:_(<8 x s16>) = COPY $q1
328 %mul:_(<8 x s16>) = G_UMULH %0, %1
329 $q0 = COPY %mul(<8 x s16>)
330 RET_ReallyLR implicit $q0
335 exposesReturnsTwice: false
336 tracksRegLiveness: true
338 - { reg: '$q0', virtual-reg: '' }
343 ; CHECK-LABEL: name: umulh_v16s8
344 ; CHECK: liveins: $q0, $q1
346 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<16 x s8>) = COPY $q0
347 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<16 x s8>) = COPY $q1
348 ; CHECK-NEXT: %mul:_(<16 x s8>) = G_UMULH [[COPY]], [[COPY1]]
349 ; CHECK-NEXT: $q0 = COPY %mul(<16 x s8>)
350 ; CHECK-NEXT: RET_ReallyLR implicit $q0
351 %0:_(<16 x s8>) = COPY $q0
352 %1:_(<16 x s8>) = COPY $q1
353 %mul:_(<16 x s8>) = G_UMULH %0, %1
354 $q0 = COPY %mul(<16 x s8>)
355 RET_ReallyLR implicit $q0
360 exposesReturnsTwice: false
361 tracksRegLiveness: true
363 - { reg: '$q0', virtual-reg: '' }
368 ; CHECK-LABEL: name: umulh_v4s32
369 ; CHECK: liveins: $q0, $q1
371 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<4 x s32>) = COPY $q0
372 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<4 x s32>) = COPY $q1
373 ; CHECK-NEXT: %mul:_(<4 x s32>) = G_UMULH [[COPY]], [[COPY1]]
374 ; CHECK-NEXT: $q0 = COPY %mul(<4 x s32>)
375 ; CHECK-NEXT: RET_ReallyLR implicit $q0
376 %0:_(<4 x s32>) = COPY $q0
377 %1:_(<4 x s32>) = COPY $q1
378 %mul:_(<4 x s32>) = G_UMULH %0, %1
379 $q0 = COPY %mul(<4 x s32>)
380 RET_ReallyLR implicit $q0
385 exposesReturnsTwice: false
386 tracksRegLiveness: true
388 - { reg: '$q0', virtual-reg: '' }
393 ; CHECK-LABEL: name: smulh_v8s16
394 ; CHECK: liveins: $q0, $q1
396 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<8 x s16>) = COPY $q0
397 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<8 x s16>) = COPY $q1
398 ; CHECK-NEXT: %mul:_(<8 x s16>) = G_SMULH [[COPY]], [[COPY1]]
399 ; CHECK-NEXT: $q0 = COPY %mul(<8 x s16>)
400 ; CHECK-NEXT: RET_ReallyLR implicit $q0
401 %0:_(<8 x s16>) = COPY $q0
402 %1:_(<8 x s16>) = COPY $q1
403 %mul:_(<8 x s16>) = G_SMULH %0, %1
404 $q0 = COPY %mul(<8 x s16>)
405 RET_ReallyLR implicit $q0
410 exposesReturnsTwice: false
411 tracksRegLiveness: true
413 - { reg: '$q0', virtual-reg: '' }
418 ; CHECK-LABEL: name: smulh_v16s8
419 ; CHECK: liveins: $q0, $q1
421 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<16 x s8>) = COPY $q0
422 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<16 x s8>) = COPY $q1
423 ; CHECK-NEXT: %mul:_(<16 x s8>) = G_SMULH [[COPY]], [[COPY1]]
424 ; CHECK-NEXT: $q0 = COPY %mul(<16 x s8>)
425 ; CHECK-NEXT: RET_ReallyLR implicit $q0
426 %0:_(<16 x s8>) = COPY $q0
427 %1:_(<16 x s8>) = COPY $q1
428 %mul:_(<16 x s8>) = G_SMULH %0, %1
429 $q0 = COPY %mul(<16 x s8>)
430 RET_ReallyLR implicit $q0
435 exposesReturnsTwice: false
436 tracksRegLiveness: true
438 - { reg: '$q0', virtual-reg: '' }
443 ; CHECK-LABEL: name: smulh_v4s32
444 ; CHECK: liveins: $q0, $q1
446 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<4 x s32>) = COPY $q0
447 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<4 x s32>) = COPY $q1
448 ; CHECK-NEXT: %mul:_(<4 x s32>) = G_SMULH [[COPY]], [[COPY1]]
449 ; CHECK-NEXT: $q0 = COPY %mul(<4 x s32>)
450 ; CHECK-NEXT: RET_ReallyLR implicit $q0
451 %0:_(<4 x s32>) = COPY $q0
452 %1:_(<4 x s32>) = COPY $q1
453 %mul:_(<4 x s32>) = G_SMULH %0, %1
454 $q0 = COPY %mul(<4 x s32>)
455 RET_ReallyLR implicit $q0
459 name: test_vector_mul_v16s16
462 ; CHECK-LABEL: name: test_vector_mul_v16s16
463 ; CHECK: [[COPY:%[0-9]+]]:_(<8 x s16>) = COPY $q0
464 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<8 x s16>) = COPY $q1
465 ; CHECK-NEXT: [[MUL:%[0-9]+]]:_(<8 x s16>) = G_MUL [[COPY]], [[COPY]]
466 ; CHECK-NEXT: [[MUL1:%[0-9]+]]:_(<8 x s16>) = G_MUL [[COPY1]], [[COPY1]]
467 ; CHECK-NEXT: $q0 = COPY [[MUL]](<8 x s16>)
468 ; CHECK-NEXT: $q1 = COPY [[MUL1]](<8 x s16>)
469 %1:_(<8 x s16>) = COPY $q0
470 %2:_(<8 x s16>) = COPY $q1
471 %0:_(<16 x s16>) = G_CONCAT_VECTORS %1(<8 x s16>), %2(<8 x s16>)
472 %3:_(<16 x s16>) = G_MUL %0, %0
473 %4:_(<8 x s16>), %5:_(<8 x s16>) = G_UNMERGE_VALUES %3(<16 x s16>)
474 $q0 = COPY %4(<8 x s16>)
475 $q1 = COPY %5(<8 x s16>)
479 name: test_vector_mul_v32s8
482 ; CHECK-LABEL: name: test_vector_mul_v32s8
483 ; CHECK: [[COPY:%[0-9]+]]:_(<16 x s8>) = COPY $q0
484 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<16 x s8>) = COPY $q1
485 ; CHECK-NEXT: [[MUL:%[0-9]+]]:_(<16 x s8>) = G_MUL [[COPY]], [[COPY]]
486 ; CHECK-NEXT: [[MUL1:%[0-9]+]]:_(<16 x s8>) = G_MUL [[COPY1]], [[COPY1]]
487 ; CHECK-NEXT: $q0 = COPY [[MUL]](<16 x s8>)
488 ; CHECK-NEXT: $q1 = COPY [[MUL1]](<16 x s8>)
489 %0:_(<16 x s8>) = COPY $q0
490 %1:_(<16 x s8>) = COPY $q1
491 %2:_(<32 x s8>) = G_CONCAT_VECTORS %0, %1
492 %3:_(<32 x s8>) = G_MUL %2, %2
493 %7:_(<16 x s8>), %8:_(<16 x s8>) = G_UNMERGE_VALUES %3(<32 x s8>)
494 $q0 = COPY %7(<16 x s8>)
495 $q1 = COPY %8(<16 x s8>)
500 tracksRegLiveness: true
503 liveins: $d0, $d1, $d2, $d3
505 ; CHECK-LABEL: name: mul_v2s1
506 ; CHECK: liveins: $d0, $d1, $d2, $d3
508 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<2 x s32>) = COPY $d0
509 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<2 x s32>) = COPY $d1
510 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(<2 x s32>) = COPY $d2
511 ; CHECK-NEXT: [[COPY3:%[0-9]+]]:_(<2 x s32>) = COPY $d3
512 ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(<2 x s32>) = G_ICMP intpred(eq), [[COPY]](<2 x s32>), [[COPY1]]
513 ; CHECK-NEXT: [[ICMP1:%[0-9]+]]:_(<2 x s32>) = G_ICMP intpred(eq), [[COPY2]](<2 x s32>), [[COPY3]]
514 ; CHECK-NEXT: [[MUL:%[0-9]+]]:_(<2 x s32>) = G_MUL [[ICMP]], [[ICMP1]]
515 ; CHECK-NEXT: $d0 = COPY [[MUL]](<2 x s32>)
516 ; CHECK-NEXT: RET_ReallyLR implicit $d0
517 %0:_(<2 x s32>) = COPY $d0
518 %1:_(<2 x s32>) = COPY $d1
519 %2:_(<2 x s32>) = COPY $d2
520 %3:_(<2 x s32>) = COPY $d3
521 %4:_(<2 x s1>) = G_ICMP intpred(eq), %0(<2 x s32>), %1
522 %5:_(<2 x s1>) = G_ICMP intpred(eq), %2(<2 x s32>), %3
523 %6:_(<2 x s1>) = G_MUL %4, %5
524 %7:_(<2 x s32>) = G_ANYEXT %6
525 $d0 = COPY %7:_(<2 x s32>)
526 RET_ReallyLR implicit $d0
530 tracksRegLiveness: true
533 liveins: $b0, $b1, $b2
535 ; CHECK-LABEL: name: mul_v3s1
536 ; CHECK: liveins: $b0, $b1, $b2
538 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s8) = COPY $b0
539 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s8) = COPY $b1
540 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s8) = COPY $b2
541 ; CHECK-NEXT: [[ANYEXT:%[0-9]+]]:_(s16) = G_ANYEXT [[COPY]](s8)
542 ; CHECK-NEXT: [[ANYEXT1:%[0-9]+]]:_(s16) = G_ANYEXT [[COPY1]](s8)
543 ; CHECK-NEXT: [[ANYEXT2:%[0-9]+]]:_(s16) = G_ANYEXT [[COPY2]](s8)
544 ; CHECK-NEXT: [[DEF:%[0-9]+]]:_(s16) = G_IMPLICIT_DEF
545 ; CHECK-NEXT: [[BUILD_VECTOR:%[0-9]+]]:_(<4 x s16>) = G_BUILD_VECTOR [[ANYEXT]](s16), [[ANYEXT1]](s16), [[ANYEXT2]](s16), [[DEF]](s16)
546 ; CHECK-NEXT: [[MUL:%[0-9]+]]:_(<4 x s16>) = G_MUL [[BUILD_VECTOR]], [[BUILD_VECTOR]]
547 ; CHECK-NEXT: [[UV:%[0-9]+]]:_(s16), [[UV1:%[0-9]+]]:_(s16), [[UV2:%[0-9]+]]:_(s16), [[UV3:%[0-9]+]]:_(s16) = G_UNMERGE_VALUES [[MUL]](<4 x s16>)
548 ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:_(s8) = G_TRUNC [[UV]](s16)
549 ; CHECK-NEXT: $b0 = COPY [[TRUNC]](s8)
550 ; CHECK-NEXT: RET_ReallyLR implicit $b0
554 %4:_(<3 x s8>) = G_BUILD_VECTOR %1(s8), %2(s8), %3(s8)
555 %0:_(<3 x s1>) = G_TRUNC %4(<3 x s8>)
556 %5:_(<3 x s1>) = G_MUL %0, %0
557 %7:_(<3 x s8>) = G_ANYEXT %5(<3 x s1>)
558 %8:_(s8), %9:_(s8), %10:_(s8) = G_UNMERGE_VALUES %7(<3 x s8>)
560 RET_ReallyLR implicit $b0
564 tracksRegLiveness: true
567 liveins: $d0, $d1, $d2, $d3
569 ; CHECK-LABEL: name: mul_v4s1
570 ; CHECK: liveins: $d0, $d1, $d2, $d3
572 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<4 x s16>) = COPY $d0
573 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<4 x s16>) = COPY $d1
574 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(<4 x s16>) = COPY $d2
575 ; CHECK-NEXT: [[COPY3:%[0-9]+]]:_(<4 x s16>) = COPY $d3
576 ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(<4 x s16>) = G_ICMP intpred(eq), [[COPY]](<4 x s16>), [[COPY1]]
577 ; CHECK-NEXT: [[ICMP1:%[0-9]+]]:_(<4 x s16>) = G_ICMP intpred(eq), [[COPY2]](<4 x s16>), [[COPY3]]
578 ; CHECK-NEXT: [[MUL:%[0-9]+]]:_(<4 x s16>) = G_MUL [[ICMP]], [[ICMP1]]
579 ; CHECK-NEXT: $d0 = COPY [[MUL]](<4 x s16>)
580 ; CHECK-NEXT: RET_ReallyLR implicit $d0
581 %0:_(<4 x s16>) = COPY $d0
582 %1:_(<4 x s16>) = COPY $d1
583 %2:_(<4 x s16>) = COPY $d2
584 %3:_(<4 x s16>) = COPY $d3
585 %4:_(<4 x s1>) = G_ICMP intpred(eq), %0(<4 x s16>), %1
586 %5:_(<4 x s1>) = G_ICMP intpred(eq), %2(<4 x s16>), %3
587 %6:_(<4 x s1>) = G_MUL %4, %5
588 %7:_(<4 x s16>) = G_ANYEXT %6
589 $d0 = COPY %7:_(<4 x s16>)
590 RET_ReallyLR implicit $d0
594 tracksRegLiveness: true
597 liveins: $d0, $d1, $d2, $d3
599 ; CHECK-LABEL: name: mul_v8s1
600 ; CHECK: liveins: $d0, $d1, $d2, $d3
602 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<8 x s8>) = COPY $d0
603 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<8 x s8>) = COPY $d1
604 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(<8 x s8>) = COPY $d2
605 ; CHECK-NEXT: [[COPY3:%[0-9]+]]:_(<8 x s8>) = COPY $d3
606 ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(<8 x s8>) = G_ICMP intpred(eq), [[COPY]](<8 x s8>), [[COPY1]]
607 ; CHECK-NEXT: [[ICMP1:%[0-9]+]]:_(<8 x s8>) = G_ICMP intpred(eq), [[COPY2]](<8 x s8>), [[COPY3]]
608 ; CHECK-NEXT: [[MUL:%[0-9]+]]:_(<8 x s8>) = G_MUL [[ICMP]], [[ICMP1]]
609 ; CHECK-NEXT: $d0 = COPY [[MUL]](<8 x s8>)
610 ; CHECK-NEXT: RET_ReallyLR implicit $d0
611 %0:_(<8 x s8>) = COPY $d0
612 %1:_(<8 x s8>) = COPY $d1
613 %2:_(<8 x s8>) = COPY $d2
614 %3:_(<8 x s8>) = COPY $d3
615 %4:_(<8 x s1>) = G_ICMP intpred(eq), %0(<8 x s8>), %1
616 %5:_(<8 x s1>) = G_ICMP intpred(eq), %2(<8 x s8>), %3
617 %6:_(<8 x s1>) = G_MUL %4, %5
618 %7:_(<8 x s8>) = G_ANYEXT %6
619 $d0 = COPY %7:_(<8 x s8>)
620 RET_ReallyLR implicit $d0
624 tracksRegLiveness: true
627 liveins: $q0, $q1, $q2, $q3
629 ; CHECK-LABEL: name: mul_v16s1
630 ; CHECK: liveins: $q0, $q1, $q2, $q3
632 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<16 x s8>) = COPY $q0
633 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<16 x s8>) = COPY $q1
634 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(<16 x s8>) = COPY $q2
635 ; CHECK-NEXT: [[COPY3:%[0-9]+]]:_(<16 x s8>) = COPY $q3
636 ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(<16 x s8>) = G_ICMP intpred(eq), [[COPY]](<16 x s8>), [[COPY1]]
637 ; CHECK-NEXT: [[ICMP1:%[0-9]+]]:_(<16 x s8>) = G_ICMP intpred(eq), [[COPY2]](<16 x s8>), [[COPY3]]
638 ; CHECK-NEXT: [[MUL:%[0-9]+]]:_(<16 x s8>) = G_MUL [[ICMP]], [[ICMP1]]
639 ; CHECK-NEXT: $q0 = COPY [[MUL]](<16 x s8>)
640 ; CHECK-NEXT: RET_ReallyLR implicit $q0
641 %0:_(<16 x s8>) = COPY $q0
642 %1:_(<16 x s8>) = COPY $q1
643 %2:_(<16 x s8>) = COPY $q2
644 %3:_(<16 x s8>) = COPY $q3
645 %4:_(<16 x s1>) = G_ICMP intpred(eq), %0(<16 x s8>), %1
646 %5:_(<16 x s1>) = G_ICMP intpred(eq), %2(<16 x s8>), %3
647 %6:_(<16 x s1>) = G_MUL %4, %5
648 %7:_(<16 x s8>) = G_ANYEXT %6
649 $q0 = COPY %7:_(<16 x s8>)
650 RET_ReallyLR implicit $q0