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
3
4---
5
6name: trunc_sgpr_s32_to_s1
7legalized:       true
8regBankSelected: true
9
10body: |
11  bb.0:
12    liveins: $sgpr0
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
19...
20---
21
22name: trunc_sgpr_s32_to_s16
23legalized:       true
24regBankSelected: true
25
26body: |
27  bb.0:
28    liveins: $sgpr0
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
35...
36---
37
38name: trunc_sgpr_s64_to_s32
39legalized:       true
40regBankSelected: true
41
42body: |
43  bb.0:
44    liveins: $sgpr0_sgpr1
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
52...
53---
54
55name: trunc_sgpr_s64_to_s16
56legalized:       true
57regBankSelected: true
58
59body: |
60  bb.0:
61    liveins: $sgpr0_sgpr1
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
69...
70---
71
72name: trunc_sgpr_s64_to_s1
73legalized:       true
74regBankSelected: true
75
76body: |
77  bb.0:
78    liveins: $sgpr0_sgpr1
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
86...
87---
88
89name: trunc_sgpr_s96_to_s16
90legalized:       true
91regBankSelected: true
92
93body: |
94  bb.0:
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
103...
104---
105
106name: trunc_sgpr_s96_to_s64
107legalized:       true
108regBankSelected: true
109
110body: |
111  bb.0:
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
120...
121---
122
123name: trunc_sgpr_s128_to_s16
124legalized:       true
125regBankSelected: true
126
127body: |
128  bb.0:
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
137...
138---
139
140name: trunc_sgpr_s128_to_s96
141legalized:       true
142regBankSelected: true
143
144body: |
145  bb.0:
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
154...
155---
156
157name: trunc_sgpr_s256_to_s128
158legalized:       true
159regBankSelected: true
160
161body: |
162  bb.0:
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
171...
172---
173
174name: trunc_sgpr_s512_to_s256
175legalized:       true
176regBankSelected: true
177
178body: |
179  bb.0:
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
188...
189---
190
191name: trunc_vgpr_s32_to_s1
192legalized:       true
193regBankSelected: true
194
195body: |
196  bb.0:
197    liveins: $vgpr0
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
204...
205---
206
207name: trunc_vgpr_s32_to_s16
208legalized:       true
209regBankSelected: true
210
211body: |
212  bb.0:
213    liveins: $vgpr0
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
220...
221---
222
223name: trunc_vgpr_s64_to_s32
224legalized:       true
225regBankSelected: true
226
227body: |
228  bb.0:
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
237...
238---
239
240name: trunc_vgpr_s64_to_s16
241legalized:       true
242regBankSelected: true
243
244body: |
245  bb.0:
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
254...
255---
256
257name: trunc_vgpr_s64_to_s1
258legalized:       true
259regBankSelected: true
260
261body: |
262  bb.0:
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
271...
272---
273
274name: trunc_vgpr_s96_to_s16
275legalized:       true
276regBankSelected: true
277
278body: |
279  bb.0:
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
288...
289---
290
291name: trunc_vgpr_s96_to_s64
292legalized:       true
293regBankSelected: true
294
295body: |
296  bb.0:
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
305...
306---
307
308name: trunc_vgpr_s128_to_s16
309legalized:       true
310regBankSelected: true
311
312body: |
313  bb.0:
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
322...
323---
324
325name: trunc_vgpr_s128_to_s96
326legalized:       true
327regBankSelected: true
328
329body: |
330  bb.0:
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
339...
340---
341
342name: trunc_vgpr_s256_to_s128
343legalized:       true
344regBankSelected: true
345
346body: |
347  bb.0:
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
356...
357---
358
359name: trunc_vgpr_s512_to_s256
360legalized:       true
361regBankSelected: true
362
363body: |
364  bb.0:
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
373...
374
375---
376
377name: trunc_sgpr_s32_to_s1_use
378legalized:       true
379regBankSelected: true
380
381body: |
382  bb.0:
383    liveins: $sgpr0, $sgpr1
384    %0:sgpr(s32) = COPY $sgpr0
385    %1:sgpr(s32) = COPY $sgpr1
386    %2:sgpr(s1) = G_TRUNC %0
387    %3:sgpr(s32) = G_SELECT %2, %0, %1
388    S_ENDPGM 0, implicit %3
389...
390