1# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2# RUN: llc -mtriple=amdgcn-mesa-mesa3d -mcpu=tahiti -run-pass=legalizer %s -o - | FileCheck -check-prefix=GFX6 %s
3# RUN: llc -mtriple=amdgcn-mesa-mesa3d -mcpu=fiji -run-pass=legalizer %s -o - | FileCheck -check-prefix=GFX8 %s
4
5---
6name: test_uitofp_s32_to_s32
7body: |
8  bb.0:
9    liveins: $vgpr0
10
11    ; GFX6-LABEL: name: test_uitofp_s32_to_s32
12    ; GFX6: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
13    ; GFX6: [[UITOFP:%[0-9]+]]:_(s32) = G_UITOFP [[COPY]](s32)
14    ; GFX6: $vgpr0 = COPY [[UITOFP]](s32)
15    ; GFX8-LABEL: name: test_uitofp_s32_to_s32
16    ; GFX8: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
17    ; GFX8: [[UITOFP:%[0-9]+]]:_(s32) = G_UITOFP [[COPY]](s32)
18    ; GFX8: $vgpr0 = COPY [[UITOFP]](s32)
19    %0:_(s32) = COPY $vgpr0
20    %1:_(s32) = G_UITOFP %0
21    $vgpr0 = COPY %1
22...
23
24---
25name: test_uitofp_s32_to_s64
26body: |
27  bb.0:
28    liveins: $vgpr0
29
30    ; GFX6-LABEL: name: test_uitofp_s32_to_s64
31    ; GFX6: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
32    ; GFX6: [[UITOFP:%[0-9]+]]:_(s64) = G_UITOFP [[COPY]](s32)
33    ; GFX6: $vgpr0_vgpr1 = COPY [[UITOFP]](s64)
34    ; GFX8-LABEL: name: test_uitofp_s32_to_s64
35    ; GFX8: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
36    ; GFX8: [[UITOFP:%[0-9]+]]:_(s64) = G_UITOFP [[COPY]](s32)
37    ; GFX8: $vgpr0_vgpr1 = COPY [[UITOFP]](s64)
38    %0:_(s32) = COPY $vgpr0
39    %1:_(s64) = G_UITOFP %0
40    $vgpr0_vgpr1 = COPY %1
41...
42
43---
44name: test_uitofp_v2s32_to_v2s32
45body: |
46  bb.0:
47    liveins: $vgpr0_vgpr1
48
49    ; GFX6-LABEL: name: test_uitofp_v2s32_to_v2s32
50    ; GFX6: [[COPY:%[0-9]+]]:_(<2 x s32>) = COPY $vgpr0_vgpr1
51    ; GFX6: [[UV:%[0-9]+]]:_(s32), [[UV1:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[COPY]](<2 x s32>)
52    ; GFX6: [[UITOFP:%[0-9]+]]:_(s32) = G_UITOFP [[UV]](s32)
53    ; GFX6: [[UITOFP1:%[0-9]+]]:_(s32) = G_UITOFP [[UV1]](s32)
54    ; GFX6: [[BUILD_VECTOR:%[0-9]+]]:_(<2 x s32>) = G_BUILD_VECTOR [[UITOFP]](s32), [[UITOFP1]](s32)
55    ; GFX6: $vgpr0_vgpr1 = COPY [[BUILD_VECTOR]](<2 x s32>)
56    ; GFX8-LABEL: name: test_uitofp_v2s32_to_v2s32
57    ; GFX8: [[COPY:%[0-9]+]]:_(<2 x s32>) = COPY $vgpr0_vgpr1
58    ; GFX8: [[UV:%[0-9]+]]:_(s32), [[UV1:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[COPY]](<2 x s32>)
59    ; GFX8: [[UITOFP:%[0-9]+]]:_(s32) = G_UITOFP [[UV]](s32)
60    ; GFX8: [[UITOFP1:%[0-9]+]]:_(s32) = G_UITOFP [[UV1]](s32)
61    ; GFX8: [[BUILD_VECTOR:%[0-9]+]]:_(<2 x s32>) = G_BUILD_VECTOR [[UITOFP]](s32), [[UITOFP1]](s32)
62    ; GFX8: $vgpr0_vgpr1 = COPY [[BUILD_VECTOR]](<2 x s32>)
63    %0:_(<2 x s32>) = COPY $vgpr0_vgpr1
64    %1:_(<2 x s32>) = G_UITOFP %0
65    $vgpr0_vgpr1 = COPY %1
66...
67
68---
69name: test_uitofp_s64_to_s32
70body: |
71  bb.0:
72    liveins: $vgpr0_vgpr1
73
74    ; GFX6-LABEL: name: test_uitofp_s64_to_s32
75    ; GFX6: [[COPY:%[0-9]+]]:_(s64) = COPY $vgpr0_vgpr1
76    ; GFX6: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
77    ; GFX6: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 0
78    ; GFX6: [[CTLZ_ZERO_UNDEF:%[0-9]+]]:_(s32) = G_CTLZ_ZERO_UNDEF [[COPY]](s64)
79    ; GFX6: [[C2:%[0-9]+]]:_(s32) = G_CONSTANT i32 190
80    ; GFX6: [[SUB:%[0-9]+]]:_(s32) = G_SUB [[C2]], [[CTLZ_ZERO_UNDEF]]
81    ; GFX6: [[ICMP:%[0-9]+]]:_(s1) = G_ICMP intpred(ne), [[COPY]](s64), [[C1]]
82    ; GFX6: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[ICMP]](s1), [[SUB]], [[C]]
83    ; GFX6: [[C3:%[0-9]+]]:_(s64) = G_CONSTANT i64 9223372036854775807
84    ; GFX6: [[SHL:%[0-9]+]]:_(s64) = G_SHL [[COPY]], [[CTLZ_ZERO_UNDEF]](s32)
85    ; GFX6: [[AND:%[0-9]+]]:_(s64) = G_AND [[SHL]], [[C3]]
86    ; GFX6: [[C4:%[0-9]+]]:_(s64) = G_CONSTANT i64 1099511627775
87    ; GFX6: [[AND1:%[0-9]+]]:_(s64) = G_AND [[AND]], [[C4]]
88    ; GFX6: [[C5:%[0-9]+]]:_(s32) = G_CONSTANT i32 40
89    ; GFX6: [[LSHR:%[0-9]+]]:_(s64) = G_LSHR [[AND]], [[C5]](s32)
90    ; GFX6: [[C6:%[0-9]+]]:_(s32) = G_CONSTANT i32 23
91    ; GFX6: [[SHL1:%[0-9]+]]:_(s32) = G_SHL [[SELECT]], [[C6]](s32)
92    ; GFX6: [[TRUNC:%[0-9]+]]:_(s32) = G_TRUNC [[LSHR]](s64)
93    ; GFX6: [[OR:%[0-9]+]]:_(s32) = G_OR [[SHL1]], [[TRUNC]]
94    ; GFX6: [[C7:%[0-9]+]]:_(s64) = G_CONSTANT i64 549755813888
95    ; GFX6: [[ICMP1:%[0-9]+]]:_(s1) = G_ICMP intpred(ugt), [[AND1]](s64), [[C7]]
96    ; GFX6: [[ICMP2:%[0-9]+]]:_(s1) = G_ICMP intpred(eq), [[AND1]](s64), [[C7]]
97    ; GFX6: [[C8:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
98    ; GFX6: [[AND2:%[0-9]+]]:_(s32) = G_AND [[OR]], [[C8]]
99    ; GFX6: [[SELECT1:%[0-9]+]]:_(s32) = G_SELECT [[ICMP2]](s1), [[AND2]], [[C]]
100    ; GFX6: [[SELECT2:%[0-9]+]]:_(s32) = G_SELECT [[ICMP1]](s1), [[C8]], [[SELECT1]]
101    ; GFX6: [[ADD:%[0-9]+]]:_(s32) = G_ADD [[OR]], [[SELECT2]]
102    ; GFX6: [[UITOFP:%[0-9]+]]:_(s32) = G_UITOFP [[COPY]](s64)
103    ; GFX6: $vgpr0 = COPY [[UITOFP]](s32)
104    ; GFX8-LABEL: name: test_uitofp_s64_to_s32
105    ; GFX8: [[COPY:%[0-9]+]]:_(s64) = COPY $vgpr0_vgpr1
106    ; GFX8: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
107    ; GFX8: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 0
108    ; GFX8: [[CTLZ_ZERO_UNDEF:%[0-9]+]]:_(s32) = G_CTLZ_ZERO_UNDEF [[COPY]](s64)
109    ; GFX8: [[C2:%[0-9]+]]:_(s32) = G_CONSTANT i32 190
110    ; GFX8: [[SUB:%[0-9]+]]:_(s32) = G_SUB [[C2]], [[CTLZ_ZERO_UNDEF]]
111    ; GFX8: [[ICMP:%[0-9]+]]:_(s1) = G_ICMP intpred(ne), [[COPY]](s64), [[C1]]
112    ; GFX8: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[ICMP]](s1), [[SUB]], [[C]]
113    ; GFX8: [[C3:%[0-9]+]]:_(s64) = G_CONSTANT i64 9223372036854775807
114    ; GFX8: [[SHL:%[0-9]+]]:_(s64) = G_SHL [[COPY]], [[CTLZ_ZERO_UNDEF]](s32)
115    ; GFX8: [[AND:%[0-9]+]]:_(s64) = G_AND [[SHL]], [[C3]]
116    ; GFX8: [[C4:%[0-9]+]]:_(s64) = G_CONSTANT i64 1099511627775
117    ; GFX8: [[AND1:%[0-9]+]]:_(s64) = G_AND [[AND]], [[C4]]
118    ; GFX8: [[C5:%[0-9]+]]:_(s32) = G_CONSTANT i32 40
119    ; GFX8: [[LSHR:%[0-9]+]]:_(s64) = G_LSHR [[AND]], [[C5]](s32)
120    ; GFX8: [[C6:%[0-9]+]]:_(s32) = G_CONSTANT i32 23
121    ; GFX8: [[SHL1:%[0-9]+]]:_(s32) = G_SHL [[SELECT]], [[C6]](s32)
122    ; GFX8: [[TRUNC:%[0-9]+]]:_(s32) = G_TRUNC [[LSHR]](s64)
123    ; GFX8: [[OR:%[0-9]+]]:_(s32) = G_OR [[SHL1]], [[TRUNC]]
124    ; GFX8: [[C7:%[0-9]+]]:_(s64) = G_CONSTANT i64 549755813888
125    ; GFX8: [[ICMP1:%[0-9]+]]:_(s1) = G_ICMP intpred(ugt), [[AND1]](s64), [[C7]]
126    ; GFX8: [[ICMP2:%[0-9]+]]:_(s1) = G_ICMP intpred(eq), [[AND1]](s64), [[C7]]
127    ; GFX8: [[C8:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
128    ; GFX8: [[AND2:%[0-9]+]]:_(s32) = G_AND [[OR]], [[C8]]
129    ; GFX8: [[SELECT1:%[0-9]+]]:_(s32) = G_SELECT [[ICMP2]](s1), [[AND2]], [[C]]
130    ; GFX8: [[SELECT2:%[0-9]+]]:_(s32) = G_SELECT [[ICMP1]](s1), [[C8]], [[SELECT1]]
131    ; GFX8: [[ADD:%[0-9]+]]:_(s32) = G_ADD [[OR]], [[SELECT2]]
132    ; GFX8: [[UITOFP:%[0-9]+]]:_(s32) = G_UITOFP [[COPY]](s64)
133    ; GFX8: $vgpr0 = COPY [[UITOFP]](s32)
134    %0:_(s64) = COPY $vgpr0_vgpr1
135    %1:_(s32) = G_UITOFP %0
136    $vgpr0 = COPY %1
137...
138
139---
140name: test_uitofp_s64_to_s64
141body: |
142  bb.0:
143    liveins: $vgpr0_vgpr1
144
145    ; GFX6-LABEL: name: test_uitofp_s64_to_s64
146    ; GFX6: [[COPY:%[0-9]+]]:_(s64) = COPY $vgpr0_vgpr1
147    ; GFX6: [[UV:%[0-9]+]]:_(s32), [[UV1:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[COPY]](s64)
148    ; GFX6: [[UITOFP:%[0-9]+]]:_(s64) = G_UITOFP [[UV1]](s32)
149    ; GFX6: [[UITOFP1:%[0-9]+]]:_(s64) = G_UITOFP [[UV]](s32)
150    ; GFX6: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 32
151    ; GFX6: [[INT:%[0-9]+]]:_(s64) = G_INTRINSIC intrinsic(@llvm.amdgcn.ldexp), [[UITOFP]](s64), [[C]](s32)
152    ; GFX6: [[FADD:%[0-9]+]]:_(s64) = G_FADD [[INT]], [[UITOFP1]]
153    ; GFX6: $vgpr0_vgpr1 = COPY [[FADD]](s64)
154    ; GFX8-LABEL: name: test_uitofp_s64_to_s64
155    ; GFX8: [[COPY:%[0-9]+]]:_(s64) = COPY $vgpr0_vgpr1
156    ; GFX8: [[UV:%[0-9]+]]:_(s32), [[UV1:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[COPY]](s64)
157    ; GFX8: [[UITOFP:%[0-9]+]]:_(s64) = G_UITOFP [[UV1]](s32)
158    ; GFX8: [[UITOFP1:%[0-9]+]]:_(s64) = G_UITOFP [[UV]](s32)
159    ; GFX8: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 32
160    ; GFX8: [[INT:%[0-9]+]]:_(s64) = G_INTRINSIC intrinsic(@llvm.amdgcn.ldexp), [[UITOFP]](s64), [[C]](s32)
161    ; GFX8: [[FADD:%[0-9]+]]:_(s64) = G_FADD [[INT]], [[UITOFP1]]
162    ; GFX8: $vgpr0_vgpr1 = COPY [[FADD]](s64)
163    %0:_(s64) = COPY $vgpr0_vgpr1
164    %1:_(s64) = G_UITOFP %0
165    $vgpr0_vgpr1 = COPY %1
166...
167
168---
169name: test_uitofp_s16_to_s16
170body: |
171  bb.0:
172    liveins: $vgpr0
173
174    ; GFX6-LABEL: name: test_uitofp_s16_to_s16
175    ; GFX6: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
176    ; GFX6: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535
177    ; GFX6: [[COPY1:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
178    ; GFX6: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY1]], [[C]]
179    ; GFX6: [[UITOFP:%[0-9]+]]:_(s16) = G_UITOFP [[AND]](s32)
180    ; GFX6: [[ANYEXT:%[0-9]+]]:_(s32) = G_ANYEXT [[UITOFP]](s16)
181    ; GFX6: $vgpr0 = COPY [[ANYEXT]](s32)
182    ; GFX8-LABEL: name: test_uitofp_s16_to_s16
183    ; GFX8: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
184    ; GFX8: [[TRUNC:%[0-9]+]]:_(s16) = G_TRUNC [[COPY]](s32)
185    ; GFX8: [[UITOFP:%[0-9]+]]:_(s16) = G_UITOFP [[TRUNC]](s16)
186    ; GFX8: [[ANYEXT:%[0-9]+]]:_(s32) = G_ANYEXT [[UITOFP]](s16)
187    ; GFX8: $vgpr0 = COPY [[ANYEXT]](s32)
188    %0:_(s32) = COPY $vgpr0
189    %1:_(s16) = G_TRUNC %0
190    %2:_(s16) = G_UITOFP %1
191    %3:_(s32) = G_ANYEXT %2
192    $vgpr0 = COPY %3
193...
194
195---
196name: test_uitofp_s16_to_s32
197body: |
198  bb.0:
199    liveins: $vgpr0
200
201    ; GFX6-LABEL: name: test_uitofp_s16_to_s32
202    ; GFX6: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
203    ; GFX6: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535
204    ; GFX6: [[COPY1:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
205    ; GFX6: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY1]], [[C]]
206    ; GFX6: [[UITOFP:%[0-9]+]]:_(s32) = G_UITOFP [[AND]](s32)
207    ; GFX6: $vgpr0 = COPY [[UITOFP]](s32)
208    ; GFX8-LABEL: name: test_uitofp_s16_to_s32
209    ; GFX8: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
210    ; GFX8: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535
211    ; GFX8: [[COPY1:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
212    ; GFX8: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY1]], [[C]]
213    ; GFX8: [[UITOFP:%[0-9]+]]:_(s32) = G_UITOFP [[AND]](s32)
214    ; GFX8: $vgpr0 = COPY [[UITOFP]](s32)
215    %0:_(s32) = COPY $vgpr0
216    %1:_(s16) = G_TRUNC %0
217    %2:_(s32) = G_UITOFP %1
218    $vgpr0 = COPY %2
219...
220
221---
222name: test_uitofp_s16_to_s64
223body: |
224  bb.0:
225    liveins: $vgpr0
226
227    ; GFX6-LABEL: name: test_uitofp_s16_to_s64
228    ; GFX6: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
229    ; GFX6: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535
230    ; GFX6: [[COPY1:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
231    ; GFX6: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY1]], [[C]]
232    ; GFX6: [[UITOFP:%[0-9]+]]:_(s64) = G_UITOFP [[AND]](s32)
233    ; GFX6: $vgpr0_vgpr1 = COPY [[UITOFP]](s64)
234    ; GFX8-LABEL: name: test_uitofp_s16_to_s64
235    ; GFX8: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
236    ; GFX8: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535
237    ; GFX8: [[COPY1:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
238    ; GFX8: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY1]], [[C]]
239    ; GFX8: [[UITOFP:%[0-9]+]]:_(s64) = G_UITOFP [[AND]](s32)
240    ; GFX8: $vgpr0_vgpr1 = COPY [[UITOFP]](s64)
241    %0:_(s32) = COPY $vgpr0
242    %1:_(s16) = G_TRUNC %0
243    %2:_(s64) = G_UITOFP %1
244    $vgpr0_vgpr1 = COPY %2
245...
246
247---
248name: test_uitofp_s8_to_s16
249body: |
250  bb.0:
251    liveins: $vgpr0
252
253    ; GFX6-LABEL: name: test_uitofp_s8_to_s16
254    ; GFX6: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
255    ; GFX6: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 255
256    ; GFX6: [[COPY1:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
257    ; GFX6: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY1]], [[C]]
258    ; GFX6: [[UITOFP:%[0-9]+]]:_(s16) = G_UITOFP [[AND]](s32)
259    ; GFX6: [[ANYEXT:%[0-9]+]]:_(s32) = G_ANYEXT [[UITOFP]](s16)
260    ; GFX6: $vgpr0 = COPY [[ANYEXT]](s32)
261    ; GFX8-LABEL: name: test_uitofp_s8_to_s16
262    ; GFX8: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
263    ; GFX8: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 255
264    ; GFX8: [[COPY1:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
265    ; GFX8: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY1]], [[C]]
266    ; GFX8: [[UITOFP:%[0-9]+]]:_(s16) = G_UITOFP [[AND]](s32)
267    ; GFX8: [[ANYEXT:%[0-9]+]]:_(s32) = G_ANYEXT [[UITOFP]](s16)
268    ; GFX8: $vgpr0 = COPY [[ANYEXT]](s32)
269    %0:_(s32) = COPY $vgpr0
270    %1:_(s8) = G_TRUNC %0
271    %2:_(s16) = G_UITOFP %1
272    %3:_(s32) = G_ANYEXT %2
273    $vgpr0 = COPY %3
274...
275
276---
277name: test_uitofp_s8_to_s32
278body: |
279  bb.0:
280    liveins: $vgpr0
281
282    ; GFX6-LABEL: name: test_uitofp_s8_to_s32
283    ; GFX6: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
284    ; GFX6: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 255
285    ; GFX6: [[COPY1:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
286    ; GFX6: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY1]], [[C]]
287    ; GFX6: [[UITOFP:%[0-9]+]]:_(s32) = G_UITOFP [[AND]](s32)
288    ; GFX6: $vgpr0 = COPY [[UITOFP]](s32)
289    ; GFX8-LABEL: name: test_uitofp_s8_to_s32
290    ; GFX8: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
291    ; GFX8: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 255
292    ; GFX8: [[COPY1:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
293    ; GFX8: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY1]], [[C]]
294    ; GFX8: [[UITOFP:%[0-9]+]]:_(s32) = G_UITOFP [[AND]](s32)
295    ; GFX8: $vgpr0 = COPY [[UITOFP]](s32)
296    %0:_(s32) = COPY $vgpr0
297    %1:_(s8) = G_TRUNC %0
298    %2:_(s32) = G_UITOFP %1
299    $vgpr0 = COPY %2
300...
301
302---
303name: test_uitofp_s8_to_s64
304body: |
305  bb.0:
306    liveins: $vgpr0
307
308    ; GFX6-LABEL: name: test_uitofp_s8_to_s64
309    ; GFX6: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
310    ; GFX6: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 255
311    ; GFX6: [[COPY1:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
312    ; GFX6: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY1]], [[C]]
313    ; GFX6: [[UITOFP:%[0-9]+]]:_(s64) = G_UITOFP [[AND]](s32)
314    ; GFX6: $vgpr0_vgpr1 = COPY [[UITOFP]](s64)
315    ; GFX8-LABEL: name: test_uitofp_s8_to_s64
316    ; GFX8: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
317    ; GFX8: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 255
318    ; GFX8: [[COPY1:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
319    ; GFX8: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY1]], [[C]]
320    ; GFX8: [[UITOFP:%[0-9]+]]:_(s64) = G_UITOFP [[AND]](s32)
321    ; GFX8: $vgpr0_vgpr1 = COPY [[UITOFP]](s64)
322    %0:_(s32) = COPY $vgpr0
323    %1:_(s8) = G_TRUNC %0
324    %2:_(s64) = G_UITOFP %1
325    $vgpr0_vgpr1 = COPY %2
326...
327
328---
329name: test_uitofp_s1_to_s16
330body: |
331  bb.0:
332    liveins: $vgpr0
333
334    ; GFX6-LABEL: name: test_uitofp_s1_to_s16
335    ; GFX6: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
336    ; GFX6: [[TRUNC:%[0-9]+]]:_(s1) = G_TRUNC [[COPY]](s32)
337    ; GFX6: [[C:%[0-9]+]]:_(s16) = G_FCONSTANT half 0xH3C00
338    ; GFX6: [[C1:%[0-9]+]]:_(s16) = G_FCONSTANT half 0xH0000
339    ; GFX6: [[SELECT:%[0-9]+]]:_(s16) = G_SELECT [[TRUNC]](s1), [[C]], [[C1]]
340    ; GFX6: [[ANYEXT:%[0-9]+]]:_(s32) = G_ANYEXT [[SELECT]](s16)
341    ; GFX6: $vgpr0 = COPY [[ANYEXT]](s32)
342    ; GFX8-LABEL: name: test_uitofp_s1_to_s16
343    ; GFX8: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
344    ; GFX8: [[TRUNC:%[0-9]+]]:_(s1) = G_TRUNC [[COPY]](s32)
345    ; GFX8: [[C:%[0-9]+]]:_(s16) = G_FCONSTANT half 0xH3C00
346    ; GFX8: [[C1:%[0-9]+]]:_(s16) = G_FCONSTANT half 0xH0000
347    ; GFX8: [[SELECT:%[0-9]+]]:_(s16) = G_SELECT [[TRUNC]](s1), [[C]], [[C1]]
348    ; GFX8: [[ANYEXT:%[0-9]+]]:_(s32) = G_ANYEXT [[SELECT]](s16)
349    ; GFX8: $vgpr0 = COPY [[ANYEXT]](s32)
350    %0:_(s32) = COPY $vgpr0
351    %1:_(s1) = G_TRUNC %0
352    %2:_(s16) = G_UITOFP %1
353    %3:_(s32) = G_ANYEXT %2
354    $vgpr0 = COPY %3
355...
356
357---
358name: test_uitofp_s1_to_s32
359body: |
360  bb.0:
361    liveins: $vgpr0
362
363    ; GFX6-LABEL: name: test_uitofp_s1_to_s32
364    ; GFX6: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
365    ; GFX6: [[TRUNC:%[0-9]+]]:_(s1) = G_TRUNC [[COPY]](s32)
366    ; GFX6: [[C:%[0-9]+]]:_(s32) = G_FCONSTANT float 1.000000e+00
367    ; GFX6: [[C1:%[0-9]+]]:_(s32) = G_FCONSTANT float 0.000000e+00
368    ; GFX6: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[TRUNC]](s1), [[C]], [[C1]]
369    ; GFX6: $vgpr0 = COPY [[SELECT]](s32)
370    ; GFX8-LABEL: name: test_uitofp_s1_to_s32
371    ; GFX8: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
372    ; GFX8: [[TRUNC:%[0-9]+]]:_(s1) = G_TRUNC [[COPY]](s32)
373    ; GFX8: [[C:%[0-9]+]]:_(s32) = G_FCONSTANT float 1.000000e+00
374    ; GFX8: [[C1:%[0-9]+]]:_(s32) = G_FCONSTANT float 0.000000e+00
375    ; GFX8: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[TRUNC]](s1), [[C]], [[C1]]
376    ; GFX8: $vgpr0 = COPY [[SELECT]](s32)
377    %0:_(s32) = COPY $vgpr0
378    %1:_(s1) = G_TRUNC %0
379    %2:_(s32) = G_UITOFP %1
380    $vgpr0 = COPY %2
381...
382
383---
384name: test_uitofp_s1_to_s64
385body: |
386  bb.0:
387    liveins: $vgpr0
388
389    ; GFX6-LABEL: name: test_uitofp_s1_to_s64
390    ; GFX6: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
391    ; GFX6: [[TRUNC:%[0-9]+]]:_(s1) = G_TRUNC [[COPY]](s32)
392    ; GFX6: [[C:%[0-9]+]]:_(s64) = G_FCONSTANT double 1.000000e+00
393    ; GFX6: [[C1:%[0-9]+]]:_(s64) = G_FCONSTANT double 0.000000e+00
394    ; GFX6: [[SELECT:%[0-9]+]]:_(s64) = G_SELECT [[TRUNC]](s1), [[C]], [[C1]]
395    ; GFX6: $vgpr0_vgpr1 = COPY [[SELECT]](s64)
396    ; GFX8-LABEL: name: test_uitofp_s1_to_s64
397    ; GFX8: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
398    ; GFX8: [[TRUNC:%[0-9]+]]:_(s1) = G_TRUNC [[COPY]](s32)
399    ; GFX8: [[C:%[0-9]+]]:_(s64) = G_FCONSTANT double 1.000000e+00
400    ; GFX8: [[C1:%[0-9]+]]:_(s64) = G_FCONSTANT double 0.000000e+00
401    ; GFX8: [[SELECT:%[0-9]+]]:_(s64) = G_SELECT [[TRUNC]](s1), [[C]], [[C1]]
402    ; GFX8: $vgpr0_vgpr1 = COPY [[SELECT]](s64)
403    %0:_(s32) = COPY $vgpr0
404    %1:_(s1) = G_TRUNC %0
405    %2:_(s64) = G_UITOFP %1
406    $vgpr0_vgpr1 = COPY %2
407...
408