1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -march=amdgcn -run-pass=amdgpu-prelegalizer-combiner -verify-machineinstrs %s -o - | FileCheck %s
6 tracksRegLiveness: true
11 ; CHECK-LABEL: name: ushlsat_and_1
12 ; CHECK: liveins: $sgpr0
13 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $sgpr0
14 ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 2
15 ; CHECK: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 1073741820
16 ; CHECK: [[C2:%[0-9]+]]:_(s32) = G_CONSTANT i32 4
17 ; CHECK: [[USHLSAT:%[0-9]+]]:_(s32) = G_USHLSAT [[COPY]], [[C2]](s32)
18 ; CHECK: [[USHLSAT1:%[0-9]+]]:_(s32) = G_USHLSAT [[C1]], [[C]](s32)
19 ; CHECK: [[AND:%[0-9]+]]:_(s32) = G_AND [[USHLSAT]], [[USHLSAT1]]
20 ; CHECK: $sgpr0 = COPY [[AND]](s32)
21 ; CHECK: SI_RETURN_TO_EPILOG implicit $sgpr0
22 %0:_(s32) = COPY $sgpr0
23 %2:_(s32) = G_CONSTANT i32 2
24 %4:_(s32) = G_CONSTANT i32 1073741820
25 %3:_(s32) = G_USHLSAT %0, %2(s32)
26 %5:_(s32) = G_AND %3, %4
27 %6:_(s32) = G_USHLSAT %5, %2(s32)
29 SI_RETURN_TO_EPILOG implicit $sgpr0
34 tracksRegLiveness: true
39 ; CHECK-LABEL: name: ushlsat_and_2
40 ; CHECK: liveins: $sgpr0
41 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $sgpr0
42 ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 536870880
43 ; CHECK: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 3
44 ; CHECK: [[C2:%[0-9]+]]:_(s32) = G_CONSTANT i32 8
45 ; CHECK: [[USHLSAT:%[0-9]+]]:_(s32) = G_USHLSAT [[COPY]], [[C2]](s32)
46 ; CHECK: [[USHLSAT1:%[0-9]+]]:_(s32) = G_USHLSAT [[C]], [[C1]](s32)
47 ; CHECK: [[AND:%[0-9]+]]:_(s32) = G_AND [[USHLSAT]], [[USHLSAT1]]
48 ; CHECK: $sgpr0 = COPY [[AND]](s32)
49 ; CHECK: SI_RETURN_TO_EPILOG implicit $sgpr0
50 %0:_(s32) = COPY $sgpr0
51 %2:_(s32) = G_CONSTANT i32 5
52 %4:_(s32) = G_CONSTANT i32 536870880
53 %6:_(s32) = G_CONSTANT i32 3
54 %3:_(s32) = G_USHLSAT %0, %2(s32)
55 %5:_(s32) = G_AND %3, %4
56 %7:_(s32) = G_USHLSAT %5, %6(s32)
58 SI_RETURN_TO_EPILOG implicit $sgpr0
63 tracksRegLiveness: true
68 ; CHECK-LABEL: name: ushlsat_and_3
69 ; CHECK: liveins: $sgpr0
70 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $sgpr0
71 ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 65536
72 ; CHECK: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 16
73 ; CHECK: [[C2:%[0-9]+]]:_(s32) = G_CONSTANT i32 19
74 ; CHECK: [[USHLSAT:%[0-9]+]]:_(s32) = G_USHLSAT [[COPY]], [[C2]](s32)
75 ; CHECK: [[USHLSAT1:%[0-9]+]]:_(s32) = G_USHLSAT [[C]], [[C1]](s32)
76 ; CHECK: [[AND:%[0-9]+]]:_(s32) = G_AND [[USHLSAT]], [[USHLSAT1]]
77 ; CHECK: $sgpr0 = COPY [[AND]](s32)
78 ; CHECK: SI_RETURN_TO_EPILOG implicit $sgpr0
79 %0:_(s32) = COPY $sgpr0
80 %2:_(s32) = G_CONSTANT i32 3
81 %4:_(s32) = G_CONSTANT i32 65536
82 %6:_(s32) = G_CONSTANT i32 16
83 %3:_(s32) = G_USHLSAT %0, %2(s32)
84 %5:_(s32) = G_AND %3, %4
85 %7:_(s32) = G_USHLSAT %5, %6(s32)
87 SI_RETURN_TO_EPILOG implicit $sgpr0
92 tracksRegLiveness: true
97 ; CHECK-LABEL: name: ushlsat_or_1
98 ; CHECK: liveins: $sgpr0
99 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $sgpr0
100 ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 2
101 ; CHECK: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 -1073741821
102 ; CHECK: [[C2:%[0-9]+]]:_(s32) = G_CONSTANT i32 4
103 ; CHECK: [[USHLSAT:%[0-9]+]]:_(s32) = G_USHLSAT [[COPY]], [[C2]](s32)
104 ; CHECK: [[USHLSAT1:%[0-9]+]]:_(s32) = G_USHLSAT [[C1]], [[C]](s32)
105 ; CHECK: [[OR:%[0-9]+]]:_(s32) = G_OR [[USHLSAT]], [[USHLSAT1]]
106 ; CHECK: $sgpr0 = COPY [[OR]](s32)
107 ; CHECK: SI_RETURN_TO_EPILOG implicit $sgpr0
108 %0:_(s32) = COPY $sgpr0
109 %2:_(s32) = G_CONSTANT i32 2
110 %4:_(s32) = G_CONSTANT i32 -1073741821
111 %3:_(s32) = G_USHLSAT %0, %2(s32)
112 %5:_(s32) = G_OR %3, %4
113 %6:_(s32) = G_USHLSAT %5, %2(s32)
114 $sgpr0 = COPY %6(s32)
115 SI_RETURN_TO_EPILOG implicit $sgpr0
120 tracksRegLiveness: true
125 ; CHECK-LABEL: name: ushlsat_or_2
126 ; CHECK: liveins: $sgpr0
127 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $sgpr0
128 ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 -536870881
129 ; CHECK: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 3
130 ; CHECK: [[C2:%[0-9]+]]:_(s32) = G_CONSTANT i32 8
131 ; CHECK: [[USHLSAT:%[0-9]+]]:_(s32) = G_USHLSAT [[COPY]], [[C2]](s32)
132 ; CHECK: [[USHLSAT1:%[0-9]+]]:_(s32) = G_USHLSAT [[C]], [[C1]](s32)
133 ; CHECK: [[OR:%[0-9]+]]:_(s32) = G_OR [[USHLSAT]], [[USHLSAT1]]
134 ; CHECK: $sgpr0 = COPY [[OR]](s32)
135 ; CHECK: SI_RETURN_TO_EPILOG implicit $sgpr0
136 %0:_(s32) = COPY $sgpr0
137 %2:_(s32) = G_CONSTANT i32 5
138 %4:_(s32) = G_CONSTANT i32 -536870881
139 %6:_(s32) = G_CONSTANT i32 3
140 %3:_(s32) = G_USHLSAT %0, %2(s32)
141 %5:_(s32) = G_OR %3, %4
142 %7:_(s32) = G_USHLSAT %5, %6(s32)
143 $sgpr0 = COPY %7(s32)
144 SI_RETURN_TO_EPILOG implicit $sgpr0
149 tracksRegLiveness: true
154 ; CHECK-LABEL: name: ushlsat_or_3
155 ; CHECK: liveins: $sgpr0
156 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $sgpr0
157 ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 65536
158 ; CHECK: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 16
159 ; CHECK: [[C2:%[0-9]+]]:_(s32) = G_CONSTANT i32 19
160 ; CHECK: [[USHLSAT:%[0-9]+]]:_(s32) = G_USHLSAT [[COPY]], [[C2]](s32)
161 ; CHECK: [[USHLSAT1:%[0-9]+]]:_(s32) = G_USHLSAT [[C]], [[C1]](s32)
162 ; CHECK: [[OR:%[0-9]+]]:_(s32) = G_OR [[USHLSAT]], [[USHLSAT1]]
163 ; CHECK: $sgpr0 = COPY [[OR]](s32)
164 ; CHECK: SI_RETURN_TO_EPILOG implicit $sgpr0
165 %0:_(s32) = COPY $sgpr0
166 %2:_(s32) = G_CONSTANT i32 3
167 %4:_(s32) = G_CONSTANT i32 65536
168 %6:_(s32) = G_CONSTANT i32 16
169 %3:_(s32) = G_USHLSAT %0, %2(s32)
170 %5:_(s32) = G_OR %3, %4
171 %7:_(s32) = G_USHLSAT %5, %6(s32)
172 $sgpr0 = COPY %7(s32)
173 SI_RETURN_TO_EPILOG implicit $sgpr0
178 tracksRegLiveness: true
183 ; CHECK-LABEL: name: ushlsat_xor
184 ; CHECK: liveins: $sgpr0
185 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $sgpr0
186 ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 43690
187 ; CHECK: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 5
188 ; CHECK: [[C2:%[0-9]+]]:_(s32) = G_CONSTANT i32 8
189 ; CHECK: [[USHLSAT:%[0-9]+]]:_(s32) = G_USHLSAT [[COPY]], [[C2]](s32)
190 ; CHECK: [[USHLSAT1:%[0-9]+]]:_(s32) = G_USHLSAT [[C]], [[C1]](s32)
191 ; CHECK: [[XOR:%[0-9]+]]:_(s32) = G_XOR [[USHLSAT]], [[USHLSAT1]]
192 ; CHECK: $sgpr0 = COPY [[XOR]](s32)
193 ; CHECK: SI_RETURN_TO_EPILOG implicit $sgpr0
194 %0:_(s32) = COPY $sgpr0
195 %2:_(s32) = G_CONSTANT i32 3
196 %4:_(s32) = G_CONSTANT i32 43690
197 %6:_(s32) = G_CONSTANT i32 5
198 %3:_(s32) = G_USHLSAT %0, %2(s32)
199 %5:_(s32) = G_XOR %3, %4
200 %7:_(s32) = G_USHLSAT %5, %6(s32)
201 $sgpr0 = COPY %7(s32)
202 SI_RETURN_TO_EPILOG implicit $sgpr0
207 tracksRegLiveness: true
212 ; CHECK-LABEL: name: sshlsat_and_1
213 ; CHECK: liveins: $sgpr0
214 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $sgpr0
215 ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 2
216 ; CHECK: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 1073741820
217 ; CHECK: [[C2:%[0-9]+]]:_(s32) = G_CONSTANT i32 4
218 ; CHECK: [[SSHLSAT:%[0-9]+]]:_(s32) = G_SSHLSAT [[COPY]], [[C2]](s32)
219 ; CHECK: [[SSHLSAT1:%[0-9]+]]:_(s32) = G_SSHLSAT [[C1]], [[C]](s32)
220 ; CHECK: [[AND:%[0-9]+]]:_(s32) = G_AND [[SSHLSAT]], [[SSHLSAT1]]
221 ; CHECK: $sgpr0 = COPY [[AND]](s32)
222 ; CHECK: SI_RETURN_TO_EPILOG implicit $sgpr0
223 %0:_(s32) = COPY $sgpr0
224 %2:_(s32) = G_CONSTANT i32 2
225 %4:_(s32) = G_CONSTANT i32 1073741820
226 %3:_(s32) = G_SSHLSAT %0, %2(s32)
227 %5:_(s32) = G_AND %3, %4
228 %6:_(s32) = G_SSHLSAT %5, %2(s32)
229 $sgpr0 = COPY %6(s32)
230 SI_RETURN_TO_EPILOG implicit $sgpr0
235 tracksRegLiveness: true
240 ; CHECK-LABEL: name: sshlsat_and_2
241 ; CHECK: liveins: $sgpr0
242 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $sgpr0
243 ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 536870880
244 ; CHECK: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 3
245 ; CHECK: [[C2:%[0-9]+]]:_(s32) = G_CONSTANT i32 8
246 ; CHECK: [[SSHLSAT:%[0-9]+]]:_(s32) = G_SSHLSAT [[COPY]], [[C2]](s32)
247 ; CHECK: [[SSHLSAT1:%[0-9]+]]:_(s32) = G_SSHLSAT [[C]], [[C1]](s32)
248 ; CHECK: [[AND:%[0-9]+]]:_(s32) = G_AND [[SSHLSAT]], [[SSHLSAT1]]
249 ; CHECK: $sgpr0 = COPY [[AND]](s32)
250 ; CHECK: SI_RETURN_TO_EPILOG implicit $sgpr0
251 %0:_(s32) = COPY $sgpr0
252 %2:_(s32) = G_CONSTANT i32 5
253 %4:_(s32) = G_CONSTANT i32 536870880
254 %6:_(s32) = G_CONSTANT i32 3
255 %3:_(s32) = G_SSHLSAT %0, %2(s32)
256 %5:_(s32) = G_AND %3, %4
257 %7:_(s32) = G_SSHLSAT %5, %6(s32)
258 $sgpr0 = COPY %7(s32)
259 SI_RETURN_TO_EPILOG implicit $sgpr0
264 tracksRegLiveness: true
269 ; CHECK-LABEL: name: sshlsat_and_3
270 ; CHECK: liveins: $sgpr0
271 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $sgpr0
272 ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 65536
273 ; CHECK: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 16
274 ; CHECK: [[C2:%[0-9]+]]:_(s32) = G_CONSTANT i32 19
275 ; CHECK: [[SSHLSAT:%[0-9]+]]:_(s32) = G_SSHLSAT [[COPY]], [[C2]](s32)
276 ; CHECK: [[SSHLSAT1:%[0-9]+]]:_(s32) = G_SSHLSAT [[C]], [[C1]](s32)
277 ; CHECK: [[AND:%[0-9]+]]:_(s32) = G_AND [[SSHLSAT]], [[SSHLSAT1]]
278 ; CHECK: $sgpr0 = COPY [[AND]](s32)
279 ; CHECK: SI_RETURN_TO_EPILOG implicit $sgpr0
280 %0:_(s32) = COPY $sgpr0
281 %2:_(s32) = G_CONSTANT i32 3
282 %4:_(s32) = G_CONSTANT i32 65536
283 %6:_(s32) = G_CONSTANT i32 16
284 %3:_(s32) = G_SSHLSAT %0, %2(s32)
285 %5:_(s32) = G_AND %3, %4
286 %7:_(s32) = G_SSHLSAT %5, %6(s32)
287 $sgpr0 = COPY %7(s32)
288 SI_RETURN_TO_EPILOG implicit $sgpr0
293 tracksRegLiveness: true
298 ; CHECK-LABEL: name: sshlsat_or_1
299 ; CHECK: liveins: $sgpr0
300 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $sgpr0
301 ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 2
302 ; CHECK: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 -1073741821
303 ; CHECK: [[C2:%[0-9]+]]:_(s32) = G_CONSTANT i32 4
304 ; CHECK: [[SSHLSAT:%[0-9]+]]:_(s32) = G_SSHLSAT [[COPY]], [[C2]](s32)
305 ; CHECK: [[SSHLSAT1:%[0-9]+]]:_(s32) = G_SSHLSAT [[C1]], [[C]](s32)
306 ; CHECK: [[OR:%[0-9]+]]:_(s32) = G_OR [[SSHLSAT]], [[SSHLSAT1]]
307 ; CHECK: $sgpr0 = COPY [[OR]](s32)
308 ; CHECK: SI_RETURN_TO_EPILOG implicit $sgpr0
309 %0:_(s32) = COPY $sgpr0
310 %2:_(s32) = G_CONSTANT i32 2
311 %4:_(s32) = G_CONSTANT i32 -1073741821
312 %3:_(s32) = G_SSHLSAT %0, %2(s32)
313 %5:_(s32) = G_OR %3, %4
314 %6:_(s32) = G_SSHLSAT %5, %2(s32)
315 $sgpr0 = COPY %6(s32)
316 SI_RETURN_TO_EPILOG implicit $sgpr0
321 tracksRegLiveness: true
326 ; CHECK-LABEL: name: sshlsat_or_2
327 ; CHECK: liveins: $sgpr0
328 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $sgpr0
329 ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 -536870881
330 ; CHECK: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 3
331 ; CHECK: [[C2:%[0-9]+]]:_(s32) = G_CONSTANT i32 8
332 ; CHECK: [[SSHLSAT:%[0-9]+]]:_(s32) = G_SSHLSAT [[COPY]], [[C2]](s32)
333 ; CHECK: [[SSHLSAT1:%[0-9]+]]:_(s32) = G_SSHLSAT [[C]], [[C1]](s32)
334 ; CHECK: [[OR:%[0-9]+]]:_(s32) = G_OR [[SSHLSAT]], [[SSHLSAT1]]
335 ; CHECK: $sgpr0 = COPY [[OR]](s32)
336 ; CHECK: SI_RETURN_TO_EPILOG implicit $sgpr0
337 %0:_(s32) = COPY $sgpr0
338 %2:_(s32) = G_CONSTANT i32 5
339 %4:_(s32) = G_CONSTANT i32 -536870881
340 %6:_(s32) = G_CONSTANT i32 3
341 %3:_(s32) = G_SSHLSAT %0, %2(s32)
342 %5:_(s32) = G_OR %3, %4
343 %7:_(s32) = G_SSHLSAT %5, %6(s32)
344 $sgpr0 = COPY %7(s32)
345 SI_RETURN_TO_EPILOG implicit $sgpr0
350 tracksRegLiveness: true
355 ; CHECK-LABEL: name: sshlsat_or_3
356 ; CHECK: liveins: $sgpr0
357 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $sgpr0
358 ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 65536
359 ; CHECK: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 16
360 ; CHECK: [[C2:%[0-9]+]]:_(s32) = G_CONSTANT i32 19
361 ; CHECK: [[SSHLSAT:%[0-9]+]]:_(s32) = G_SSHLSAT [[COPY]], [[C2]](s32)
362 ; CHECK: [[SSHLSAT1:%[0-9]+]]:_(s32) = G_SSHLSAT [[C]], [[C1]](s32)
363 ; CHECK: [[OR:%[0-9]+]]:_(s32) = G_OR [[SSHLSAT]], [[SSHLSAT1]]
364 ; CHECK: $sgpr0 = COPY [[OR]](s32)
365 ; CHECK: SI_RETURN_TO_EPILOG implicit $sgpr0
366 %0:_(s32) = COPY $sgpr0
367 %2:_(s32) = G_CONSTANT i32 3
368 %4:_(s32) = G_CONSTANT i32 65536
369 %6:_(s32) = G_CONSTANT i32 16
370 %3:_(s32) = G_SSHLSAT %0, %2(s32)
371 %5:_(s32) = G_OR %3, %4
372 %7:_(s32) = G_SSHLSAT %5, %6(s32)
373 $sgpr0 = COPY %7(s32)
374 SI_RETURN_TO_EPILOG implicit $sgpr0
379 tracksRegLiveness: true
384 ; CHECK-LABEL: name: sshlsat_xor
385 ; CHECK: liveins: $sgpr0
386 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $sgpr0
387 ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 43690
388 ; CHECK: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 5
389 ; CHECK: [[C2:%[0-9]+]]:_(s32) = G_CONSTANT i32 8
390 ; CHECK: [[SSHLSAT:%[0-9]+]]:_(s32) = G_SSHLSAT [[COPY]], [[C2]](s32)
391 ; CHECK: [[SSHLSAT1:%[0-9]+]]:_(s32) = G_SSHLSAT [[C]], [[C1]](s32)
392 ; CHECK: [[XOR:%[0-9]+]]:_(s32) = G_XOR [[SSHLSAT]], [[SSHLSAT1]]
393 ; CHECK: $sgpr0 = COPY [[XOR]](s32)
394 ; CHECK: SI_RETURN_TO_EPILOG implicit $sgpr0
395 %0:_(s32) = COPY $sgpr0
396 %2:_(s32) = G_CONSTANT i32 3
397 %4:_(s32) = G_CONSTANT i32 43690
398 %6:_(s32) = G_CONSTANT i32 5
399 %3:_(s32) = G_SSHLSAT %0, %2(s32)
400 %5:_(s32) = G_XOR %3, %4
401 %7:_(s32) = G_SSHLSAT %5, %6(s32)
402 $sgpr0 = COPY %7(s32)
403 SI_RETURN_TO_EPILOG implicit $sgpr0