1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=riscv64 -run-pass=legalizer %s -o - \
9 liveins: $x10, $x11, $x12
11 ; CHECK-LABEL: name: fshl_i8
12 ; CHECK: liveins: $x10, $x11, $x12
14 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
15 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
16 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s64) = COPY $x12
17 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 7
18 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[COPY2]], [[C]]
19 ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 -1
20 ; CHECK-NEXT: [[XOR:%[0-9]+]]:_(s64) = G_XOR [[COPY2]], [[C1]]
21 ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s64) = G_AND [[XOR]], [[C]]
22 ; CHECK-NEXT: [[C2:%[0-9]+]]:_(s64) = G_CONSTANT i64 1
23 ; CHECK-NEXT: [[SHL:%[0-9]+]]:_(s64) = G_SHL [[COPY]], [[AND]](s64)
24 ; CHECK-NEXT: [[C3:%[0-9]+]]:_(s64) = G_CONSTANT i64 255
25 ; CHECK-NEXT: [[AND2:%[0-9]+]]:_(s64) = G_AND [[COPY1]], [[C3]]
26 ; CHECK-NEXT: [[LSHR:%[0-9]+]]:_(s64) = G_LSHR [[AND2]], [[C2]](s64)
27 ; CHECK-NEXT: [[LSHR1:%[0-9]+]]:_(s64) = G_LSHR [[LSHR]], [[AND1]](s64)
28 ; CHECK-NEXT: [[OR:%[0-9]+]]:_(s64) = G_OR [[SHL]], [[LSHR1]]
29 ; CHECK-NEXT: $x10 = COPY [[OR]](s64)
30 ; CHECK-NEXT: PseudoRET implicit $x10
32 %0:_(s8) = G_TRUNC %3(s64)
34 %1:_(s8) = G_TRUNC %4(s64)
36 %2:_(s8) = G_TRUNC %5(s64)
37 %6:_(s8) = G_FSHL %0, %1, %2(s8)
38 %7:_(s64) = G_ANYEXT %6(s8)
40 PseudoRET implicit $x10
47 liveins: $x10, $x11, $x12
49 ; CHECK-LABEL: name: fshl_i16
50 ; CHECK: liveins: $x10, $x11, $x12
52 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
53 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
54 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s64) = COPY $x12
55 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 15
56 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[COPY2]], [[C]]
57 ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 -1
58 ; CHECK-NEXT: [[XOR:%[0-9]+]]:_(s64) = G_XOR [[COPY2]], [[C1]]
59 ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s64) = G_AND [[XOR]], [[C]]
60 ; CHECK-NEXT: [[C2:%[0-9]+]]:_(s64) = G_CONSTANT i64 1
61 ; CHECK-NEXT: [[SHL:%[0-9]+]]:_(s64) = G_SHL [[COPY]], [[AND]](s64)
62 ; CHECK-NEXT: [[C3:%[0-9]+]]:_(s64) = G_CONSTANT i64 65535
63 ; CHECK-NEXT: [[AND2:%[0-9]+]]:_(s64) = G_AND [[COPY1]], [[C3]]
64 ; CHECK-NEXT: [[LSHR:%[0-9]+]]:_(s64) = G_LSHR [[AND2]], [[C2]](s64)
65 ; CHECK-NEXT: [[LSHR1:%[0-9]+]]:_(s64) = G_LSHR [[LSHR]], [[AND1]](s64)
66 ; CHECK-NEXT: [[OR:%[0-9]+]]:_(s64) = G_OR [[SHL]], [[LSHR1]]
67 ; CHECK-NEXT: $x10 = COPY [[OR]](s64)
68 ; CHECK-NEXT: PseudoRET implicit $x10
70 %0:_(s16) = G_TRUNC %3(s64)
72 %1:_(s16) = G_TRUNC %4(s64)
74 %2:_(s16) = G_TRUNC %5(s64)
75 %6:_(s16) = G_FSHL %0, %1, %2(s16)
76 %7:_(s64) = G_ANYEXT %6(s16)
78 PseudoRET implicit $x10
85 liveins: $x10, $x11, $x12
87 ; CHECK-LABEL: name: fshl_i32
88 ; CHECK: liveins: $x10, $x11, $x12
90 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
91 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
92 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s64) = COPY $x12
93 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 31
94 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[COPY2]], [[C]]
95 ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 -1
96 ; CHECK-NEXT: [[XOR:%[0-9]+]]:_(s64) = G_XOR [[COPY2]], [[C1]]
97 ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s64) = G_AND [[XOR]], [[C]]
98 ; CHECK-NEXT: [[C2:%[0-9]+]]:_(s64) = G_CONSTANT i64 1
99 ; CHECK-NEXT: [[SLLW:%[0-9]+]]:_(s64) = G_SLLW [[COPY]], [[AND]]
100 ; CHECK-NEXT: [[C3:%[0-9]+]]:_(s64) = G_CONSTANT i64 4294967295
101 ; CHECK-NEXT: [[AND2:%[0-9]+]]:_(s64) = G_AND [[COPY1]], [[C3]]
102 ; CHECK-NEXT: [[LSHR:%[0-9]+]]:_(s64) = G_LSHR [[AND2]], [[C2]](s64)
103 ; CHECK-NEXT: [[SRLW:%[0-9]+]]:_(s64) = G_SRLW [[LSHR]], [[AND1]]
104 ; CHECK-NEXT: [[OR:%[0-9]+]]:_(s64) = G_OR [[SLLW]], [[SRLW]]
105 ; CHECK-NEXT: $x10 = COPY [[OR]](s64)
106 ; CHECK-NEXT: PseudoRET implicit $x10
107 %3:_(s64) = COPY $x10
108 %0:_(s32) = G_TRUNC %3(s64)
109 %4:_(s64) = COPY $x11
110 %1:_(s32) = G_TRUNC %4(s64)
111 %5:_(s64) = COPY $x12
112 %2:_(s32) = G_TRUNC %5(s64)
113 %6:_(s32) = G_FSHL %0, %1, %2(s32)
114 %7:_(s64) = G_ANYEXT %6(s32)
116 PseudoRET implicit $x10
123 liveins: $x10, $x11, $x12
125 ; CHECK-LABEL: name: fshl_i64
126 ; CHECK: liveins: $x10, $x11, $x12
128 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
129 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
130 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s64) = COPY $x12
131 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 63
132 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[COPY2]], [[C]]
133 ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 -1
134 ; CHECK-NEXT: [[XOR:%[0-9]+]]:_(s64) = G_XOR [[COPY2]], [[C1]]
135 ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s64) = G_AND [[XOR]], [[C]]
136 ; CHECK-NEXT: [[C2:%[0-9]+]]:_(s64) = G_CONSTANT i64 1
137 ; CHECK-NEXT: [[SHL:%[0-9]+]]:_(s64) = G_SHL [[COPY]], [[AND]](s64)
138 ; CHECK-NEXT: [[LSHR:%[0-9]+]]:_(s64) = G_LSHR [[COPY1]], [[C2]](s64)
139 ; CHECK-NEXT: [[LSHR1:%[0-9]+]]:_(s64) = G_LSHR [[LSHR]], [[AND1]](s64)
140 ; CHECK-NEXT: [[OR:%[0-9]+]]:_(s64) = G_OR [[SHL]], [[LSHR1]]
141 ; CHECK-NEXT: $x10 = COPY [[OR]](s64)
142 ; CHECK-NEXT: PseudoRET implicit $x10
143 %0:_(s64) = COPY $x10
144 %1:_(s64) = COPY $x11
145 %2:_(s64) = COPY $x12
146 %3:_(s64) = G_FSHL %0, %1, %2(s64)
148 PseudoRET implicit $x10
155 liveins: $x10, $x11, $x12
157 ; CHECK-LABEL: name: fshr_i8
158 ; CHECK: liveins: $x10, $x11, $x12
160 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
161 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
162 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s64) = COPY $x12
163 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 7
164 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[COPY2]], [[C]]
165 ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 -1
166 ; CHECK-NEXT: [[XOR:%[0-9]+]]:_(s64) = G_XOR [[COPY2]], [[C1]]
167 ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s64) = G_AND [[XOR]], [[C]]
168 ; CHECK-NEXT: [[C2:%[0-9]+]]:_(s64) = G_CONSTANT i64 1
169 ; CHECK-NEXT: [[SHL:%[0-9]+]]:_(s64) = G_SHL [[COPY]], [[C2]](s64)
170 ; CHECK-NEXT: [[SHL1:%[0-9]+]]:_(s64) = G_SHL [[SHL]], [[AND1]](s64)
171 ; CHECK-NEXT: [[C3:%[0-9]+]]:_(s64) = G_CONSTANT i64 255
172 ; CHECK-NEXT: [[AND2:%[0-9]+]]:_(s64) = G_AND [[COPY1]], [[C3]]
173 ; CHECK-NEXT: [[LSHR:%[0-9]+]]:_(s64) = G_LSHR [[AND2]], [[AND]](s64)
174 ; CHECK-NEXT: [[OR:%[0-9]+]]:_(s64) = G_OR [[SHL1]], [[LSHR]]
175 ; CHECK-NEXT: $x10 = COPY [[OR]](s64)
176 ; CHECK-NEXT: PseudoRET implicit $x10
177 %3:_(s64) = COPY $x10
178 %0:_(s8) = G_TRUNC %3(s64)
179 %4:_(s64) = COPY $x11
180 %1:_(s8) = G_TRUNC %4(s64)
181 %5:_(s64) = COPY $x12
182 %2:_(s8) = G_TRUNC %5(s64)
183 %6:_(s8) = G_FSHR %0, %1, %2(s8)
184 %7:_(s64) = G_ANYEXT %6(s8)
186 PseudoRET implicit $x10
193 liveins: $x10, $x11, $x12
195 ; CHECK-LABEL: name: fshr_i16
196 ; CHECK: liveins: $x10, $x11, $x12
198 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
199 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
200 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s64) = COPY $x12
201 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 15
202 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[COPY2]], [[C]]
203 ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 -1
204 ; CHECK-NEXT: [[XOR:%[0-9]+]]:_(s64) = G_XOR [[COPY2]], [[C1]]
205 ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s64) = G_AND [[XOR]], [[C]]
206 ; CHECK-NEXT: [[C2:%[0-9]+]]:_(s64) = G_CONSTANT i64 1
207 ; CHECK-NEXT: [[SHL:%[0-9]+]]:_(s64) = G_SHL [[COPY]], [[C2]](s64)
208 ; CHECK-NEXT: [[SHL1:%[0-9]+]]:_(s64) = G_SHL [[SHL]], [[AND1]](s64)
209 ; CHECK-NEXT: [[C3:%[0-9]+]]:_(s64) = G_CONSTANT i64 65535
210 ; CHECK-NEXT: [[AND2:%[0-9]+]]:_(s64) = G_AND [[COPY1]], [[C3]]
211 ; CHECK-NEXT: [[LSHR:%[0-9]+]]:_(s64) = G_LSHR [[AND2]], [[AND]](s64)
212 ; CHECK-NEXT: [[OR:%[0-9]+]]:_(s64) = G_OR [[SHL1]], [[LSHR]]
213 ; CHECK-NEXT: $x10 = COPY [[OR]](s64)
214 ; CHECK-NEXT: PseudoRET implicit $x10
215 %3:_(s64) = COPY $x10
216 %0:_(s16) = G_TRUNC %3(s64)
217 %4:_(s64) = COPY $x11
218 %1:_(s16) = G_TRUNC %4(s64)
219 %5:_(s64) = COPY $x12
220 %2:_(s16) = G_TRUNC %5(s64)
221 %6:_(s16) = G_FSHR %0, %1, %2(s16)
222 %7:_(s64) = G_ANYEXT %6(s16)
224 PseudoRET implicit $x10
231 liveins: $x10, $x11, $x12
233 ; CHECK-LABEL: name: fshr_i32
234 ; CHECK: liveins: $x10, $x11, $x12
236 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
237 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
238 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s64) = COPY $x12
239 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 31
240 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[COPY2]], [[C]]
241 ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 -1
242 ; CHECK-NEXT: [[XOR:%[0-9]+]]:_(s64) = G_XOR [[COPY2]], [[C1]]
243 ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s64) = G_AND [[XOR]], [[C]]
244 ; CHECK-NEXT: [[C2:%[0-9]+]]:_(s64) = G_CONSTANT i64 1
245 ; CHECK-NEXT: [[SHL:%[0-9]+]]:_(s64) = G_SHL [[COPY]], [[C2]](s64)
246 ; CHECK-NEXT: [[SLLW:%[0-9]+]]:_(s64) = G_SLLW [[SHL]], [[AND1]]
247 ; CHECK-NEXT: [[SRLW:%[0-9]+]]:_(s64) = G_SRLW [[COPY1]], [[AND]]
248 ; CHECK-NEXT: [[OR:%[0-9]+]]:_(s64) = G_OR [[SLLW]], [[SRLW]]
249 ; CHECK-NEXT: $x10 = COPY [[OR]](s64)
250 ; CHECK-NEXT: PseudoRET implicit $x10
251 %3:_(s64) = COPY $x10
252 %0:_(s32) = G_TRUNC %3(s64)
253 %4:_(s64) = COPY $x11
254 %1:_(s32) = G_TRUNC %4(s64)
255 %5:_(s64) = COPY $x12
256 %2:_(s32) = G_TRUNC %5(s64)
257 %6:_(s32) = G_FSHR %0, %1, %2(s32)
258 %7:_(s64) = G_ANYEXT %6(s32)
260 PseudoRET implicit $x10
267 liveins: $x10, $x11, $x12
269 ; CHECK-LABEL: name: fshr_i64
270 ; CHECK: liveins: $x10, $x11, $x12
272 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
273 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
274 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s64) = COPY $x12
275 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 63
276 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[COPY2]], [[C]]
277 ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 -1
278 ; CHECK-NEXT: [[XOR:%[0-9]+]]:_(s64) = G_XOR [[COPY2]], [[C1]]
279 ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s64) = G_AND [[XOR]], [[C]]
280 ; CHECK-NEXT: [[C2:%[0-9]+]]:_(s64) = G_CONSTANT i64 1
281 ; CHECK-NEXT: [[SHL:%[0-9]+]]:_(s64) = G_SHL [[COPY]], [[C2]](s64)
282 ; CHECK-NEXT: [[SHL1:%[0-9]+]]:_(s64) = G_SHL [[SHL]], [[AND1]](s64)
283 ; CHECK-NEXT: [[LSHR:%[0-9]+]]:_(s64) = G_LSHR [[COPY1]], [[AND]](s64)
284 ; CHECK-NEXT: [[OR:%[0-9]+]]:_(s64) = G_OR [[SHL1]], [[LSHR]]
285 ; CHECK-NEXT: $x10 = COPY [[OR]](s64)
286 ; CHECK-NEXT: PseudoRET implicit $x10
287 %0:_(s64) = COPY $x10
288 %1:_(s64) = COPY $x11
289 %2:_(s64) = COPY $x12
290 %3:_(s64) = G_FSHR %0, %1, %2(s64)
292 PseudoRET implicit $x10