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_urem_64
8 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
9 ; CHECK: [[COPY1:%[0-9]+]]:_(s64) = COPY $x1
10 ; CHECK: [[UDIV:%[0-9]+]]:_(s64) = G_UDIV [[COPY]], [[COPY1]]
11 ; CHECK: [[MUL:%[0-9]+]]:_(s64) = G_MUL [[UDIV]], [[COPY1]]
12 ; CHECK: [[SUB:%[0-9]+]]:_(s64) = G_SUB [[COPY]], [[MUL]]
13 ; CHECK: $x0 = COPY [[SUB]](s64)
16 %2:_(s64) = G_UREM %0, %1
24 ; CHECK-LABEL: name: test_srem_32
25 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
26 ; CHECK: [[COPY1:%[0-9]+]]:_(s64) = COPY $x1
27 ; CHECK: [[TRUNC:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
28 ; CHECK: [[TRUNC1:%[0-9]+]]:_(s32) = G_TRUNC [[COPY1]](s64)
29 ; CHECK: [[SDIV:%[0-9]+]]:_(s32) = G_SDIV [[TRUNC]], [[TRUNC1]]
30 ; CHECK: [[MUL:%[0-9]+]]:_(s32) = G_MUL [[SDIV]], [[TRUNC1]]
31 ; CHECK: [[SUB:%[0-9]+]]:_(s32) = G_SUB [[TRUNC]], [[MUL]]
32 ; CHECK: $w0 = COPY [[SUB]](s32)
35 %2:_(s32) = G_TRUNC %0(s64)
36 %3:_(s32) = G_TRUNC %1(s64)
37 %4:_(s32) = G_SREM %2, %3
45 ; CHECK-LABEL: name: test_srem_8
46 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
47 ; CHECK: [[COPY1:%[0-9]+]]:_(s64) = COPY $x1
48 ; CHECK: [[TRUNC:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
49 ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 24
50 ; CHECK: [[SHL:%[0-9]+]]:_(s32) = G_SHL [[TRUNC]], [[C]](s32)
51 ; CHECK: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 24
52 ; CHECK: [[COPY2:%[0-9]+]]:_(s64) = COPY [[C1]](s64)
53 ; CHECK: [[ASHR:%[0-9]+]]:_(s32) = G_ASHR [[SHL]], [[COPY2]](s64)
54 ; CHECK: [[TRUNC1:%[0-9]+]]:_(s32) = G_TRUNC [[COPY1]](s64)
55 ; CHECK: [[SHL1:%[0-9]+]]:_(s32) = G_SHL [[TRUNC1]], [[C]](s32)
56 ; CHECK: [[ASHR1:%[0-9]+]]:_(s32) = G_ASHR [[SHL1]], [[C1]](s64)
57 ; CHECK: [[SDIV:%[0-9]+]]:_(s32) = G_SDIV [[ASHR]], [[ASHR1]]
58 ; CHECK: [[COPY3:%[0-9]+]]:_(s32) = COPY [[SDIV]](s32)
59 ; CHECK: [[TRUNC2:%[0-9]+]]:_(s32) = G_TRUNC [[COPY1]](s64)
60 ; CHECK: [[MUL:%[0-9]+]]:_(s32) = G_MUL [[COPY3]], [[TRUNC2]]
61 ; CHECK: [[TRUNC3:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
62 ; CHECK: [[COPY4:%[0-9]+]]:_(s32) = COPY [[MUL]](s32)
63 ; CHECK: [[SUB:%[0-9]+]]:_(s32) = G_SUB [[TRUNC3]], [[COPY4]]
64 ; CHECK: [[COPY5:%[0-9]+]]:_(s32) = COPY [[SUB]](s32)
65 ; CHECK: $w0 = COPY [[COPY5]](s32)
68 %2:_(s8) = G_TRUNC %0(s64)
69 %3:_(s8) = G_TRUNC %1(s64)
70 %4:_(s8) = G_SREM %2, %3
71 %5:_(s32) = G_ANYEXT %4(s8)
79 ; CHECK-LABEL: name: test_frem
80 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
81 ; CHECK: [[COPY1:%[0-9]+]]:_(s64) = COPY $x1
82 ; CHECK: ADJCALLSTACKDOWN 0, 0, implicit-def $sp, implicit $sp
83 ; CHECK: $d0 = COPY [[COPY]](s64)
84 ; CHECK: $d1 = COPY [[COPY1]](s64)
85 ; CHECK: BL &fmod, csr_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit $d0, implicit $d1, implicit-def $d0
86 ; CHECK: [[COPY2:%[0-9]+]]:_(s64) = COPY $d0
87 ; CHECK: ADJCALLSTACKUP 0, 0, implicit-def $sp, implicit $sp
88 ; CHECK: $x0 = COPY [[COPY2]](s64)
89 ; CHECK: [[TRUNC:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
90 ; CHECK: [[TRUNC1:%[0-9]+]]:_(s32) = G_TRUNC [[COPY1]](s64)
91 ; CHECK: ADJCALLSTACKDOWN 0, 0, implicit-def $sp, implicit $sp
92 ; CHECK: $s0 = COPY [[TRUNC]](s32)
93 ; CHECK: $s1 = COPY [[TRUNC1]](s32)
94 ; CHECK: BL &fmodf, csr_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit $s0, implicit $s1, implicit-def $s0
95 ; CHECK: [[COPY3:%[0-9]+]]:_(s32) = COPY $s0
96 ; CHECK: ADJCALLSTACKUP 0, 0, implicit-def $sp, implicit $sp
97 ; CHECK: $w0 = COPY [[COPY3]](s32)
100 %2:_(s64) = G_FREM %0, %1
102 %3:_(s32) = G_TRUNC %0(s64)
103 %4:_(s32) = G_TRUNC %1(s64)
104 %5:_(s32) = G_FREM %3, %4