1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -O0 -march=aarch64 -run-pass=legalizer %s -o - | FileCheck %s
7 ; CHECK-LABEL: name: test_div
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: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 24
12 ; CHECK: [[SHL:%[0-9]+]]:_(s32) = G_SHL [[TRUNC]], [[C]](s32)
13 ; CHECK: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 24
14 ; CHECK: [[COPY2:%[0-9]+]]:_(s64) = COPY [[C1]](s64)
15 ; CHECK: [[ASHR:%[0-9]+]]:_(s32) = G_ASHR [[SHL]], [[COPY2]](s64)
16 ; CHECK: [[TRUNC1:%[0-9]+]]:_(s32) = G_TRUNC [[COPY1]](s64)
17 ; CHECK: [[SHL1:%[0-9]+]]:_(s32) = G_SHL [[TRUNC1]], [[C]](s32)
18 ; CHECK: [[ASHR1:%[0-9]+]]:_(s32) = G_ASHR [[SHL1]], [[C1]](s64)
19 ; CHECK: [[SDIV:%[0-9]+]]:_(s32) = G_SDIV [[ASHR]], [[ASHR1]]
20 ; CHECK: [[COPY3:%[0-9]+]]:_(s32) = COPY [[SDIV]](s32)
21 ; CHECK: $w0 = COPY [[COPY3]](s32)
22 ; CHECK: [[C2:%[0-9]+]]:_(s32) = G_CONSTANT i32 255
23 ; CHECK: [[TRUNC2:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
24 ; CHECK: [[AND:%[0-9]+]]:_(s32) = G_AND [[TRUNC2]], [[C2]]
25 ; CHECK: [[TRUNC3:%[0-9]+]]:_(s32) = G_TRUNC [[COPY1]](s64)
26 ; CHECK: [[AND1:%[0-9]+]]:_(s32) = G_AND [[TRUNC3]], [[C2]]
27 ; CHECK: [[UDIV:%[0-9]+]]:_(s32) = G_UDIV [[AND]], [[AND1]]
28 ; CHECK: [[COPY4:%[0-9]+]]:_(s32) = COPY [[UDIV]](s32)
29 ; CHECK: $w0 = COPY [[COPY4]](s32)
32 %2:_(s8) = G_TRUNC %0(s64)
33 %3:_(s8) = G_TRUNC %1(s64)
34 %4:_(s8) = G_SDIV %2, %3
35 %6:_(s32) = G_ANYEXT %4(s8)
37 %5:_(s8) = G_UDIV %2, %3
38 %7:_(s32) = G_ANYEXT %5(s8)
45 tracksRegLiveness: true
46 machineFunctionInfo: {}
51 ; CHECK-LABEL: name: sdiv_v4s32
52 ; CHECK: liveins: $q0, $q1
53 ; CHECK: [[COPY:%[0-9]+]]:_(<4 x s32>) = COPY $q0
54 ; CHECK: [[COPY1:%[0-9]+]]:_(<4 x s32>) = COPY $q1
55 ; CHECK: [[UV:%[0-9]+]]:_(s32), [[UV1:%[0-9]+]]:_(s32), [[UV2:%[0-9]+]]:_(s32), [[UV3:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[COPY]](<4 x s32>)
56 ; CHECK: [[UV4:%[0-9]+]]:_(s32), [[UV5:%[0-9]+]]:_(s32), [[UV6:%[0-9]+]]:_(s32), [[UV7:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[COPY1]](<4 x s32>)
57 ; CHECK: [[SDIV:%[0-9]+]]:_(s32) = G_SDIV [[UV]], [[UV4]]
58 ; CHECK: [[SDIV1:%[0-9]+]]:_(s32) = G_SDIV [[UV1]], [[UV5]]
59 ; CHECK: [[SDIV2:%[0-9]+]]:_(s32) = G_SDIV [[UV2]], [[UV6]]
60 ; CHECK: [[SDIV3:%[0-9]+]]:_(s32) = G_SDIV [[UV3]], [[UV7]]
61 ; CHECK: [[BUILD_VECTOR:%[0-9]+]]:_(<4 x s32>) = G_BUILD_VECTOR [[SDIV]](s32), [[SDIV1]](s32), [[SDIV2]](s32), [[SDIV3]](s32)
62 ; CHECK: $q0 = COPY [[BUILD_VECTOR]](<4 x s32>)
63 ; CHECK: RET_ReallyLR implicit $q0
64 %0:_(<4 x s32>) = COPY $q0
65 %1:_(<4 x s32>) = COPY $q1
66 %2:_(<4 x s32>) = G_SDIV %0, %1
67 $q0 = COPY %2(<4 x s32>)
68 RET_ReallyLR implicit $q0