1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -march=aarch64 -run-pass=legalizer %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: [[COPY1:%[0-9]+]]:_(s64) = COPY $x1
10 ; CHECK: [[TRUNC:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
11 ; CHECK: [[TRUNC1:%[0-9]+]]:_(s32) = G_TRUNC [[COPY1]](s64)
12 ; CHECK: [[MUL:%[0-9]+]]:_(s32) = G_MUL [[TRUNC]], [[TRUNC1]]
13 ; CHECK: [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT [[MUL]](s32)
14 ; CHECK: $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: [[COPY1:%[0-9]+]]:_(s64) = COPY $x1
31 ; CHECK: [[MUL:%[0-9]+]]:_(s64) = G_MUL [[COPY]], [[COPY1]]
32 ; CHECK: [[SMULH:%[0-9]+]]:_(s64) = G_SMULH [[COPY]], [[COPY1]]
33 ; CHECK: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 63
34 ; CHECK: [[ASHR:%[0-9]+]]:_(s64) = G_ASHR [[MUL]], [[C]]
35 ; CHECK: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(ne), [[SMULH]](s64), [[ASHR]]
36 ; CHECK: $x0 = COPY [[MUL]](s64)
37 ; CHECK: [[COPY2:%[0-9]+]]:_(s32) = COPY [[ICMP]](s32)
38 ; CHECK: $w0 = COPY [[COPY2]](s32)
41 %2:_(s64), %3:_(s1) = G_SMULO %0, %1
43 %4:_(s32) = G_ANYEXT %3(s1)
48 name: test_umul_overflow
51 ; CHECK-LABEL: name: test_umul_overflow
52 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
53 ; CHECK: [[COPY1:%[0-9]+]]:_(s64) = COPY $x1
54 ; CHECK: [[MUL:%[0-9]+]]:_(s64) = G_MUL [[COPY]], [[COPY1]]
55 ; CHECK: [[UMULH:%[0-9]+]]:_(s64) = G_UMULH [[COPY]], [[COPY1]]
56 ; CHECK: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 0
57 ; CHECK: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(ne), [[UMULH]](s64), [[C]]
58 ; CHECK: $x0 = COPY [[MUL]](s64)
59 ; CHECK: [[COPY2:%[0-9]+]]:_(s32) = COPY [[ICMP]](s32)
60 ; CHECK: $w0 = COPY [[COPY2]](s32)
63 %2:_(s64), %3:_(s1) = G_UMULO %0, %1
65 %4:_(s32) = G_ANYEXT %3(s1)