1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -march=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: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
15 ; GCN: S_ENDPGM 0, implicit [[COPY]]
16 %0:sgpr(s32) = COPY $sgpr0
17 %1:sgpr(s1) = G_TRUNC %0
18 S_ENDPGM 0, implicit %1
22 name: trunc_sgpr_s32_to_s16
29 ; GCN-LABEL: name: trunc_sgpr_s32_to_s16
30 ; GCN: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
31 ; GCN: S_ENDPGM 0, implicit [[COPY]]
32 %0:sgpr(s32) = COPY $sgpr0
33 %1:sgpr(s16) = G_TRUNC %0
34 S_ENDPGM 0, implicit %1
38 name: trunc_sgpr_s64_to_s32
45 ; GCN-LABEL: name: trunc_sgpr_s64_to_s32
46 ; GCN: [[COPY:%[0-9]+]]:sreg_64 = COPY $sgpr0_sgpr1
47 ; GCN: [[COPY1:%[0-9]+]]:sreg_32 = COPY [[COPY]].sub0
48 ; GCN: S_ENDPGM 0, implicit [[COPY1]]
49 %0:sgpr(s64) = COPY $sgpr0_sgpr1
50 %1:sgpr(s32) = G_TRUNC %0
51 S_ENDPGM 0, implicit %1
55 name: trunc_sgpr_s64_to_s16
62 ; GCN-LABEL: name: trunc_sgpr_s64_to_s16
63 ; GCN: [[COPY:%[0-9]+]]:sreg_64 = COPY $sgpr0_sgpr1
64 ; GCN: [[COPY1:%[0-9]+]]:sreg_32 = COPY [[COPY]].sub0
65 ; GCN: S_ENDPGM 0, implicit [[COPY1]]
66 %0:sgpr(s64) = COPY $sgpr0_sgpr1
67 %1:sgpr(s16) = G_TRUNC %0
68 S_ENDPGM 0, implicit %1
72 name: trunc_sgpr_s64_to_s1
79 ; GCN-LABEL: name: trunc_sgpr_s64_to_s1
80 ; GCN: [[COPY:%[0-9]+]]:sreg_64 = COPY $sgpr0_sgpr1
81 ; GCN: [[COPY1:%[0-9]+]]:sreg_32 = COPY [[COPY]].sub0
82 ; GCN: S_ENDPGM 0, implicit [[COPY1]]
83 %0:sgpr(s64) = COPY $sgpr0_sgpr1
84 %1:sgpr(s1) = G_TRUNC %0
85 S_ENDPGM 0, implicit %1
89 name: trunc_sgpr_s96_to_s16
95 liveins: $sgpr0_sgpr1_sgpr2
96 ; GCN-LABEL: name: trunc_sgpr_s96_to_s16
97 ; GCN: [[COPY:%[0-9]+]]:sgpr_96 = COPY $sgpr0_sgpr1_sgpr2
98 ; GCN: [[COPY1:%[0-9]+]]:sreg_32 = COPY [[COPY]].sub0
99 ; GCN: S_ENDPGM 0, implicit [[COPY1]]
100 %0:sgpr(s96) = COPY $sgpr0_sgpr1_sgpr2
101 %1:sgpr(s16) = G_TRUNC %0
102 S_ENDPGM 0, implicit %1
106 name: trunc_sgpr_s96_to_s64
108 regBankSelected: true
112 liveins: $sgpr0_sgpr1_sgpr2
113 ; GCN-LABEL: name: trunc_sgpr_s96_to_s64
114 ; GCN: [[COPY:%[0-9]+]]:sgpr_96_with_sub0_sub1 = COPY $sgpr0_sgpr1_sgpr2
115 ; GCN: [[COPY1:%[0-9]+]]:sreg_64 = COPY [[COPY]].sub0_sub1
116 ; GCN: S_ENDPGM 0, implicit [[COPY1]]
117 %0:sgpr(s96) = COPY $sgpr0_sgpr1_sgpr2
118 %1:sgpr(s64) = G_TRUNC %0
119 S_ENDPGM 0, implicit %1
123 name: trunc_sgpr_s128_to_s16
125 regBankSelected: true
129 liveins: $sgpr0_sgpr1_sgpr2_sgpr3
130 ; GCN-LABEL: name: trunc_sgpr_s128_to_s16
131 ; GCN: [[COPY:%[0-9]+]]:sgpr_128 = COPY $sgpr0_sgpr1_sgpr2_sgpr3
132 ; GCN: [[COPY1:%[0-9]+]]:sreg_32 = COPY [[COPY]].sub0
133 ; GCN: S_ENDPGM 0, implicit [[COPY1]]
134 %0:sgpr(s128) = COPY $sgpr0_sgpr1_sgpr2_sgpr3
135 %1:sgpr(s16) = G_TRUNC %0
136 S_ENDPGM 0, implicit %1
140 name: trunc_sgpr_s128_to_s96
142 regBankSelected: true
146 liveins: $sgpr0_sgpr1_sgpr2_sgpr3
147 ; GCN-LABEL: name: trunc_sgpr_s128_to_s96
148 ; GCN: [[COPY:%[0-9]+]]:sgpr_128_with_sub0_sub1_sub2 = COPY $sgpr0_sgpr1_sgpr2_sgpr3
149 ; GCN: [[COPY1:%[0-9]+]]:sgpr_96 = COPY [[COPY]].sub0_sub1_sub2
150 ; GCN: S_ENDPGM 0, implicit [[COPY1]]
151 %0:sgpr(s128) = COPY $sgpr0_sgpr1_sgpr2_sgpr3
152 %1:sgpr(s96) = G_TRUNC %0
153 S_ENDPGM 0, implicit %1
157 name: trunc_sgpr_s256_to_s128
159 regBankSelected: true
163 liveins: $sgpr0_sgpr1_sgpr2_sgpr3_sgpr4_sgpr5_sgpr6_sgpr7
164 ; GCN-LABEL: name: trunc_sgpr_s256_to_s128
165 ; GCN: [[COPY:%[0-9]+]]:sgpr_256 = COPY $sgpr0_sgpr1_sgpr2_sgpr3_sgpr4_sgpr5_sgpr6_sgpr7
166 ; GCN: [[COPY1:%[0-9]+]]:sgpr_128 = COPY [[COPY]].sub0_sub1_sub2_sub3
167 ; GCN: S_ENDPGM 0, implicit [[COPY1]]
168 %0:sgpr(s256) = COPY $sgpr0_sgpr1_sgpr2_sgpr3_sgpr4_sgpr5_sgpr6_sgpr7
169 %1:sgpr(s128) = G_TRUNC %0
170 S_ENDPGM 0, implicit %1
174 name: trunc_sgpr_s512_to_s256
176 regBankSelected: true
180 liveins: $sgpr0_sgpr1_sgpr2_sgpr3_sgpr4_sgpr5_sgpr6_sgpr7_sgpr8_sgpr9_sgpr10_sgpr11_sgpr12_sgpr13_sgpr14_sgpr15
181 ; GCN-LABEL: name: trunc_sgpr_s512_to_s256
182 ; GCN: [[COPY:%[0-9]+]]:sgpr_512 = COPY $sgpr0_sgpr1_sgpr2_sgpr3_sgpr4_sgpr5_sgpr6_sgpr7_sgpr8_sgpr9_sgpr10_sgpr11_sgpr12_sgpr13_sgpr14_sgpr15
183 ; GCN: [[COPY1:%[0-9]+]]:sgpr_256 = COPY [[COPY]].sub0_sub1_sub2_sub3_sub4_sub5_sub6_sub7
184 ; GCN: S_ENDPGM 0, implicit [[COPY1]]
185 %0:sgpr(s512) = COPY $sgpr0_sgpr1_sgpr2_sgpr3_sgpr4_sgpr5_sgpr6_sgpr7_sgpr8_sgpr9_sgpr10_sgpr11_sgpr12_sgpr13_sgpr14_sgpr15
186 %1:sgpr(s256) = G_TRUNC %0
187 S_ENDPGM 0, implicit %1
191 name: trunc_vgpr_s32_to_s1
193 regBankSelected: true
198 ; GCN-LABEL: name: trunc_vgpr_s32_to_s1
199 ; GCN: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
200 ; GCN: S_ENDPGM 0, implicit [[COPY]]
201 %0:vgpr(s32) = COPY $vgpr0
202 %1:vgpr(s1) = G_TRUNC %0
203 S_ENDPGM 0, implicit %1
207 name: trunc_vgpr_s32_to_s16
209 regBankSelected: true
214 ; GCN-LABEL: name: trunc_vgpr_s32_to_s16
215 ; GCN: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
216 ; GCN: S_ENDPGM 0, implicit [[COPY]]
217 %0:vgpr(s32) = COPY $vgpr0
218 %1:vgpr(s16) = G_TRUNC %0
219 S_ENDPGM 0, implicit %1
223 name: trunc_vgpr_s64_to_s32
225 regBankSelected: true
229 liveins: $vgpr0_vgpr1
230 ; GCN-LABEL: name: trunc_vgpr_s64_to_s32
231 ; GCN: [[COPY:%[0-9]+]]:vreg_64 = COPY $vgpr0_vgpr1
232 ; GCN: [[COPY1:%[0-9]+]]:vgpr_32 = COPY [[COPY]].sub0
233 ; GCN: S_ENDPGM 0, implicit [[COPY1]]
234 %0:vgpr(s64) = COPY $vgpr0_vgpr1
235 %1:vgpr(s32) = G_TRUNC %0
236 S_ENDPGM 0, implicit %1
240 name: trunc_vgpr_s64_to_s16
242 regBankSelected: true
246 liveins: $vgpr0_vgpr1
247 ; GCN-LABEL: name: trunc_vgpr_s64_to_s16
248 ; GCN: [[COPY:%[0-9]+]]:vreg_64 = COPY $vgpr0_vgpr1
249 ; GCN: [[COPY1:%[0-9]+]]:vgpr_32 = COPY [[COPY]].sub0
250 ; GCN: S_ENDPGM 0, implicit [[COPY1]]
251 %0:vgpr(s64) = COPY $vgpr0_vgpr1
252 %1:vgpr(s16) = G_TRUNC %0
253 S_ENDPGM 0, implicit %1
257 name: trunc_vgpr_s64_to_s1
259 regBankSelected: true
263 liveins: $vgpr0_vgpr1
264 ; GCN-LABEL: name: trunc_vgpr_s64_to_s1
265 ; GCN: [[COPY:%[0-9]+]]:vreg_64 = COPY $vgpr0_vgpr1
266 ; GCN: [[COPY1:%[0-9]+]]:vgpr_32 = COPY [[COPY]].sub0
267 ; GCN: S_ENDPGM 0, implicit [[COPY1]]
268 %0:vgpr(s64) = COPY $vgpr0_vgpr1
269 %1:vgpr(s1) = G_TRUNC %0
270 S_ENDPGM 0, implicit %1
274 name: trunc_vgpr_s96_to_s16
276 regBankSelected: true
280 liveins: $vgpr0_vgpr1_vgpr2
281 ; GCN-LABEL: name: trunc_vgpr_s96_to_s16
282 ; GCN: [[COPY:%[0-9]+]]:vreg_96 = COPY $vgpr0_vgpr1_vgpr2
283 ; GCN: [[COPY1:%[0-9]+]]:vgpr_32 = COPY [[COPY]].sub0
284 ; GCN: S_ENDPGM 0, implicit [[COPY1]]
285 %0:vgpr(s96) = COPY $vgpr0_vgpr1_vgpr2
286 %1:vgpr(s16) = G_TRUNC %0
287 S_ENDPGM 0, implicit %1
291 name: trunc_vgpr_s96_to_s64
293 regBankSelected: true
297 liveins: $vgpr0_vgpr1_vgpr2
298 ; GCN-LABEL: name: trunc_vgpr_s96_to_s64
299 ; GCN: [[COPY:%[0-9]+]]:vreg_96 = COPY $vgpr0_vgpr1_vgpr2
300 ; GCN: [[COPY1:%[0-9]+]]:vreg_64 = COPY [[COPY]].sub0_sub1
301 ; GCN: S_ENDPGM 0, implicit [[COPY1]]
302 %0:vgpr(s96) = COPY $vgpr0_vgpr1_vgpr2
303 %1:vgpr(s64) = G_TRUNC %0
304 S_ENDPGM 0, implicit %1
308 name: trunc_vgpr_s128_to_s16
310 regBankSelected: true
314 liveins: $vgpr0_vgpr1_vgpr2_vgpr3
315 ; GCN-LABEL: name: trunc_vgpr_s128_to_s16
316 ; GCN: [[COPY:%[0-9]+]]:vreg_128 = COPY $vgpr0_vgpr1_vgpr2_vgpr3
317 ; GCN: [[COPY1:%[0-9]+]]:vgpr_32 = COPY [[COPY]].sub0
318 ; GCN: S_ENDPGM 0, implicit [[COPY1]]
319 %0:vgpr(s128) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
320 %1:vgpr(s16) = G_TRUNC %0
321 S_ENDPGM 0, implicit %1
325 name: trunc_vgpr_s128_to_s96
327 regBankSelected: true
331 liveins: $vgpr0_vgpr1_vgpr2_vgpr3
332 ; GCN-LABEL: name: trunc_vgpr_s128_to_s96
333 ; GCN: [[COPY:%[0-9]+]]:vreg_128 = COPY $vgpr0_vgpr1_vgpr2_vgpr3
334 ; GCN: [[COPY1:%[0-9]+]]:vreg_96 = COPY [[COPY]].sub0_sub1_sub2
335 ; GCN: S_ENDPGM 0, implicit [[COPY1]]
336 %0:vgpr(s128) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
337 %1:vgpr(s96) = G_TRUNC %0
338 S_ENDPGM 0, implicit %1
342 name: trunc_vgpr_s256_to_s128
344 regBankSelected: true
348 liveins: $vgpr0_vgpr1_vgpr2_vgpr3_vgpr4_vgpr5_vgpr6_vgpr7
349 ; GCN-LABEL: name: trunc_vgpr_s256_to_s128
350 ; GCN: [[COPY:%[0-9]+]]:vreg_256 = COPY $vgpr0_vgpr1_vgpr2_vgpr3_vgpr4_vgpr5_vgpr6_vgpr7
351 ; GCN: [[COPY1:%[0-9]+]]:vreg_128 = COPY [[COPY]].sub0_sub1_sub2_sub3
352 ; GCN: S_ENDPGM 0, implicit [[COPY1]]
353 %0:vgpr(s256) = COPY $vgpr0_vgpr1_vgpr2_vgpr3_vgpr4_vgpr5_vgpr6_vgpr7
354 %1:vgpr(s128) = G_TRUNC %0
355 S_ENDPGM 0, implicit %1
359 name: trunc_vgpr_s512_to_s256
361 regBankSelected: true
365 liveins: $vgpr0_vgpr1_vgpr2_vgpr3_vgpr4_vgpr5_vgpr6_vgpr7_vgpr8_vgpr9_vgpr10_vgpr11_vgpr12_vgpr13_vgpr14_vgpr15
366 ; GCN-LABEL: name: trunc_vgpr_s512_to_s256
367 ; GCN: [[COPY:%[0-9]+]]:vreg_512 = COPY $vgpr0_vgpr1_vgpr2_vgpr3_vgpr4_vgpr5_vgpr6_vgpr7_vgpr8_vgpr9_vgpr10_vgpr11_vgpr12_vgpr13_vgpr14_vgpr15
368 ; GCN: [[COPY1:%[0-9]+]]:vreg_256 = COPY [[COPY]].sub0_sub1_sub2_sub3_sub4_sub5_sub6_sub7
369 ; GCN: S_ENDPGM 0, implicit [[COPY1]]
370 %0:vgpr(s512) = COPY $vgpr0_vgpr1_vgpr2_vgpr3_vgpr4_vgpr5_vgpr6_vgpr7_vgpr8_vgpr9_vgpr10_vgpr11_vgpr12_vgpr13_vgpr14_vgpr15
371 %1:vgpr(s256) = G_TRUNC %0
372 S_ENDPGM 0, implicit %1
377 name: trunc_sgpr_s32_to_s1_use
379 regBankSelected: true
383 liveins: $sgpr0, $sgpr1
384 ; GCN-LABEL: name: trunc_sgpr_s32_to_s1_use
385 ; GCN: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
386 ; GCN: [[COPY1:%[0-9]+]]:sreg_32 = COPY $sgpr1
387 ; GCN: $scc = COPY [[COPY]]
388 ; GCN: [[S_CSELECT_B32_:%[0-9]+]]:sreg_32 = S_CSELECT_B32 [[COPY]], [[COPY1]], implicit $scc
389 ; GCN: S_ENDPGM 0, implicit [[S_CSELECT_B32_]]
390 %0:sgpr(s32) = COPY $sgpr0
391 %1:sgpr(s32) = COPY $sgpr1
392 %2:sgpr(s1) = G_TRUNC %0
393 %3:sgpr(s32) = G_SELECT %2, %0, %1
394 S_ENDPGM 0, implicit %3