Bump version to 19.1.0-rc3
[llvm-project.git] / llvm / test / CodeGen / AMDGPU / GlobalISel / inst-select-trunc.mir
blob065e5dd5b81bcd210d892ff3a48c2ba5cf91cf40
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
4 ---
6 name: trunc_sgpr_s32_to_s1
7 legalized:       true
8 regBankSelected: true
10 body: |
11   bb.0:
12     liveins: $sgpr0
13     ; GCN-LABEL: name: trunc_sgpr_s32_to_s1
14     ; GCN: liveins: $sgpr0
15     ; GCN-NEXT: {{  $}}
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
21 ...
22 ---
24 name: trunc_sgpr_s32_to_s16
25 legalized:       true
26 regBankSelected: true
28 body: |
29   bb.0:
30     liveins: $sgpr0
31     ; GCN-LABEL: name: trunc_sgpr_s32_to_s16
32     ; GCN: liveins: $sgpr0
33     ; GCN-NEXT: {{  $}}
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
39 ...
40 ---
42 name: trunc_sgpr_s64_to_s32
43 legalized:       true
44 regBankSelected: true
46 body: |
47   bb.0:
48     liveins: $sgpr0_sgpr1
49     ; GCN-LABEL: name: trunc_sgpr_s64_to_s32
50     ; GCN: liveins: $sgpr0_sgpr1
51     ; GCN-NEXT: {{  $}}
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
58 ...
59 ---
61 name: trunc_sgpr_s64_to_s16
62 legalized:       true
63 regBankSelected: true
65 body: |
66   bb.0:
67     liveins: $sgpr0_sgpr1
68     ; GCN-LABEL: name: trunc_sgpr_s64_to_s16
69     ; GCN: liveins: $sgpr0_sgpr1
70     ; GCN-NEXT: {{  $}}
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
77 ...
78 ---
80 name: trunc_sgpr_s64_to_s1
81 legalized:       true
82 regBankSelected: true
84 body: |
85   bb.0:
86     liveins: $sgpr0_sgpr1
87     ; GCN-LABEL: name: trunc_sgpr_s64_to_s1
88     ; GCN: liveins: $sgpr0_sgpr1
89     ; GCN-NEXT: {{  $}}
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
96 ...
97 ---
99 name: trunc_sgpr_s96_to_s16
100 legalized:       true
101 regBankSelected: true
103 body: |
104   bb.0:
105     liveins: $sgpr0_sgpr1_sgpr2
106     ; GCN-LABEL: name: trunc_sgpr_s96_to_s16
107     ; GCN: liveins: $sgpr0_sgpr1_sgpr2
108     ; GCN-NEXT: {{  $}}
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
119 legalized:       true
120 regBankSelected: true
122 body: |
123   bb.0:
124     liveins: $sgpr0_sgpr1_sgpr2
125     ; GCN-LABEL: name: trunc_sgpr_s96_to_s64
126     ; GCN: liveins: $sgpr0_sgpr1_sgpr2
127     ; GCN-NEXT: {{  $}}
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
138 legalized:       true
139 regBankSelected: true
141 body: |
142   bb.0:
143     liveins: $sgpr0_sgpr1_sgpr2_sgpr3
144     ; GCN-LABEL: name: trunc_sgpr_s128_to_s16
145     ; GCN: liveins: $sgpr0_sgpr1_sgpr2_sgpr3
146     ; GCN-NEXT: {{  $}}
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
157 legalized:       true
158 regBankSelected: true
160 body: |
161   bb.0:
162     liveins: $sgpr0_sgpr1_sgpr2_sgpr3
163     ; GCN-LABEL: name: trunc_sgpr_s128_to_s96
164     ; GCN: liveins: $sgpr0_sgpr1_sgpr2_sgpr3
165     ; GCN-NEXT: {{  $}}
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
176 legalized:       true
177 regBankSelected: true
179 body: |
180   bb.0:
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
184     ; GCN-NEXT: {{  $}}
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
195 legalized:       true
196 regBankSelected: true
198 body: |
199   bb.0:
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
203     ; GCN-NEXT: {{  $}}
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
214 legalized:       true
215 regBankSelected: true
217 body: |
218   bb.0:
219     liveins: $vgpr0
220     ; GCN-LABEL: name: trunc_vgpr_s32_to_s1
221     ; GCN: liveins: $vgpr0
222     ; GCN-NEXT: {{  $}}
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
232 legalized:       true
233 regBankSelected: true
235 body: |
236   bb.0:
237     liveins: $vgpr0
238     ; GCN-LABEL: name: trunc_vgpr_s32_to_s16
239     ; GCN: liveins: $vgpr0
240     ; GCN-NEXT: {{  $}}
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
250 legalized:       true
251 regBankSelected: true
253 body: |
254   bb.0:
255     liveins: $vgpr0_vgpr1
256     ; GCN-LABEL: name: trunc_vgpr_s64_to_s32
257     ; GCN: liveins: $vgpr0_vgpr1
258     ; GCN-NEXT: {{  $}}
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
269 legalized:       true
270 regBankSelected: true
272 body: |
273   bb.0:
274     liveins: $vgpr0_vgpr1
275     ; GCN-LABEL: name: trunc_vgpr_s64_to_s16
276     ; GCN: liveins: $vgpr0_vgpr1
277     ; GCN-NEXT: {{  $}}
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
288 legalized:       true
289 regBankSelected: true
291 body: |
292   bb.0:
293     liveins: $vgpr0_vgpr1
294     ; GCN-LABEL: name: trunc_vgpr_s64_to_s1
295     ; GCN: liveins: $vgpr0_vgpr1
296     ; GCN-NEXT: {{  $}}
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
307 legalized:       true
308 regBankSelected: true
310 body: |
311   bb.0:
312     liveins: $vgpr0_vgpr1_vgpr2
313     ; GCN-LABEL: name: trunc_vgpr_s96_to_s16
314     ; GCN: liveins: $vgpr0_vgpr1_vgpr2
315     ; GCN-NEXT: {{  $}}
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
326 legalized:       true
327 regBankSelected: true
329 body: |
330   bb.0:
331     liveins: $vgpr0_vgpr1_vgpr2
332     ; GCN-LABEL: name: trunc_vgpr_s96_to_s64
333     ; GCN: liveins: $vgpr0_vgpr1_vgpr2
334     ; GCN-NEXT: {{  $}}
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
345 legalized:       true
346 regBankSelected: true
348 body: |
349   bb.0:
350     liveins: $vgpr0_vgpr1_vgpr2_vgpr3
351     ; GCN-LABEL: name: trunc_vgpr_s128_to_s16
352     ; GCN: liveins: $vgpr0_vgpr1_vgpr2_vgpr3
353     ; GCN-NEXT: {{  $}}
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
364 legalized:       true
365 regBankSelected: true
367 body: |
368   bb.0:
369     liveins: $vgpr0_vgpr1_vgpr2_vgpr3
370     ; GCN-LABEL: name: trunc_vgpr_s128_to_s96
371     ; GCN: liveins: $vgpr0_vgpr1_vgpr2_vgpr3
372     ; GCN-NEXT: {{  $}}
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
383 legalized:       true
384 regBankSelected: true
386 body: |
387   bb.0:
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
391     ; GCN-NEXT: {{  $}}
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
402 legalized:       true
403 regBankSelected: true
405 body: |
406   bb.0:
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
410     ; GCN-NEXT: {{  $}}
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
422 legalized:       true
423 regBankSelected: true
425 body: |
426   bb.0:
427     liveins: $sgpr0, $sgpr1
428     ; GCN-LABEL: name: trunc_sgpr_s32_to_s1_use
429     ; GCN: liveins: $sgpr0, $sgpr1
430     ; GCN-NEXT: {{  $}}
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