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: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 24
49 ; CHECK: [[TRUNC:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
50 ; CHECK: [[SHL:%[0-9]+]]:_(s32) = G_SHL [[TRUNC]], [[C]]
51 ; CHECK: [[ASHR:%[0-9]+]]:_(s32) = G_ASHR [[SHL]], [[C]]
52 ; CHECK: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 24
53 ; CHECK: [[TRUNC1:%[0-9]+]]:_(s32) = G_TRUNC [[COPY1]](s64)
54 ; CHECK: [[SHL1:%[0-9]+]]:_(s32) = G_SHL [[TRUNC1]], [[C1]]
55 ; CHECK: [[ASHR1:%[0-9]+]]:_(s32) = G_ASHR [[SHL1]], [[C1]]
56 ; CHECK: [[SDIV:%[0-9]+]]:_(s32) = G_SDIV [[ASHR]], [[ASHR1]]
57 ; CHECK: [[COPY2:%[0-9]+]]:_(s32) = COPY [[SDIV]](s32)
58 ; CHECK: [[TRUNC2:%[0-9]+]]:_(s32) = G_TRUNC [[COPY1]](s64)
59 ; CHECK: [[MUL:%[0-9]+]]:_(s32) = G_MUL [[COPY2]], [[TRUNC2]]
60 ; CHECK: [[TRUNC3:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
61 ; CHECK: [[COPY3:%[0-9]+]]:_(s32) = COPY [[MUL]](s32)
62 ; CHECK: [[SUB:%[0-9]+]]:_(s32) = G_SUB [[TRUNC3]], [[COPY3]]
63 ; CHECK: [[COPY4:%[0-9]+]]:_(s32) = COPY [[SUB]](s32)
64 ; CHECK: $w0 = COPY [[COPY4]](s32)
67 %2:_(s8) = G_TRUNC %0(s64)
68 %3:_(s8) = G_TRUNC %1(s64)
69 %4:_(s8) = G_SREM %2, %3
70 %5:_(s32) = G_ANYEXT %4(s8)
78 ; CHECK-LABEL: name: test_frem
79 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
80 ; CHECK: [[COPY1:%[0-9]+]]:_(s64) = COPY $x1
81 ; CHECK: ADJCALLSTACKDOWN 0, 0, implicit-def $sp, implicit $sp
82 ; CHECK: $d0 = COPY [[COPY]](s64)
83 ; CHECK: $d1 = COPY [[COPY1]](s64)
84 ; CHECK: BL &fmod, csr_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit $d0, implicit $d1, implicit-def $d0
85 ; CHECK: [[COPY2:%[0-9]+]]:_(s64) = COPY $d0
86 ; CHECK: ADJCALLSTACKUP 0, 0, implicit-def $sp, implicit $sp
87 ; CHECK: $x0 = COPY [[COPY2]](s64)
88 ; CHECK: [[TRUNC:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
89 ; CHECK: [[TRUNC1:%[0-9]+]]:_(s32) = G_TRUNC [[COPY1]](s64)
90 ; CHECK: ADJCALLSTACKDOWN 0, 0, implicit-def $sp, implicit $sp
91 ; CHECK: $s0 = COPY [[TRUNC]](s32)
92 ; CHECK: $s1 = COPY [[TRUNC1]](s32)
93 ; CHECK: BL &fmodf, csr_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit $s0, implicit $s1, implicit-def $s0
94 ; CHECK: [[COPY3:%[0-9]+]]:_(s32) = COPY $s0
95 ; CHECK: ADJCALLSTACKUP 0, 0, implicit-def $sp, implicit $sp
96 ; CHECK: $w0 = COPY [[COPY3]](s32)
99 %2:_(s64) = G_FREM %0, %1
101 %3:_(s32) = G_TRUNC %0(s64)
102 %4:_(s32) = G_TRUNC %1(s64)
103 %5:_(s32) = G_FREM %3, %4