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: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 24
11 ; CHECK: [[TRUNC:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
12 ; CHECK: [[SHL:%[0-9]+]]:_(s32) = G_SHL [[TRUNC]], [[C]]
13 ; CHECK: [[ASHR:%[0-9]+]]:_(s32) = G_ASHR [[SHL]], [[C]]
14 ; CHECK: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 24
15 ; CHECK: [[TRUNC1:%[0-9]+]]:_(s32) = G_TRUNC [[COPY1]](s64)
16 ; CHECK: [[SHL1:%[0-9]+]]:_(s32) = G_SHL [[TRUNC1]], [[C1]]
17 ; CHECK: [[ASHR1:%[0-9]+]]:_(s32) = G_ASHR [[SHL1]], [[C1]]
18 ; CHECK: [[SDIV:%[0-9]+]]:_(s32) = G_SDIV [[ASHR]], [[ASHR1]]
19 ; CHECK: [[COPY2:%[0-9]+]]:_(s32) = COPY [[SDIV]](s32)
20 ; CHECK: $w0 = COPY [[COPY2]](s32)
21 ; CHECK: [[C2:%[0-9]+]]:_(s32) = G_CONSTANT i32 255
22 ; CHECK: [[TRUNC2:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
23 ; CHECK: [[AND:%[0-9]+]]:_(s32) = G_AND [[TRUNC2]], [[C2]]
24 ; CHECK: [[C3:%[0-9]+]]:_(s32) = G_CONSTANT i32 255
25 ; CHECK: [[TRUNC3:%[0-9]+]]:_(s32) = G_TRUNC [[COPY1]](s64)
26 ; CHECK: [[AND1:%[0-9]+]]:_(s32) = G_AND [[TRUNC3]], [[C3]]
27 ; CHECK: [[UDIV:%[0-9]+]]:_(s32) = G_UDIV [[AND]], [[AND1]]
28 ; CHECK: [[COPY3:%[0-9]+]]:_(s32) = COPY [[UDIV]](s32)
29 ; CHECK: $w0 = COPY [[COPY3]](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)