1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 5
2 # RUN: llc -mtriple=riscv64 -run-pass=legalizer -global-isel-abort=0 %s -o - | FileCheck %s
9 ; CHECK-LABEL: name: frem_f32
10 ; CHECK: liveins: $x10, $x11
12 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
13 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
14 ; CHECK-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def $x2, implicit $x2
15 ; CHECK-NEXT: $x10 = COPY [[COPY]](s64)
16 ; CHECK-NEXT: $x11 = COPY [[COPY1]](s64)
17 ; CHECK-NEXT: PseudoCALL target-flags(riscv-call) &fmodf, csr_ilp32_lp64, implicit-def $x1, implicit $x10, implicit $x11, implicit-def $x10
18 ; CHECK-NEXT: ADJCALLSTACKUP 0, 0, implicit-def $x2, implicit $x2
19 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s64) = COPY $x10
20 ; CHECK-NEXT: $x10 = COPY [[COPY2]](s64)
21 ; CHECK-NEXT: PseudoRET implicit $x10
23 %0:_(s32) = G_TRUNC %2(s64)
25 %1:_(s32) = G_TRUNC %3(s64)
26 %4:_(s32) = G_FREM %0, %1
27 %5:_(s64) = G_ANYEXT %4(s32)
29 PseudoRET implicit $x10
38 ; CHECK-LABEL: name: frem_f64
39 ; CHECK: liveins: $x10, $x11
41 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
42 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
43 ; CHECK-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def $x2, implicit $x2
44 ; CHECK-NEXT: $x10 = COPY [[COPY]](s64)
45 ; CHECK-NEXT: $x11 = COPY [[COPY1]](s64)
46 ; CHECK-NEXT: PseudoCALL target-flags(riscv-call) &fmod, csr_ilp32_lp64, implicit-def $x1, implicit $x10, implicit $x11, implicit-def $x10
47 ; CHECK-NEXT: ADJCALLSTACKUP 0, 0, implicit-def $x2, implicit $x2
48 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s64) = COPY $x10
49 ; CHECK-NEXT: $x10 = COPY [[COPY2]](s64)
50 ; CHECK-NEXT: PseudoRET implicit $x10
53 %2:_(s64) = G_FREM %0, %1
55 PseudoRET implicit $x10
63 ; CHECK-LABEL: name: frem_f16
64 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
65 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
66 ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:_(s16) = G_TRUNC [[COPY]](s64)
67 ; CHECK-NEXT: [[TRUNC1:%[0-9]+]]:_(s16) = G_TRUNC [[COPY1]](s64)
68 ; CHECK-NEXT: [[FPEXT:%[0-9]+]]:_(s32) = G_FPEXT [[TRUNC]](s16)
69 ; CHECK-NEXT: [[FPEXT1:%[0-9]+]]:_(s32) = G_FPEXT [[TRUNC1]](s16)
70 ; CHECK-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def $x2, implicit $x2
71 ; CHECK-NEXT: [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT [[FPEXT]](s32)
72 ; CHECK-NEXT: [[ANYEXT1:%[0-9]+]]:_(s64) = G_ANYEXT [[FPEXT1]](s32)
73 ; CHECK-NEXT: $x10 = COPY [[ANYEXT]](s64)
74 ; CHECK-NEXT: $x11 = COPY [[ANYEXT1]](s64)
75 ; CHECK-NEXT: PseudoCALL target-flags(riscv-call) &fmodf, csr_ilp32_lp64, implicit-def $x1, implicit $x10, implicit $x11, implicit-def $x10
76 ; CHECK-NEXT: ADJCALLSTACKUP 0, 0, implicit-def $x2, implicit $x2
77 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s64) = COPY $x10
78 ; CHECK-NEXT: [[TRUNC2:%[0-9]+]]:_(s32) = G_TRUNC [[COPY2]](s64)
79 ; CHECK-NEXT: [[FPTRUNC:%[0-9]+]]:_(s16) = G_FPTRUNC [[TRUNC2]](s32)
80 ; CHECK-NEXT: [[ANYEXT2:%[0-9]+]]:_(s64) = G_ANYEXT [[FPTRUNC]](s16)
81 ; CHECK-NEXT: $x10 = COPY [[ANYEXT2]](s64)
82 ; CHECK-NEXT: PseudoRET implicit $x10
85 %2:_(s16) = G_TRUNC %0(s64)
86 %3:_(s16) = G_TRUNC %1(s64)
87 %4:_(s16) = G_FREM %2, %3
88 %5:_(s64) = G_ANYEXT %4(s16)
90 PseudoRET implicit $x10
98 ; CHECK-LABEL: name: frem_v2f32
99 ; CHECK: [[COPY:%[0-9]+]]:_(<2 x s32>) = COPY $v8
100 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<2 x s32>) = COPY $v9
101 ; CHECK-NEXT: [[UV:%[0-9]+]]:_(s32), [[UV1:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[COPY]](<2 x s32>)
102 ; CHECK-NEXT: [[UV2:%[0-9]+]]:_(s32), [[UV3:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[COPY1]](<2 x s32>)
103 ; CHECK-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def $x2, implicit $x2
104 ; CHECK-NEXT: [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT [[UV]](s32)
105 ; CHECK-NEXT: [[ANYEXT1:%[0-9]+]]:_(s64) = G_ANYEXT [[UV2]](s32)
106 ; CHECK-NEXT: $x10 = COPY [[ANYEXT]](s64)
107 ; CHECK-NEXT: $x11 = COPY [[ANYEXT1]](s64)
108 ; CHECK-NEXT: PseudoCALL target-flags(riscv-call) &fmodf, csr_ilp32_lp64, implicit-def $x1, implicit $x10, implicit $x11, implicit-def $x10
109 ; CHECK-NEXT: ADJCALLSTACKUP 0, 0, implicit-def $x2, implicit $x2
110 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s64) = COPY $x10
111 ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:_(s32) = G_TRUNC [[COPY2]](s64)
112 ; CHECK-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def $x2, implicit $x2
113 ; CHECK-NEXT: [[ANYEXT2:%[0-9]+]]:_(s64) = G_ANYEXT [[UV1]](s32)
114 ; CHECK-NEXT: [[ANYEXT3:%[0-9]+]]:_(s64) = G_ANYEXT [[UV3]](s32)
115 ; CHECK-NEXT: $x10 = COPY [[ANYEXT2]](s64)
116 ; CHECK-NEXT: $x11 = COPY [[ANYEXT3]](s64)
117 ; CHECK-NEXT: PseudoCALL target-flags(riscv-call) &fmodf, csr_ilp32_lp64, implicit-def $x1, implicit $x10, implicit $x11, implicit-def $x10
118 ; CHECK-NEXT: ADJCALLSTACKUP 0, 0, implicit-def $x2, implicit $x2
119 ; CHECK-NEXT: [[COPY3:%[0-9]+]]:_(s64) = COPY $x10
120 ; CHECK-NEXT: [[TRUNC1:%[0-9]+]]:_(s32) = G_TRUNC [[COPY3]](s64)
121 ; CHECK-NEXT: [[BUILD_VECTOR:%[0-9]+]]:_(<2 x s32>) = G_BUILD_VECTOR [[TRUNC]](s32), [[TRUNC1]](s32)
122 ; CHECK-NEXT: $v8 = COPY [[BUILD_VECTOR]](<2 x s32>)
123 ; CHECK-NEXT: PseudoRET implicit $v8
124 %0:_(<2 x s32>) = COPY $v8
125 %1:_(<2 x s32>) = COPY $v9
126 %2:_(<2 x s32>) = G_FREM %0, %1
127 $v8 = COPY %2(<2 x s32>)
128 PseudoRET implicit $v8