1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=amdgcn -run-pass=instruction-select -verify-machineinstrs %s -o - | FileCheck %s -check-prefixes=GCN
6 name: trunc_sgpr_s32_to_s1
13 ; GCN-LABEL: name: trunc_sgpr_s32_to_s1
14 ; GCN: liveins: $sgpr0
16 ; GCN-NEXT: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
17 ; GCN-NEXT: S_ENDPGM 0, implicit [[COPY]]
18 %0:sgpr(s32) = COPY $sgpr0
19 %1:sgpr(s1) = G_TRUNC %0
20 S_ENDPGM 0, implicit %1
24 name: trunc_sgpr_s32_to_s16
31 ; GCN-LABEL: name: trunc_sgpr_s32_to_s16
32 ; GCN: liveins: $sgpr0
34 ; GCN-NEXT: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
35 ; GCN-NEXT: S_ENDPGM 0, implicit [[COPY]]
36 %0:sgpr(s32) = COPY $sgpr0
37 %1:sgpr(s16) = G_TRUNC %0
38 S_ENDPGM 0, implicit %1
42 name: trunc_sgpr_s64_to_s32
49 ; GCN-LABEL: name: trunc_sgpr_s64_to_s32
50 ; GCN: liveins: $sgpr0_sgpr1
52 ; GCN-NEXT: [[COPY:%[0-9]+]]:sreg_64 = COPY $sgpr0_sgpr1
53 ; GCN-NEXT: [[COPY1:%[0-9]+]]:sreg_32 = COPY [[COPY]].sub0
54 ; GCN-NEXT: S_ENDPGM 0, implicit [[COPY1]]
55 %0:sgpr(s64) = COPY $sgpr0_sgpr1
56 %1:sgpr(s32) = G_TRUNC %0
57 S_ENDPGM 0, implicit %1
61 name: trunc_sgpr_s64_to_s16
68 ; GCN-LABEL: name: trunc_sgpr_s64_to_s16
69 ; GCN: liveins: $sgpr0_sgpr1
71 ; GCN-NEXT: [[COPY:%[0-9]+]]:sreg_64 = COPY $sgpr0_sgpr1
72 ; GCN-NEXT: [[COPY1:%[0-9]+]]:sreg_32 = COPY [[COPY]].sub0
73 ; GCN-NEXT: S_ENDPGM 0, implicit [[COPY1]]
74 %0:sgpr(s64) = COPY $sgpr0_sgpr1
75 %1:sgpr(s16) = G_TRUNC %0
76 S_ENDPGM 0, implicit %1
80 name: trunc_sgpr_s64_to_s1
87 ; GCN-LABEL: name: trunc_sgpr_s64_to_s1
88 ; GCN: liveins: $sgpr0_sgpr1
90 ; GCN-NEXT: [[COPY:%[0-9]+]]:sreg_64 = COPY $sgpr0_sgpr1
91 ; GCN-NEXT: [[COPY1:%[0-9]+]]:sreg_32 = COPY [[COPY]].sub0
92 ; GCN-NEXT: S_ENDPGM 0, implicit [[COPY1]]
93 %0:sgpr(s64) = COPY $sgpr0_sgpr1
94 %1:sgpr(s1) = G_TRUNC %0
95 S_ENDPGM 0, implicit %1
99 name: trunc_sgpr_s96_to_s16
101 regBankSelected: true
105 liveins: $sgpr0_sgpr1_sgpr2
106 ; GCN-LABEL: name: trunc_sgpr_s96_to_s16
107 ; GCN: liveins: $sgpr0_sgpr1_sgpr2
109 ; GCN-NEXT: [[COPY:%[0-9]+]]:sgpr_96 = COPY $sgpr0_sgpr1_sgpr2
110 ; GCN-NEXT: [[COPY1:%[0-9]+]]:sreg_32 = COPY [[COPY]].sub0
111 ; GCN-NEXT: S_ENDPGM 0, implicit [[COPY1]]
112 %0:sgpr(s96) = COPY $sgpr0_sgpr1_sgpr2
113 %1:sgpr(s16) = G_TRUNC %0
114 S_ENDPGM 0, implicit %1
118 name: trunc_sgpr_s96_to_s64
120 regBankSelected: true
124 liveins: $sgpr0_sgpr1_sgpr2
125 ; GCN-LABEL: name: trunc_sgpr_s96_to_s64
126 ; GCN: liveins: $sgpr0_sgpr1_sgpr2
128 ; GCN-NEXT: [[COPY:%[0-9]+]]:sgpr_96 = COPY $sgpr0_sgpr1_sgpr2
129 ; GCN-NEXT: [[COPY1:%[0-9]+]]:sreg_64 = COPY [[COPY]].sub0_sub1
130 ; GCN-NEXT: S_ENDPGM 0, implicit [[COPY1]]
131 %0:sgpr(s96) = COPY $sgpr0_sgpr1_sgpr2
132 %1:sgpr(s64) = G_TRUNC %0
133 S_ENDPGM 0, implicit %1
137 name: trunc_sgpr_s128_to_s16
139 regBankSelected: true
143 liveins: $sgpr0_sgpr1_sgpr2_sgpr3
144 ; GCN-LABEL: name: trunc_sgpr_s128_to_s16
145 ; GCN: liveins: $sgpr0_sgpr1_sgpr2_sgpr3
147 ; GCN-NEXT: [[COPY:%[0-9]+]]:sgpr_128 = COPY $sgpr0_sgpr1_sgpr2_sgpr3
148 ; GCN-NEXT: [[COPY1:%[0-9]+]]:sreg_32 = COPY [[COPY]].sub0
149 ; GCN-NEXT: S_ENDPGM 0, implicit [[COPY1]]
150 %0:sgpr(s128) = COPY $sgpr0_sgpr1_sgpr2_sgpr3
151 %1:sgpr(s16) = G_TRUNC %0
152 S_ENDPGM 0, implicit %1
156 name: trunc_sgpr_s128_to_s96
158 regBankSelected: true
162 liveins: $sgpr0_sgpr1_sgpr2_sgpr3
163 ; GCN-LABEL: name: trunc_sgpr_s128_to_s96
164 ; GCN: liveins: $sgpr0_sgpr1_sgpr2_sgpr3
166 ; GCN-NEXT: [[COPY:%[0-9]+]]:sgpr_128 = COPY $sgpr0_sgpr1_sgpr2_sgpr3
167 ; GCN-NEXT: [[COPY1:%[0-9]+]]:sgpr_96 = COPY [[COPY]].sub0_sub1_sub2
168 ; GCN-NEXT: S_ENDPGM 0, implicit [[COPY1]]
169 %0:sgpr(s128) = COPY $sgpr0_sgpr1_sgpr2_sgpr3
170 %1:sgpr(s96) = G_TRUNC %0
171 S_ENDPGM 0, implicit %1
175 name: trunc_sgpr_s256_to_s128
177 regBankSelected: true
181 liveins: $sgpr0_sgpr1_sgpr2_sgpr3_sgpr4_sgpr5_sgpr6_sgpr7
182 ; GCN-LABEL: name: trunc_sgpr_s256_to_s128
183 ; GCN: liveins: $sgpr0_sgpr1_sgpr2_sgpr3_sgpr4_sgpr5_sgpr6_sgpr7
185 ; GCN-NEXT: [[COPY:%[0-9]+]]:sgpr_256 = COPY $sgpr0_sgpr1_sgpr2_sgpr3_sgpr4_sgpr5_sgpr6_sgpr7
186 ; GCN-NEXT: [[COPY1:%[0-9]+]]:sgpr_128 = COPY [[COPY]].sub0_sub1_sub2_sub3
187 ; GCN-NEXT: S_ENDPGM 0, implicit [[COPY1]]
188 %0:sgpr(s256) = COPY $sgpr0_sgpr1_sgpr2_sgpr3_sgpr4_sgpr5_sgpr6_sgpr7
189 %1:sgpr(s128) = G_TRUNC %0
190 S_ENDPGM 0, implicit %1
194 name: trunc_sgpr_s512_to_s256
196 regBankSelected: true
200 liveins: $sgpr0_sgpr1_sgpr2_sgpr3_sgpr4_sgpr5_sgpr6_sgpr7_sgpr8_sgpr9_sgpr10_sgpr11_sgpr12_sgpr13_sgpr14_sgpr15
201 ; GCN-LABEL: name: trunc_sgpr_s512_to_s256
202 ; GCN: liveins: $sgpr0_sgpr1_sgpr2_sgpr3_sgpr4_sgpr5_sgpr6_sgpr7_sgpr8_sgpr9_sgpr10_sgpr11_sgpr12_sgpr13_sgpr14_sgpr15
204 ; GCN-NEXT: [[COPY:%[0-9]+]]:sgpr_512 = COPY $sgpr0_sgpr1_sgpr2_sgpr3_sgpr4_sgpr5_sgpr6_sgpr7_sgpr8_sgpr9_sgpr10_sgpr11_sgpr12_sgpr13_sgpr14_sgpr15
205 ; GCN-NEXT: [[COPY1:%[0-9]+]]:sgpr_256 = COPY [[COPY]].sub0_sub1_sub2_sub3_sub4_sub5_sub6_sub7
206 ; GCN-NEXT: S_ENDPGM 0, implicit [[COPY1]]
207 %0:sgpr(s512) = COPY $sgpr0_sgpr1_sgpr2_sgpr3_sgpr4_sgpr5_sgpr6_sgpr7_sgpr8_sgpr9_sgpr10_sgpr11_sgpr12_sgpr13_sgpr14_sgpr15
208 %1:sgpr(s256) = G_TRUNC %0
209 S_ENDPGM 0, implicit %1
213 name: trunc_vgpr_s32_to_s1
215 regBankSelected: true
220 ; GCN-LABEL: name: trunc_vgpr_s32_to_s1
221 ; GCN: liveins: $vgpr0
223 ; GCN-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
224 ; GCN-NEXT: S_ENDPGM 0, implicit [[COPY]]
225 %0:vgpr(s32) = COPY $vgpr0
226 %1:vgpr(s1) = G_TRUNC %0
227 S_ENDPGM 0, implicit %1
231 name: trunc_vgpr_s32_to_s16
233 regBankSelected: true
238 ; GCN-LABEL: name: trunc_vgpr_s32_to_s16
239 ; GCN: liveins: $vgpr0
241 ; GCN-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
242 ; GCN-NEXT: S_ENDPGM 0, implicit [[COPY]]
243 %0:vgpr(s32) = COPY $vgpr0
244 %1:vgpr(s16) = G_TRUNC %0
245 S_ENDPGM 0, implicit %1
249 name: trunc_vgpr_s64_to_s32
251 regBankSelected: true
255 liveins: $vgpr0_vgpr1
256 ; GCN-LABEL: name: trunc_vgpr_s64_to_s32
257 ; GCN: liveins: $vgpr0_vgpr1
259 ; GCN-NEXT: [[COPY:%[0-9]+]]:vreg_64 = COPY $vgpr0_vgpr1
260 ; GCN-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY [[COPY]].sub0
261 ; GCN-NEXT: S_ENDPGM 0, implicit [[COPY1]]
262 %0:vgpr(s64) = COPY $vgpr0_vgpr1
263 %1:vgpr(s32) = G_TRUNC %0
264 S_ENDPGM 0, implicit %1
268 name: trunc_vgpr_s64_to_s16
270 regBankSelected: true
274 liveins: $vgpr0_vgpr1
275 ; GCN-LABEL: name: trunc_vgpr_s64_to_s16
276 ; GCN: liveins: $vgpr0_vgpr1
278 ; GCN-NEXT: [[COPY:%[0-9]+]]:vreg_64 = COPY $vgpr0_vgpr1
279 ; GCN-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY [[COPY]].sub0
280 ; GCN-NEXT: S_ENDPGM 0, implicit [[COPY1]]
281 %0:vgpr(s64) = COPY $vgpr0_vgpr1
282 %1:vgpr(s16) = G_TRUNC %0
283 S_ENDPGM 0, implicit %1
287 name: trunc_vgpr_s64_to_s1
289 regBankSelected: true
293 liveins: $vgpr0_vgpr1
294 ; GCN-LABEL: name: trunc_vgpr_s64_to_s1
295 ; GCN: liveins: $vgpr0_vgpr1
297 ; GCN-NEXT: [[COPY:%[0-9]+]]:vreg_64 = COPY $vgpr0_vgpr1
298 ; GCN-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY [[COPY]].sub0
299 ; GCN-NEXT: S_ENDPGM 0, implicit [[COPY1]]
300 %0:vgpr(s64) = COPY $vgpr0_vgpr1
301 %1:vgpr(s1) = G_TRUNC %0
302 S_ENDPGM 0, implicit %1
306 name: trunc_vgpr_s96_to_s16
308 regBankSelected: true
312 liveins: $vgpr0_vgpr1_vgpr2
313 ; GCN-LABEL: name: trunc_vgpr_s96_to_s16
314 ; GCN: liveins: $vgpr0_vgpr1_vgpr2
316 ; GCN-NEXT: [[COPY:%[0-9]+]]:vreg_96 = COPY $vgpr0_vgpr1_vgpr2
317 ; GCN-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY [[COPY]].sub0
318 ; GCN-NEXT: S_ENDPGM 0, implicit [[COPY1]]
319 %0:vgpr(s96) = COPY $vgpr0_vgpr1_vgpr2
320 %1:vgpr(s16) = G_TRUNC %0
321 S_ENDPGM 0, implicit %1
325 name: trunc_vgpr_s96_to_s64
327 regBankSelected: true
331 liveins: $vgpr0_vgpr1_vgpr2
332 ; GCN-LABEL: name: trunc_vgpr_s96_to_s64
333 ; GCN: liveins: $vgpr0_vgpr1_vgpr2
335 ; GCN-NEXT: [[COPY:%[0-9]+]]:vreg_96 = COPY $vgpr0_vgpr1_vgpr2
336 ; GCN-NEXT: [[COPY1:%[0-9]+]]:vreg_64 = COPY [[COPY]].sub0_sub1
337 ; GCN-NEXT: S_ENDPGM 0, implicit [[COPY1]]
338 %0:vgpr(s96) = COPY $vgpr0_vgpr1_vgpr2
339 %1:vgpr(s64) = G_TRUNC %0
340 S_ENDPGM 0, implicit %1
344 name: trunc_vgpr_s128_to_s16
346 regBankSelected: true
350 liveins: $vgpr0_vgpr1_vgpr2_vgpr3
351 ; GCN-LABEL: name: trunc_vgpr_s128_to_s16
352 ; GCN: liveins: $vgpr0_vgpr1_vgpr2_vgpr3
354 ; GCN-NEXT: [[COPY:%[0-9]+]]:vreg_128 = COPY $vgpr0_vgpr1_vgpr2_vgpr3
355 ; GCN-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY [[COPY]].sub0
356 ; GCN-NEXT: S_ENDPGM 0, implicit [[COPY1]]
357 %0:vgpr(s128) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
358 %1:vgpr(s16) = G_TRUNC %0
359 S_ENDPGM 0, implicit %1
363 name: trunc_vgpr_s128_to_s96
365 regBankSelected: true
369 liveins: $vgpr0_vgpr1_vgpr2_vgpr3
370 ; GCN-LABEL: name: trunc_vgpr_s128_to_s96
371 ; GCN: liveins: $vgpr0_vgpr1_vgpr2_vgpr3
373 ; GCN-NEXT: [[COPY:%[0-9]+]]:vreg_128 = COPY $vgpr0_vgpr1_vgpr2_vgpr3
374 ; GCN-NEXT: [[COPY1:%[0-9]+]]:vreg_96 = COPY [[COPY]].sub0_sub1_sub2
375 ; GCN-NEXT: S_ENDPGM 0, implicit [[COPY1]]
376 %0:vgpr(s128) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
377 %1:vgpr(s96) = G_TRUNC %0
378 S_ENDPGM 0, implicit %1
382 name: trunc_vgpr_s256_to_s128
384 regBankSelected: true
388 liveins: $vgpr0_vgpr1_vgpr2_vgpr3_vgpr4_vgpr5_vgpr6_vgpr7
389 ; GCN-LABEL: name: trunc_vgpr_s256_to_s128
390 ; GCN: liveins: $vgpr0_vgpr1_vgpr2_vgpr3_vgpr4_vgpr5_vgpr6_vgpr7
392 ; GCN-NEXT: [[COPY:%[0-9]+]]:vreg_256 = COPY $vgpr0_vgpr1_vgpr2_vgpr3_vgpr4_vgpr5_vgpr6_vgpr7
393 ; GCN-NEXT: [[COPY1:%[0-9]+]]:vreg_128 = COPY [[COPY]].sub0_sub1_sub2_sub3
394 ; GCN-NEXT: S_ENDPGM 0, implicit [[COPY1]]
395 %0:vgpr(s256) = COPY $vgpr0_vgpr1_vgpr2_vgpr3_vgpr4_vgpr5_vgpr6_vgpr7
396 %1:vgpr(s128) = G_TRUNC %0
397 S_ENDPGM 0, implicit %1
401 name: trunc_vgpr_s512_to_s256
403 regBankSelected: true
407 liveins: $vgpr0_vgpr1_vgpr2_vgpr3_vgpr4_vgpr5_vgpr6_vgpr7_vgpr8_vgpr9_vgpr10_vgpr11_vgpr12_vgpr13_vgpr14_vgpr15
408 ; GCN-LABEL: name: trunc_vgpr_s512_to_s256
409 ; GCN: liveins: $vgpr0_vgpr1_vgpr2_vgpr3_vgpr4_vgpr5_vgpr6_vgpr7_vgpr8_vgpr9_vgpr10_vgpr11_vgpr12_vgpr13_vgpr14_vgpr15
411 ; GCN-NEXT: [[COPY:%[0-9]+]]:vreg_512 = COPY $vgpr0_vgpr1_vgpr2_vgpr3_vgpr4_vgpr5_vgpr6_vgpr7_vgpr8_vgpr9_vgpr10_vgpr11_vgpr12_vgpr13_vgpr14_vgpr15
412 ; GCN-NEXT: [[COPY1:%[0-9]+]]:vreg_256 = COPY [[COPY]].sub0_sub1_sub2_sub3_sub4_sub5_sub6_sub7
413 ; GCN-NEXT: S_ENDPGM 0, implicit [[COPY1]]
414 %0:vgpr(s512) = COPY $vgpr0_vgpr1_vgpr2_vgpr3_vgpr4_vgpr5_vgpr6_vgpr7_vgpr8_vgpr9_vgpr10_vgpr11_vgpr12_vgpr13_vgpr14_vgpr15
415 %1:vgpr(s256) = G_TRUNC %0
416 S_ENDPGM 0, implicit %1
421 name: trunc_sgpr_s32_to_s1_use
423 regBankSelected: true
427 liveins: $sgpr0, $sgpr1
428 ; GCN-LABEL: name: trunc_sgpr_s32_to_s1_use
429 ; GCN: liveins: $sgpr0, $sgpr1
431 ; GCN-NEXT: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
432 ; GCN-NEXT: [[COPY1:%[0-9]+]]:sreg_32 = COPY $sgpr1
433 ; GCN-NEXT: $scc = COPY [[COPY]]
434 ; GCN-NEXT: [[S_CSELECT_B32_:%[0-9]+]]:sreg_32 = S_CSELECT_B32 [[COPY]], [[COPY1]], implicit $scc
435 ; GCN-NEXT: S_ENDPGM 0, implicit [[S_CSELECT_B32_]]
436 %0:sgpr(s32) = COPY $sgpr0
437 %1:sgpr(s32) = COPY $sgpr1
438 %2:sgpr(s1) = G_TRUNC %0
439 %3:sgpr(s32) = G_SELECT %2, %0, %1
440 S_ENDPGM 0, implicit %3