1# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2# RUN: llc -march=amdgcn -mcpu=fiji -run-pass=regbankselect %s -verify-machineinstrs -o - -regbankselect-fast | FileCheck %s
3# RUN: llc -march=amdgcn -mcpu=fiji -run-pass=regbankselect %s -verify-machineinstrs -o - -regbankselect-greedy | FileCheck %s
4
5---
6name: zext_s32_to_s64_s
7legalized: true
8
9body: |
10  bb.0:
11    liveins: $sgpr0
12    ; CHECK-LABEL: name: zext_s32_to_s64_s
13    ; CHECK: [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
14    ; CHECK: [[ZEXT:%[0-9]+]]:sgpr(s64) = G_ZEXT [[COPY]](s32)
15    %0:_(s32) = COPY $sgpr0
16    %1:_(s64) = G_ZEXT %0
17...
18
19---
20name: zext_s16_to_s64_s
21legalized: true
22
23body: |
24  bb.0:
25    liveins: $sgpr0
26    ; CHECK-LABEL: name: zext_s16_to_s64_s
27    ; CHECK: [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
28    ; CHECK: [[TRUNC:%[0-9]+]]:sgpr(s16) = G_TRUNC [[COPY]](s32)
29    ; CHECK: [[ZEXT:%[0-9]+]]:sgpr(s64) = G_ZEXT [[TRUNC]](s16)
30    %0:_(s32) = COPY $sgpr0
31    %1:_(s16) = G_TRUNC %0
32    %2:_(s64) = G_ZEXT %1
33...
34
35---
36name: zext_s32_to_s64_v
37legalized: true
38
39body: |
40  bb.0:
41    liveins: $vgpr0_vgpr1
42    ; CHECK-LABEL: name: zext_s32_to_s64_v
43    ; CHECK: [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
44    ; CHECK: [[COPY1:%[0-9]+]]:vgpr(s32) = COPY [[COPY]](s32)
45    ; CHECK: [[C:%[0-9]+]]:vgpr(s32) = G_CONSTANT i32 0
46    ; CHECK: [[MV:%[0-9]+]]:vgpr(s64) = G_MERGE_VALUES [[COPY1]](s32), [[C]](s32)
47    %0:_(s32) = COPY $vgpr0
48    %1:_(s64) = G_ZEXT %0
49...
50
51---
52name: zext_s1_to_s16_scc
53legalized: true
54
55body: |
56  bb.0:
57    liveins: $sgpr0, $sgpr1
58    ; CHECK-LABEL: name: zext_s1_to_s16_scc
59    ; CHECK: [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
60    ; CHECK: [[COPY1:%[0-9]+]]:sgpr(s32) = COPY $sgpr1
61    ; CHECK: [[ICMP:%[0-9]+]]:sgpr(s32) = G_ICMP intpred(eq), [[COPY]](s32), [[COPY1]]
62    ; CHECK: [[TRUNC:%[0-9]+]]:sgpr(s1) = G_TRUNC [[ICMP]](s32)
63    ; CHECK: [[ZEXT:%[0-9]+]]:sgpr(s16) = G_ZEXT [[TRUNC]](s1)
64    %0:_(s32) = COPY $sgpr0
65    %1:_(s32) = COPY $sgpr1
66    %2:_(s1) = G_ICMP intpred(eq), %0, %1
67    %3:_(s16) = G_ZEXT %2
68...
69
70---
71name: zext_s1_to_s32_scc
72legalized: true
73
74body: |
75  bb.0:
76    liveins: $sgpr0, $sgpr1
77    ; CHECK-LABEL: name: zext_s1_to_s32_scc
78    ; CHECK: [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
79    ; CHECK: [[COPY1:%[0-9]+]]:sgpr(s32) = COPY $sgpr1
80    ; CHECK: [[ICMP:%[0-9]+]]:sgpr(s32) = G_ICMP intpred(eq), [[COPY]](s32), [[COPY1]]
81    ; CHECK: [[TRUNC:%[0-9]+]]:sgpr(s1) = G_TRUNC [[ICMP]](s32)
82    ; CHECK: [[ZEXT:%[0-9]+]]:sgpr(s32) = G_ZEXT [[TRUNC]](s1)
83    %0:_(s32) = COPY $sgpr0
84    %1:_(s32) = COPY $sgpr1
85    %2:_(s1) = G_ICMP intpred(eq), %0, %1
86    %3:_(s32) = G_ZEXT %2
87...
88
89---
90name: zext_s1_to_s64_scc
91legalized: true
92
93body: |
94  bb.0:
95    liveins: $sgpr0, $sgpr1
96    ; CHECK-LABEL: name: zext_s1_to_s64_scc
97    ; CHECK: [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
98    ; CHECK: [[COPY1:%[0-9]+]]:sgpr(s32) = COPY $sgpr1
99    ; CHECK: [[ICMP:%[0-9]+]]:sgpr(s32) = G_ICMP intpred(eq), [[COPY]](s32), [[COPY1]]
100    ; CHECK: [[TRUNC:%[0-9]+]]:sgpr(s1) = G_TRUNC [[ICMP]](s32)
101    ; CHECK: [[ZEXT:%[0-9]+]]:sgpr(s64) = G_ZEXT [[TRUNC]](s1)
102    %0:_(s32) = COPY $sgpr0
103    %1:_(s32) = COPY $sgpr1
104    %2:_(s1) = G_ICMP intpred(eq), %0, %1
105    %3:_(s64) = G_ZEXT %2
106...
107
108---
109name: zext_s1_to_s16_vcc
110legalized: true
111
112body: |
113  bb.0:
114    liveins: $vgpr0, $vgpr1
115    ; CHECK-LABEL: name: zext_s1_to_s16_vcc
116    ; CHECK: [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
117    ; CHECK: [[COPY1:%[0-9]+]]:vgpr(s32) = COPY $vgpr1
118    ; CHECK: [[ICMP:%[0-9]+]]:vcc(s1) = G_ICMP intpred(eq), [[COPY]](s32), [[COPY1]]
119    ; CHECK: [[C:%[0-9]+]]:vgpr(s32) = G_CONSTANT i32 1
120    ; CHECK: [[C1:%[0-9]+]]:vgpr(s32) = G_CONSTANT i32 0
121    ; CHECK: [[SELECT:%[0-9]+]]:vgpr(s32) = G_SELECT [[ICMP]](s1), [[C]], [[C1]]
122    ; CHECK: [[TRUNC:%[0-9]+]]:vgpr(s16) = G_TRUNC [[SELECT]](s32)
123    %0:_(s32) = COPY $vgpr0
124    %1:_(s32) = COPY $vgpr1
125    %2:_(s1) = G_ICMP intpred(eq), %0, %1
126    %3:_(s16) = G_ZEXT %2
127...
128
129---
130name: zext_s1_to_s32_vcc
131legalized: true
132
133body: |
134  bb.0:
135    liveins: $vgpr0, $vgpr1
136    ; CHECK-LABEL: name: zext_s1_to_s32_vcc
137    ; CHECK: [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
138    ; CHECK: [[COPY1:%[0-9]+]]:vgpr(s32) = COPY $vgpr1
139    ; CHECK: [[ICMP:%[0-9]+]]:vcc(s1) = G_ICMP intpred(eq), [[COPY]](s32), [[COPY1]]
140    ; CHECK: [[C:%[0-9]+]]:vgpr(s32) = G_CONSTANT i32 1
141    ; CHECK: [[C1:%[0-9]+]]:vgpr(s32) = G_CONSTANT i32 0
142    ; CHECK: [[SELECT:%[0-9]+]]:vgpr(s32) = G_SELECT [[ICMP]](s1), [[C]], [[C1]]
143    %0:_(s32) = COPY $vgpr0
144    %1:_(s32) = COPY $vgpr1
145    %2:_(s1) = G_ICMP intpred(eq), %0, %1
146    %3:_(s32) = G_ZEXT %2
147...
148
149---
150name: zext_s1_to_s64_vcc
151legalized: true
152
153body: |
154  bb.0:
155    liveins: $vgpr0, $vgpr1
156    ; CHECK-LABEL: name: zext_s1_to_s64_vcc
157    ; CHECK: [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
158    ; CHECK: [[COPY1:%[0-9]+]]:vgpr(s32) = COPY $vgpr1
159    ; CHECK: [[ICMP:%[0-9]+]]:vcc(s1) = G_ICMP intpred(eq), [[COPY]](s32), [[COPY1]]
160    ; CHECK: [[C:%[0-9]+]]:vgpr(s32) = G_CONSTANT i32 1
161    ; CHECK: [[C1:%[0-9]+]]:vgpr(s32) = G_CONSTANT i32 0
162    ; CHECK: [[SELECT:%[0-9]+]]:vgpr(s32) = G_SELECT [[ICMP]](s1), [[C]], [[C1]]
163    ; CHECK: [[C2:%[0-9]+]]:vgpr(s32) = G_CONSTANT i32 0
164    ; CHECK: [[MV:%[0-9]+]]:vgpr(s64) = G_MERGE_VALUES [[SELECT]](s32), [[C2]](s32)
165    %0:_(s32) = COPY $vgpr0
166    %1:_(s32) = COPY $vgpr1
167    %2:_(s1) = G_ICMP intpred(eq), %0, %1
168    %3:_(s64) = G_ZEXT %2
169...
170
171---
172name: zext_s1_to_s16_sgpr
173legalized: true
174
175body: |
176  bb.0:
177    liveins: $sgpr0
178    ; CHECK-LABEL: name: zext_s1_to_s16_sgpr
179    ; CHECK: [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
180    ; CHECK: [[TRUNC:%[0-9]+]]:sgpr(s1) = G_TRUNC [[COPY]](s32)
181    ; CHECK: [[ZEXT:%[0-9]+]]:sgpr(s16) = G_ZEXT [[TRUNC]](s1)
182    %0:_(s32) = COPY $sgpr0
183    %1:_(s1) = G_TRUNC %0
184    %2:_(s16) = G_ZEXT %1
185...
186
187---
188name: zext_s1_to_s32_sgpr
189legalized: true
190
191body: |
192  bb.0:
193    liveins: $sgpr0
194    ; CHECK-LABEL: name: zext_s1_to_s32_sgpr
195    ; CHECK: [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
196    ; CHECK: [[TRUNC:%[0-9]+]]:sgpr(s1) = G_TRUNC [[COPY]](s32)
197    ; CHECK: [[ZEXT:%[0-9]+]]:sgpr(s32) = G_ZEXT [[TRUNC]](s1)
198    %0:_(s32) = COPY $sgpr0
199    %1:_(s1) = G_TRUNC %0
200    %2:_(s32) = G_ZEXT %1
201...
202
203---
204name: zext_s1_to_s64_sgpr
205legalized: true
206
207body: |
208  bb.0:
209    liveins: $sgpr0
210    ; CHECK-LABEL: name: zext_s1_to_s64_sgpr
211    ; CHECK: [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
212    ; CHECK: [[TRUNC:%[0-9]+]]:sgpr(s1) = G_TRUNC [[COPY]](s32)
213    ; CHECK: [[ZEXT:%[0-9]+]]:sgpr(s64) = G_ZEXT [[TRUNC]](s1)
214    %0:_(s32) = COPY $sgpr0
215    %1:_(s1) = G_TRUNC %0
216    %2:_(s64) = G_ZEXT %1
217...
218
219---
220name: zext_s1_to_s16_vgpr
221legalized: true
222
223body: |
224  bb.0:
225    liveins: $vgpr0
226    ; CHECK-LABEL: name: zext_s1_to_s16_vgpr
227    ; CHECK: [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
228    ; CHECK: [[TRUNC:%[0-9]+]]:vgpr(s1) = G_TRUNC [[COPY]](s32)
229    ; CHECK: [[ZEXT:%[0-9]+]]:vgpr(s16) = G_ZEXT [[TRUNC]](s1)
230    %0:_(s32) = COPY $vgpr0
231    %1:_(s1) = G_TRUNC %0
232    %2:_(s16) = G_ZEXT %1
233...
234
235---
236name: zext_s1_to_s32_vgpr
237legalized: true
238
239body: |
240  bb.0:
241    liveins: $vgpr0
242    ; CHECK-LABEL: name: zext_s1_to_s32_vgpr
243    ; CHECK: [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
244    ; CHECK: [[TRUNC:%[0-9]+]]:vgpr(s1) = G_TRUNC [[COPY]](s32)
245    ; CHECK: [[ZEXT:%[0-9]+]]:vgpr(s32) = G_ZEXT [[TRUNC]](s1)
246    %0:_(s32) = COPY $vgpr0
247    %1:_(s1) = G_TRUNC %0
248    %2:_(s32) = G_ZEXT %1
249...
250
251---
252name: zext_s1_to_s64_vgpr
253legalized: true
254
255body: |
256  bb.0:
257    liveins: $vgpr0
258    ; CHECK-LABEL: name: zext_s1_to_s64_vgpr
259    ; CHECK: [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
260    ; CHECK: [[TRUNC:%[0-9]+]]:vgpr(s1) = G_TRUNC [[COPY]](s32)
261    ; CHECK: [[ZEXT:%[0-9]+]]:vgpr(s32) = G_ZEXT [[TRUNC]](s1)
262    ; CHECK: [[C:%[0-9]+]]:vgpr(s32) = G_CONSTANT i32 0
263    ; CHECK: [[MV:%[0-9]+]]:vgpr(s64) = G_MERGE_VALUES [[ZEXT]](s32), [[C]](s32)
264    %0:_(s32) = COPY $vgpr0
265    %1:_(s1) = G_TRUNC %0
266    %2:_(s64) = G_ZEXT %1
267...
268
269---
270name: zext_s16_to_s64_vgpr
271legalized: true
272
273body: |
274  bb.0:
275    liveins: $vgpr0
276    ; CHECK-LABEL: name: zext_s16_to_s64_vgpr
277    ; CHECK: [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
278    ; CHECK: [[TRUNC:%[0-9]+]]:vgpr(s16) = G_TRUNC [[COPY]](s32)
279    ; CHECK: [[ZEXT:%[0-9]+]]:vgpr(s32) = G_ZEXT [[TRUNC]](s16)
280    ; CHECK: [[C:%[0-9]+]]:vgpr(s32) = G_CONSTANT i32 0
281    ; CHECK: [[MV:%[0-9]+]]:vgpr(s64) = G_MERGE_VALUES [[ZEXT]](s32), [[C]](s32)
282    %0:_(s32) = COPY $vgpr0
283    %1:_(s16) = G_TRUNC %0
284    %2:_(s64) = G_ZEXT %1
285...
286