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: [[UV:%[0-9]+]]:_(s64), [[UV1:%[0-9]+]]:_(s64) = G_UNMERGE_VALUES [[COPY]](<2 x s64>)
179 ; CHECK-NEXT: [[UV2:%[0-9]+]]:_(s64), [[UV3:%[0-9]+]]:_(s64) = G_UNMERGE_VALUES [[COPY1]](<2 x s64>)
180 ; CHECK-NEXT: [[MUL:%[0-9]+]]:_(s64) = G_MUL [[UV]], [[UV2]]
181 ; CHECK-NEXT: [[MUL1:%[0-9]+]]:_(s64) = G_MUL [[UV1]], [[UV3]]
182 ; CHECK-NEXT: [[BUILD_VECTOR:%[0-9]+]]:_(<2 x s64>) = G_BUILD_VECTOR [[MUL]](s64), [[MUL1]](s64)
183 ; CHECK-NEXT: $q0 = COPY [[BUILD_VECTOR]](<2 x s64>)
184 ; CHECK-NEXT: RET_ReallyLR implicit $q0
185 %0:_(<2 x s64>) = COPY $q0
186 %1:_(<2 x s64>) = COPY $q1
187 %2:_(<2 x s64>) = G_MUL %0, %1
188 $q0 = COPY %2(<2 x s64>)
189 RET_ReallyLR implicit $q0
192 name: test_umulo_overflow_no_invalid_mir
194 tracksRegLiveness: true
202 - { id: 0, size: 8, alignment: 8 }
203 - { id: 1, size: 8, alignment: 8 }
204 - { id: 2, size: 16, alignment: 16 }
205 - { id: 3, size: 16, alignment: 8 }
206 machineFunctionInfo: {}
209 liveins: $x0, $x1, $x2
210 ; Check that the overflow result doesn't generate incorrect MIR by using a G_CONSTANT 0
211 ; before it's been defined.
212 ; CHECK-LABEL: name: test_umulo_overflow_no_invalid_mir
213 ; CHECK: liveins: $x0, $x1, $x2
215 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $x0
216 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x1
217 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s64) = COPY $x2
218 ; CHECK-NEXT: [[FRAME_INDEX:%[0-9]+]]:_(p0) = G_FRAME_INDEX %stack.0
219 ; CHECK-NEXT: [[FRAME_INDEX1:%[0-9]+]]:_(p0) = G_FRAME_INDEX %stack.1
220 ; CHECK-NEXT: [[FRAME_INDEX2:%[0-9]+]]:_(p0) = G_FRAME_INDEX %stack.3
221 ; CHECK-NEXT: G_STORE [[COPY2]](s64), [[FRAME_INDEX]](p0) :: (store (s64))
222 ; CHECK-NEXT: G_STORE [[COPY1]](s64), [[FRAME_INDEX1]](p0) :: (store (s64))
223 ; CHECK-NEXT: [[LOAD:%[0-9]+]]:_(s64) = G_LOAD [[FRAME_INDEX]](p0) :: (dereferenceable load (s64))
224 ; CHECK-NEXT: [[LOAD1:%[0-9]+]]:_(s64) = G_LOAD [[FRAME_INDEX1]](p0) :: (dereferenceable load (s64))
225 ; CHECK-NEXT: [[UMULH:%[0-9]+]]:_(s64) = G_UMULH [[LOAD]], [[LOAD1]]
226 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 0
227 ; CHECK-NEXT: [[MUL:%[0-9]+]]:_(s64) = G_MUL [[LOAD]], [[LOAD1]]
228 ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(ne), [[UMULH]](s64), [[C]]
229 ; CHECK-NEXT: G_STORE [[C]](s64), [[FRAME_INDEX2]](p0) :: (store (s64), align 1)
230 ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 1
231 ; CHECK-NEXT: [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT [[ICMP]](s32)
232 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[ANYEXT]], [[C1]]
233 ; CHECK-NEXT: $x0 = COPY [[MUL]](s64)
234 ; CHECK-NEXT: $x1 = COPY [[AND]](s64)
235 ; CHECK-NEXT: RET_ReallyLR implicit $x0
239 %25:_(s32) = G_CONSTANT i32 0
240 %3:_(p0) = G_FRAME_INDEX %stack.0
241 %4:_(p0) = G_FRAME_INDEX %stack.1
242 %6:_(p0) = G_FRAME_INDEX %stack.3
243 G_STORE %2(s64), %3(p0) :: (store (s64))
244 G_STORE %1(s64), %4(p0) :: (store (s64))
245 %7:_(s64) = G_LOAD %3(p0) :: (dereferenceable load (s64))
246 %8:_(s64) = G_LOAD %4(p0) :: (dereferenceable load (s64))
247 %9:_(s64), %10:_(s1) = G_UMULO %7, %8
248 %31:_(s64) = G_CONSTANT i64 0
249 G_STORE %31(s64), %6(p0) :: (store (s64), align 1)
250 %16:_(s64) = G_ZEXT %10(s1)
253 RET_ReallyLR implicit $x0
258 exposesReturnsTwice: false
259 tracksRegLiveness: true
264 ; CHECK-LABEL: name: umulh_s32
265 ; CHECK: liveins: $w0, $w1
267 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $w0
268 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $w1
269 ; CHECK-NEXT: [[ZEXT:%[0-9]+]]:_(s64) = G_ZEXT [[COPY]](s32)
270 ; CHECK-NEXT: [[ZEXT1:%[0-9]+]]:_(s64) = G_ZEXT [[COPY1]](s32)
271 ; CHECK-NEXT: [[MUL:%[0-9]+]]:_(s64) = G_MUL [[ZEXT]], [[ZEXT1]]
272 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 32
273 ; CHECK-NEXT: [[LSHR:%[0-9]+]]:_(s64) = G_LSHR [[MUL]], [[C]](s64)
274 ; CHECK-NEXT: %mul:_(s32) = G_TRUNC [[LSHR]](s64)
275 ; CHECK-NEXT: $w0 = COPY %mul(s32)
276 ; CHECK-NEXT: RET_ReallyLR implicit $w0
279 %mul:_(s32) = G_UMULH %0, %1
281 RET_ReallyLR implicit $w0
286 exposesReturnsTwice: false
287 tracksRegLiveness: true
292 ; CHECK-LABEL: name: smulh_s32
293 ; CHECK: liveins: $w0, $w1
295 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $w0
296 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $w1
297 ; CHECK-NEXT: [[SEXT:%[0-9]+]]:_(s64) = G_SEXT [[COPY]](s32)
298 ; CHECK-NEXT: [[SEXT1:%[0-9]+]]:_(s64) = G_SEXT [[COPY1]](s32)
299 ; CHECK-NEXT: [[MUL:%[0-9]+]]:_(s64) = G_MUL [[SEXT]], [[SEXT1]]
300 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 32
301 ; CHECK-NEXT: [[ASHR:%[0-9]+]]:_(s64) = G_ASHR [[MUL]], [[C]](s64)
302 ; CHECK-NEXT: %mul:_(s32) = G_TRUNC [[ASHR]](s64)
303 ; CHECK-NEXT: $w0 = COPY %mul(s32)
304 ; CHECK-NEXT: RET_ReallyLR implicit $w0
307 %mul:_(s32) = G_SMULH %0, %1
309 RET_ReallyLR implicit $w0
314 exposesReturnsTwice: false
315 tracksRegLiveness: true
317 - { reg: '$q0', virtual-reg: '' }
322 ; CHECK-LABEL: name: umulh_v8s16
323 ; CHECK: liveins: $q0, $q1
325 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<8 x s16>) = COPY $q0
326 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<8 x s16>) = COPY $q1
327 ; CHECK-NEXT: %mul:_(<8 x s16>) = G_UMULH [[COPY]], [[COPY1]]
328 ; CHECK-NEXT: $q0 = COPY %mul(<8 x s16>)
329 ; CHECK-NEXT: RET_ReallyLR implicit $q0
330 %0:_(<8 x s16>) = COPY $q0
331 %1:_(<8 x s16>) = COPY $q1
332 %mul:_(<8 x s16>) = G_UMULH %0, %1
333 $q0 = COPY %mul(<8 x s16>)
334 RET_ReallyLR implicit $q0
339 exposesReturnsTwice: false
340 tracksRegLiveness: true
342 - { reg: '$q0', virtual-reg: '' }
347 ; CHECK-LABEL: name: umulh_v16s8
348 ; CHECK: liveins: $q0, $q1
350 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<16 x s8>) = COPY $q0
351 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<16 x s8>) = COPY $q1
352 ; CHECK-NEXT: %mul:_(<16 x s8>) = G_UMULH [[COPY]], [[COPY1]]
353 ; CHECK-NEXT: $q0 = COPY %mul(<16 x s8>)
354 ; CHECK-NEXT: RET_ReallyLR implicit $q0
355 %0:_(<16 x s8>) = COPY $q0
356 %1:_(<16 x s8>) = COPY $q1
357 %mul:_(<16 x s8>) = G_UMULH %0, %1
358 $q0 = COPY %mul(<16 x s8>)
359 RET_ReallyLR implicit $q0
364 exposesReturnsTwice: false
365 tracksRegLiveness: true
367 - { reg: '$q0', virtual-reg: '' }
372 ; CHECK-LABEL: name: umulh_v4s32
373 ; CHECK: liveins: $q0, $q1
375 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<4 x s32>) = COPY $q0
376 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<4 x s32>) = COPY $q1
377 ; CHECK-NEXT: %mul:_(<4 x s32>) = G_UMULH [[COPY]], [[COPY1]]
378 ; CHECK-NEXT: $q0 = COPY %mul(<4 x s32>)
379 ; CHECK-NEXT: RET_ReallyLR implicit $q0
380 %0:_(<4 x s32>) = COPY $q0
381 %1:_(<4 x s32>) = COPY $q1
382 %mul:_(<4 x s32>) = G_UMULH %0, %1
383 $q0 = COPY %mul(<4 x s32>)
384 RET_ReallyLR implicit $q0
389 exposesReturnsTwice: false
390 tracksRegLiveness: true
392 - { reg: '$q0', virtual-reg: '' }
397 ; CHECK-LABEL: name: smulh_v8s16
398 ; CHECK: liveins: $q0, $q1
400 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<8 x s16>) = COPY $q0
401 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<8 x s16>) = COPY $q1
402 ; CHECK-NEXT: %mul:_(<8 x s16>) = G_SMULH [[COPY]], [[COPY1]]
403 ; CHECK-NEXT: $q0 = COPY %mul(<8 x s16>)
404 ; CHECK-NEXT: RET_ReallyLR implicit $q0
405 %0:_(<8 x s16>) = COPY $q0
406 %1:_(<8 x s16>) = COPY $q1
407 %mul:_(<8 x s16>) = G_SMULH %0, %1
408 $q0 = COPY %mul(<8 x s16>)
409 RET_ReallyLR implicit $q0
414 exposesReturnsTwice: false
415 tracksRegLiveness: true
417 - { reg: '$q0', virtual-reg: '' }
422 ; CHECK-LABEL: name: smulh_v16s8
423 ; CHECK: liveins: $q0, $q1
425 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<16 x s8>) = COPY $q0
426 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<16 x s8>) = COPY $q1
427 ; CHECK-NEXT: %mul:_(<16 x s8>) = G_SMULH [[COPY]], [[COPY1]]
428 ; CHECK-NEXT: $q0 = COPY %mul(<16 x s8>)
429 ; CHECK-NEXT: RET_ReallyLR implicit $q0
430 %0:_(<16 x s8>) = COPY $q0
431 %1:_(<16 x s8>) = COPY $q1
432 %mul:_(<16 x s8>) = G_SMULH %0, %1
433 $q0 = COPY %mul(<16 x s8>)
434 RET_ReallyLR implicit $q0
439 exposesReturnsTwice: false
440 tracksRegLiveness: true
442 - { reg: '$q0', virtual-reg: '' }
447 ; CHECK-LABEL: name: smulh_v4s32
448 ; CHECK: liveins: $q0, $q1
450 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<4 x s32>) = COPY $q0
451 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<4 x s32>) = COPY $q1
452 ; CHECK-NEXT: %mul:_(<4 x s32>) = G_SMULH [[COPY]], [[COPY1]]
453 ; CHECK-NEXT: $q0 = COPY %mul(<4 x s32>)
454 ; CHECK-NEXT: RET_ReallyLR implicit $q0
455 %0:_(<4 x s32>) = COPY $q0
456 %1:_(<4 x s32>) = COPY $q1
457 %mul:_(<4 x s32>) = G_SMULH %0, %1
458 $q0 = COPY %mul(<4 x s32>)
459 RET_ReallyLR implicit $q0
463 name: test_vector_mul_v16s16
466 ; CHECK-LABEL: name: test_vector_mul_v16s16
467 ; CHECK: [[COPY:%[0-9]+]]:_(<8 x s16>) = COPY $q0
468 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<8 x s16>) = COPY $q1
469 ; CHECK-NEXT: [[MUL:%[0-9]+]]:_(<8 x s16>) = G_MUL [[COPY]], [[COPY]]
470 ; CHECK-NEXT: [[MUL1:%[0-9]+]]:_(<8 x s16>) = G_MUL [[COPY1]], [[COPY1]]
471 ; CHECK-NEXT: $q0 = COPY [[MUL]](<8 x s16>)
472 ; CHECK-NEXT: $q1 = COPY [[MUL1]](<8 x s16>)
473 %1:_(<8 x s16>) = COPY $q0
474 %2:_(<8 x s16>) = COPY $q1
475 %0:_(<16 x s16>) = G_CONCAT_VECTORS %1(<8 x s16>), %2(<8 x s16>)
476 %3:_(<16 x s16>) = G_MUL %0, %0
477 %4:_(<8 x s16>), %5:_(<8 x s16>) = G_UNMERGE_VALUES %3(<16 x s16>)
478 $q0 = COPY %4(<8 x s16>)
479 $q1 = COPY %5(<8 x s16>)
483 name: test_vector_mul_v32s8
486 ; CHECK-LABEL: name: test_vector_mul_v32s8
487 ; CHECK: [[COPY:%[0-9]+]]:_(<16 x s8>) = COPY $q0
488 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<16 x s8>) = COPY $q1
489 ; CHECK-NEXT: [[MUL:%[0-9]+]]:_(<16 x s8>) = G_MUL [[COPY]], [[COPY]]
490 ; CHECK-NEXT: [[MUL1:%[0-9]+]]:_(<16 x s8>) = G_MUL [[COPY1]], [[COPY1]]
491 ; CHECK-NEXT: $q0 = COPY [[MUL]](<16 x s8>)
492 ; CHECK-NEXT: $q1 = COPY [[MUL1]](<16 x s8>)
493 %0:_(<16 x s8>) = COPY $q0
494 %1:_(<16 x s8>) = COPY $q1
495 %2:_(<32 x s8>) = G_CONCAT_VECTORS %0, %1
496 %3:_(<32 x s8>) = G_MUL %2, %2
497 %7:_(<16 x s8>), %8:_(<16 x s8>) = G_UNMERGE_VALUES %3(<32 x s8>)
498 $q0 = COPY %7(<16 x s8>)
499 $q1 = COPY %8(<16 x s8>)
504 tracksRegLiveness: true
507 liveins: $d0, $d1, $d2, $d3
509 ; CHECK-LABEL: name: mul_v2s1
510 ; CHECK: liveins: $d0, $d1, $d2, $d3
512 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<2 x s32>) = COPY $d0
513 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<2 x s32>) = COPY $d1
514 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(<2 x s32>) = COPY $d2
515 ; CHECK-NEXT: [[COPY3:%[0-9]+]]:_(<2 x s32>) = COPY $d3
516 ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(<2 x s32>) = G_ICMP intpred(eq), [[COPY]](<2 x s32>), [[COPY1]]
517 ; CHECK-NEXT: [[ICMP1:%[0-9]+]]:_(<2 x s32>) = G_ICMP intpred(eq), [[COPY2]](<2 x s32>), [[COPY3]]
518 ; CHECK-NEXT: [[MUL:%[0-9]+]]:_(<2 x s32>) = G_MUL [[ICMP]], [[ICMP1]]
519 ; CHECK-NEXT: $d0 = COPY [[MUL]](<2 x s32>)
520 ; CHECK-NEXT: RET_ReallyLR implicit $d0
521 %0:_(<2 x s32>) = COPY $d0
522 %1:_(<2 x s32>) = COPY $d1
523 %2:_(<2 x s32>) = COPY $d2
524 %3:_(<2 x s32>) = COPY $d3
525 %4:_(<2 x s1>) = G_ICMP intpred(eq), %0(<2 x s32>), %1
526 %5:_(<2 x s1>) = G_ICMP intpred(eq), %2(<2 x s32>), %3
527 %6:_(<2 x s1>) = G_MUL %4, %5
528 %7:_(<2 x s32>) = G_ANYEXT %6
529 $d0 = COPY %7:_(<2 x s32>)
530 RET_ReallyLR implicit $d0
534 tracksRegLiveness: true
537 liveins: $b0, $b1, $b2
539 ; CHECK-LABEL: name: mul_v3s1
540 ; CHECK: liveins: $b0, $b1, $b2
542 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s8) = COPY $b0
543 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s8) = COPY $b1
544 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s8) = COPY $b2
545 ; CHECK-NEXT: [[ANYEXT:%[0-9]+]]:_(s16) = G_ANYEXT [[COPY]](s8)
546 ; CHECK-NEXT: [[ANYEXT1:%[0-9]+]]:_(s16) = G_ANYEXT [[COPY1]](s8)
547 ; CHECK-NEXT: [[ANYEXT2:%[0-9]+]]:_(s16) = G_ANYEXT [[COPY2]](s8)
548 ; CHECK-NEXT: [[DEF:%[0-9]+]]:_(s16) = G_IMPLICIT_DEF
549 ; CHECK-NEXT: [[BUILD_VECTOR:%[0-9]+]]:_(<4 x s16>) = G_BUILD_VECTOR [[ANYEXT]](s16), [[ANYEXT1]](s16), [[ANYEXT2]](s16), [[DEF]](s16)
550 ; CHECK-NEXT: [[MUL:%[0-9]+]]:_(<4 x s16>) = G_MUL [[BUILD_VECTOR]], [[BUILD_VECTOR]]
551 ; 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>)
552 ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:_(s8) = G_TRUNC [[UV]](s16)
553 ; CHECK-NEXT: $b0 = COPY [[TRUNC]](s8)
554 ; CHECK-NEXT: RET_ReallyLR implicit $b0
558 %4:_(<3 x s8>) = G_BUILD_VECTOR %1(s8), %2(s8), %3(s8)
559 %0:_(<3 x s1>) = G_TRUNC %4(<3 x s8>)
560 %5:_(<3 x s1>) = G_MUL %0, %0
561 %7:_(<3 x s8>) = G_ANYEXT %5(<3 x s1>)
562 %8:_(s8), %9:_(s8), %10:_(s8) = G_UNMERGE_VALUES %7(<3 x s8>)
564 RET_ReallyLR implicit $b0
568 tracksRegLiveness: true
571 liveins: $d0, $d1, $d2, $d3
573 ; CHECK-LABEL: name: mul_v4s1
574 ; CHECK: liveins: $d0, $d1, $d2, $d3
576 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<4 x s16>) = COPY $d0
577 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<4 x s16>) = COPY $d1
578 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(<4 x s16>) = COPY $d2
579 ; CHECK-NEXT: [[COPY3:%[0-9]+]]:_(<4 x s16>) = COPY $d3
580 ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(<4 x s16>) = G_ICMP intpred(eq), [[COPY]](<4 x s16>), [[COPY1]]
581 ; CHECK-NEXT: [[ICMP1:%[0-9]+]]:_(<4 x s16>) = G_ICMP intpred(eq), [[COPY2]](<4 x s16>), [[COPY3]]
582 ; CHECK-NEXT: [[MUL:%[0-9]+]]:_(<4 x s16>) = G_MUL [[ICMP]], [[ICMP1]]
583 ; CHECK-NEXT: $d0 = COPY [[MUL]](<4 x s16>)
584 ; CHECK-NEXT: RET_ReallyLR implicit $d0
585 %0:_(<4 x s16>) = COPY $d0
586 %1:_(<4 x s16>) = COPY $d1
587 %2:_(<4 x s16>) = COPY $d2
588 %3:_(<4 x s16>) = COPY $d3
589 %4:_(<4 x s1>) = G_ICMP intpred(eq), %0(<4 x s16>), %1
590 %5:_(<4 x s1>) = G_ICMP intpred(eq), %2(<4 x s16>), %3
591 %6:_(<4 x s1>) = G_MUL %4, %5
592 %7:_(<4 x s16>) = G_ANYEXT %6
593 $d0 = COPY %7:_(<4 x s16>)
594 RET_ReallyLR implicit $d0
598 tracksRegLiveness: true
601 liveins: $d0, $d1, $d2, $d3
603 ; CHECK-LABEL: name: mul_v8s1
604 ; CHECK: liveins: $d0, $d1, $d2, $d3
606 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<8 x s8>) = COPY $d0
607 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<8 x s8>) = COPY $d1
608 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(<8 x s8>) = COPY $d2
609 ; CHECK-NEXT: [[COPY3:%[0-9]+]]:_(<8 x s8>) = COPY $d3
610 ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(<8 x s8>) = G_ICMP intpred(eq), [[COPY]](<8 x s8>), [[COPY1]]
611 ; CHECK-NEXT: [[ICMP1:%[0-9]+]]:_(<8 x s8>) = G_ICMP intpred(eq), [[COPY2]](<8 x s8>), [[COPY3]]
612 ; CHECK-NEXT: [[MUL:%[0-9]+]]:_(<8 x s8>) = G_MUL [[ICMP]], [[ICMP1]]
613 ; CHECK-NEXT: $d0 = COPY [[MUL]](<8 x s8>)
614 ; CHECK-NEXT: RET_ReallyLR implicit $d0
615 %0:_(<8 x s8>) = COPY $d0
616 %1:_(<8 x s8>) = COPY $d1
617 %2:_(<8 x s8>) = COPY $d2
618 %3:_(<8 x s8>) = COPY $d3
619 %4:_(<8 x s1>) = G_ICMP intpred(eq), %0(<8 x s8>), %1
620 %5:_(<8 x s1>) = G_ICMP intpred(eq), %2(<8 x s8>), %3
621 %6:_(<8 x s1>) = G_MUL %4, %5
622 %7:_(<8 x s8>) = G_ANYEXT %6
623 $d0 = COPY %7:_(<8 x s8>)
624 RET_ReallyLR implicit $d0
628 tracksRegLiveness: true
631 liveins: $q0, $q1, $q2, $q3
633 ; CHECK-LABEL: name: mul_v16s1
634 ; CHECK: liveins: $q0, $q1, $q2, $q3
636 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<16 x s8>) = COPY $q0
637 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<16 x s8>) = COPY $q1
638 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(<16 x s8>) = COPY $q2
639 ; CHECK-NEXT: [[COPY3:%[0-9]+]]:_(<16 x s8>) = COPY $q3
640 ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(<16 x s8>) = G_ICMP intpred(eq), [[COPY]](<16 x s8>), [[COPY1]]
641 ; CHECK-NEXT: [[ICMP1:%[0-9]+]]:_(<16 x s8>) = G_ICMP intpred(eq), [[COPY2]](<16 x s8>), [[COPY3]]
642 ; CHECK-NEXT: [[MUL:%[0-9]+]]:_(<16 x s8>) = G_MUL [[ICMP]], [[ICMP1]]
643 ; CHECK-NEXT: $q0 = COPY [[MUL]](<16 x s8>)
644 ; CHECK-NEXT: RET_ReallyLR implicit $q0
645 %0:_(<16 x s8>) = COPY $q0
646 %1:_(<16 x s8>) = COPY $q1
647 %2:_(<16 x s8>) = COPY $q2
648 %3:_(<16 x s8>) = COPY $q3
649 %4:_(<16 x s1>) = G_ICMP intpred(eq), %0(<16 x s8>), %1
650 %5:_(<16 x s1>) = G_ICMP intpred(eq), %2(<16 x s8>), %3
651 %6:_(<16 x s1>) = G_MUL %4, %5
652 %7:_(<16 x s8>) = G_ANYEXT %6
653 $q0 = COPY %7:_(<16 x s8>)
654 RET_ReallyLR implicit $q0