Debian Codegraph @

llvm/test/CodeGen/RISCV/GlobalISel/legalizer/legalize-mul-rv64.mir

raw
1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=riscv64 -run-pass=legalizer %s -o - \
3 # RUN: | FileCheck %s
4 ---
5 name: mul_i8
6 body: |
7 bb.0.entry:
8 ; CHECK-LABEL: name: mul_i8
9 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
10 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
11 ; CHECK-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def $x2, implicit $x2
12 ; CHECK-NEXT: $x10 = COPY [[COPY]](s64)
13 ; CHECK-NEXT: $x11 = COPY [[COPY1]](s64)
14 ; CHECK-NEXT: PseudoCALL target-flags(riscv-call) &__muldi3, csr_ilp32_lp64, implicit-def $x1, implicit $x10, implicit $x11, implicit-def $x10
15 ; CHECK-NEXT: ADJCALLSTACKUP 0, 0, implicit-def $x2, implicit $x2
16 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s64) = COPY $x10
17 ; CHECK-NEXT: $x10 = COPY [[COPY2]](s64)
18 ; CHECK-NEXT: PseudoRET implicit $x10
19 %0:_(s64) = COPY $x10
20 %1:_(s64) = COPY $x11
21 %2:_(s8) = G_TRUNC %0(s64)
22 %3:_(s8) = G_TRUNC %1(s64)
23 %4:_(s8) = G_MUL %2, %3
24 %5:_(s64) = G_ANYEXT %4(s8)
25 $x10 = COPY %5(s64)
26 PseudoRET implicit $x10
27
28 ...
29 ---
30 name: mul_i15
31 body: |
32 bb.0.entry:
33 ; CHECK-LABEL: name: mul_i15
34 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
35 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
36 ; CHECK-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def $x2, implicit $x2
37 ; CHECK-NEXT: $x10 = COPY [[COPY]](s64)
38 ; CHECK-NEXT: $x11 = COPY [[COPY1]](s64)
39 ; CHECK-NEXT: PseudoCALL target-flags(riscv-call) &__muldi3, csr_ilp32_lp64, implicit-def $x1, implicit $x10, implicit $x11, implicit-def $x10
40 ; CHECK-NEXT: ADJCALLSTACKUP 0, 0, implicit-def $x2, implicit $x2
41 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s64) = COPY $x10
42 ; CHECK-NEXT: $x10 = COPY [[COPY2]](s64)
43 ; CHECK-NEXT: PseudoRET implicit $x10
44 %0:_(s64) = COPY $x10
45 %1:_(s64) = COPY $x11
46 %2:_(s15) = G_TRUNC %0(s64)
47 %3:_(s15) = G_TRUNC %1(s64)
48 %4:_(s15) = G_MUL %2, %3
49 %5:_(s64) = G_ANYEXT %4(s15)
50 $x10 = COPY %5(s64)
51 PseudoRET implicit $x10
52
53 ...
54 ---
55 name: mul_i16
56 body: |
57 bb.0.entry:
58 ; CHECK-LABEL: name: mul_i16
59 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
60 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
61 ; CHECK-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def $x2, implicit $x2
62 ; CHECK-NEXT: $x10 = COPY [[COPY]](s64)
63 ; CHECK-NEXT: $x11 = COPY [[COPY1]](s64)
64 ; CHECK-NEXT: PseudoCALL target-flags(riscv-call) &__muldi3, csr_ilp32_lp64, implicit-def $x1, implicit $x10, implicit $x11, implicit-def $x10
65 ; CHECK-NEXT: ADJCALLSTACKUP 0, 0, implicit-def $x2, implicit $x2
66 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s64) = COPY $x10
67 ; CHECK-NEXT: $x10 = COPY [[COPY2]](s64)
68 ; CHECK-NEXT: PseudoRET implicit $x10
69 %0:_(s64) = COPY $x10
70 %1:_(s64) = COPY $x11
71 %2:_(s16) = G_TRUNC %0(s64)
72 %3:_(s16) = G_TRUNC %1(s64)
73 %4:_(s16) = G_MUL %2, %3
74 %5:_(s64) = G_ANYEXT %4(s16)
75 $x10 = COPY %5(s64)
76 PseudoRET implicit $x10
77
78 ...
79 ---
80 name: mul_i32
81 body: |
82 bb.0.entry:
83 ; CHECK-LABEL: name: mul_i32
84 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
85 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
86 ; CHECK-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def $x2, implicit $x2
87 ; CHECK-NEXT: $x10 = COPY [[COPY]](s64)
88 ; CHECK-NEXT: $x11 = COPY [[COPY1]](s64)
89 ; CHECK-NEXT: PseudoCALL target-flags(riscv-call) &__muldi3, csr_ilp32_lp64, implicit-def $x1, implicit $x10, implicit $x11, implicit-def $x10
90 ; CHECK-NEXT: ADJCALLSTACKUP 0, 0, implicit-def $x2, implicit $x2
91 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s64) = COPY $x10
92 ; CHECK-NEXT: $x10 = COPY [[COPY2]](s64)
93 ; CHECK-NEXT: PseudoRET implicit $x10
94 %0:_(s64) = COPY $x10
95 %1:_(s64) = COPY $x11
96 %2:_(s32) = G_TRUNC %0(s64)
97 %3:_(s32) = G_TRUNC %1(s64)
98 %4:_(s32) = G_MUL %2, %3
99 %5:_(s64) = G_ANYEXT %4(s32)
100 $x10 = COPY %5(s64)
101 PseudoRET implicit $x10
102
103 ...
104 ---
105 name: mul_i64
106 body: |
107 bb.0.entry:
108 ; CHECK-LABEL: name: mul_i64
109 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
110 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
111 ; CHECK-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def $x2, implicit $x2
112 ; CHECK-NEXT: $x10 = COPY [[COPY]](s64)
113 ; CHECK-NEXT: $x11 = COPY [[COPY1]](s64)
114 ; CHECK-NEXT: PseudoCALL target-flags(riscv-call) &__muldi3, csr_ilp32_lp64, implicit-def $x1, implicit $x10, implicit $x11, implicit-def $x10
115 ; CHECK-NEXT: ADJCALLSTACKUP 0, 0, implicit-def $x2, implicit $x2
116 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s64) = COPY $x10
117 ; CHECK-NEXT: $x10 = COPY [[COPY2]](s64)
118 ; CHECK-NEXT: PseudoRET implicit $x10
119 %0:_(s64) = COPY $x10
120 %1:_(s64) = COPY $x11
121 %2:_(s64) = G_MUL %0, %1
122 $x10 = COPY %2(s64)
123 PseudoRET implicit $x10
124
125 ...
126 ---
127 name: mul_i128
128 body: |
129 bb.0.entry:
130 ; CHECK-LABEL: name: mul_i128
131 ; CHECK: %lo1:_(s64) = COPY $x10
132 ; CHECK-NEXT: %hi1:_(s64) = COPY $x11
133 ; CHECK-NEXT: %lo2:_(s64) = COPY $x12
134 ; CHECK-NEXT: %hi2:_(s64) = COPY $x13
135 ; CHECK-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def $x2, implicit $x2
136 ; CHECK-NEXT: $x10 = COPY %lo1(s64)
137 ; CHECK-NEXT: $x11 = COPY %hi1(s64)
138 ; CHECK-NEXT: $x12 = COPY %lo2(s64)
139 ; CHECK-NEXT: $x13 = COPY %hi2(s64)
140 ; CHECK-NEXT: PseudoCALL target-flags(riscv-call) &__multi3, csr_ilp32_lp64, implicit-def $x1, implicit $x10, implicit $x11, implicit $x12, implicit $x13, implicit-def $x10, implicit-def $x11
141 ; CHECK-NEXT: ADJCALLSTACKUP 0, 0, implicit-def $x2, implicit $x2
142 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
143 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
144 ; CHECK-NEXT: $x10 = COPY [[COPY]](s64)
145 ; CHECK-NEXT: $x11 = COPY [[COPY1]](s64)
146 ; CHECK-NEXT: PseudoRET implicit $x10, implicit $x11
147 %lo1:_(s64) = COPY $x10
148 %hi1:_(s64) = COPY $x11
149 %lo2:_(s64) = COPY $x12
150 %hi2:_(s64) = COPY $x13
151 %x1:_(s128) = G_MERGE_VALUES %lo1(s64), %hi1(s64)
152 %x2:_(s128) = G_MERGE_VALUES %lo2(s64), %hi2(s64)
153 %y:_(s128) = G_MUL %x1, %x2
154 %loy:_(s64), %hiy:_(s64) = G_UNMERGE_VALUES %y(s128)
155 $x10 = COPY %loy(s64)
156 $x11 = COPY %hiy(s64)
157 PseudoRET implicit $x10, implicit $x11
158
159 ...
160 ---
161 name: smulh_i64
162 body: |
163 bb.0.entry:
164 ; CHECK-LABEL: name: smulh_i64
165 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
166 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
167 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 63
168 ; CHECK-NEXT: [[ASHR:%[0-9]+]]:_(s64) = G_ASHR [[COPY]], [[C]](s64)
169 ; CHECK-NEXT: [[ASHR1:%[0-9]+]]:_(s64) = G_ASHR [[COPY1]], [[C]](s64)
170 ; CHECK-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def $x2, implicit $x2
171 ; CHECK-NEXT: $x10 = COPY [[COPY]](s64)
172 ; CHECK-NEXT: $x11 = COPY [[ASHR]](s64)
173 ; CHECK-NEXT: $x12 = COPY [[COPY1]](s64)
174 ; CHECK-NEXT: $x13 = COPY [[ASHR1]](s64)
175 ; CHECK-NEXT: PseudoCALL target-flags(riscv-call) &__multi3, csr_ilp32_lp64, implicit-def $x1, implicit $x10, implicit $x11, implicit $x12, implicit $x13, implicit-def $x10, implicit-def $x11
176 ; CHECK-NEXT: ADJCALLSTACKUP 0, 0, implicit-def $x2, implicit $x2
177 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s64) = COPY $x11
178 ; CHECK-NEXT: $x10 = COPY [[COPY2]](s64)
179 ; CHECK-NEXT: PseudoRET implicit $x10
180 %0:_(s64) = COPY $x10
181 %1:_(s64) = COPY $x11
182 %2:_(s64) = G_SMULH %0, %1
183 $x10 = COPY %2(s64)
184 PseudoRET implicit $x10
185
186 ...