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: $vgpr0 = COPY [[ADD]](s32)
103    ; GFX8-LABEL: name: test_uitofp_s64_to_s32
104    ; GFX8: [[COPY:%[0-9]+]]:_(s64) = COPY $vgpr0_vgpr1
105    ; GFX8: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
106    ; GFX8: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 0
107    ; GFX8: [[CTLZ_ZERO_UNDEF:%[0-9]+]]:_(s32) = G_CTLZ_ZERO_UNDEF [[COPY]](s64)
108    ; GFX8: [[C2:%[0-9]+]]:_(s32) = G_CONSTANT i32 190
109    ; GFX8: [[SUB:%[0-9]+]]:_(s32) = G_SUB [[C2]], [[CTLZ_ZERO_UNDEF]]
110    ; GFX8: [[ICMP:%[0-9]+]]:_(s1) = G_ICMP intpred(ne), [[COPY]](s64), [[C1]]
111    ; GFX8: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[ICMP]](s1), [[SUB]], [[C]]
112    ; GFX8: [[C3:%[0-9]+]]:_(s64) = G_CONSTANT i64 9223372036854775807
113    ; GFX8: [[SHL:%[0-9]+]]:_(s64) = G_SHL [[COPY]], [[CTLZ_ZERO_UNDEF]](s32)
114    ; GFX8: [[AND:%[0-9]+]]:_(s64) = G_AND [[SHL]], [[C3]]
115    ; GFX8: [[C4:%[0-9]+]]:_(s64) = G_CONSTANT i64 1099511627775
116    ; GFX8: [[AND1:%[0-9]+]]:_(s64) = G_AND [[AND]], [[C4]]
117    ; GFX8: [[C5:%[0-9]+]]:_(s32) = G_CONSTANT i32 40
118    ; GFX8: [[LSHR:%[0-9]+]]:_(s64) = G_LSHR [[AND]], [[C5]](s32)
119    ; GFX8: [[C6:%[0-9]+]]:_(s32) = G_CONSTANT i32 23
120    ; GFX8: [[SHL1:%[0-9]+]]:_(s32) = G_SHL [[SELECT]], [[C6]](s32)
121    ; GFX8: [[TRUNC:%[0-9]+]]:_(s32) = G_TRUNC [[LSHR]](s64)
122    ; GFX8: [[OR:%[0-9]+]]:_(s32) = G_OR [[SHL1]], [[TRUNC]]
123    ; GFX8: [[C7:%[0-9]+]]:_(s64) = G_CONSTANT i64 549755813888
124    ; GFX8: [[ICMP1:%[0-9]+]]:_(s1) = G_ICMP intpred(ugt), [[AND1]](s64), [[C7]]
125    ; GFX8: [[ICMP2:%[0-9]+]]:_(s1) = G_ICMP intpred(eq), [[AND1]](s64), [[C7]]
126    ; GFX8: [[C8:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
127    ; GFX8: [[AND2:%[0-9]+]]:_(s32) = G_AND [[OR]], [[C8]]
128    ; GFX8: [[SELECT1:%[0-9]+]]:_(s32) = G_SELECT [[ICMP2]](s1), [[AND2]], [[C]]
129    ; GFX8: [[SELECT2:%[0-9]+]]:_(s32) = G_SELECT [[ICMP1]](s1), [[C8]], [[SELECT1]]
130    ; GFX8: [[ADD:%[0-9]+]]:_(s32) = G_ADD [[OR]], [[SELECT2]]
131    ; GFX8: $vgpr0 = COPY [[ADD]](s32)
132    %0:_(s64) = COPY $vgpr0_vgpr1
133    %1:_(s32) = G_UITOFP %0
134    $vgpr0 = COPY %1
135...
136
137---
138name: test_uitofp_s64_to_s64
139body: |
140  bb.0:
141    liveins: $vgpr0_vgpr1
142
143    ; GFX6-LABEL: name: test_uitofp_s64_to_s64
144    ; GFX6: [[COPY:%[0-9]+]]:_(s64) = COPY $vgpr0_vgpr1
145    ; GFX6: [[UV:%[0-9]+]]:_(s32), [[UV1:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[COPY]](s64)
146    ; GFX6: [[UITOFP:%[0-9]+]]:_(s64) = G_UITOFP [[UV1]](s32)
147    ; GFX6: [[UITOFP1:%[0-9]+]]:_(s64) = G_UITOFP [[UV]](s32)
148    ; GFX6: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 32
149    ; GFX6: [[INT:%[0-9]+]]:_(s64) = G_INTRINSIC intrinsic(@llvm.amdgcn.ldexp), [[UITOFP]](s64), [[C]](s32)
150    ; GFX6: [[FADD:%[0-9]+]]:_(s64) = G_FADD [[INT]], [[UITOFP1]]
151    ; GFX6: $vgpr0_vgpr1 = COPY [[FADD]](s64)
152    ; GFX8-LABEL: name: test_uitofp_s64_to_s64
153    ; GFX8: [[COPY:%[0-9]+]]:_(s64) = COPY $vgpr0_vgpr1
154    ; GFX8: [[UV:%[0-9]+]]:_(s32), [[UV1:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[COPY]](s64)
155    ; GFX8: [[UITOFP:%[0-9]+]]:_(s64) = G_UITOFP [[UV1]](s32)
156    ; GFX8: [[UITOFP1:%[0-9]+]]:_(s64) = G_UITOFP [[UV]](s32)
157    ; GFX8: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 32
158    ; GFX8: [[INT:%[0-9]+]]:_(s64) = G_INTRINSIC intrinsic(@llvm.amdgcn.ldexp), [[UITOFP]](s64), [[C]](s32)
159    ; GFX8: [[FADD:%[0-9]+]]:_(s64) = G_FADD [[INT]], [[UITOFP1]]
160    ; GFX8: $vgpr0_vgpr1 = COPY [[FADD]](s64)
161    %0:_(s64) = COPY $vgpr0_vgpr1
162    %1:_(s64) = G_UITOFP %0
163    $vgpr0_vgpr1 = COPY %1
164...
165
166---
167name: test_uitofp_s16_to_s16
168body: |
169  bb.0:
170    liveins: $vgpr0
171
172    ; GFX6-LABEL: name: test_uitofp_s16_to_s16
173    ; GFX6: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
174    ; GFX6: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535
175    ; GFX6: [[COPY1:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
176    ; GFX6: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY1]], [[C]]
177    ; GFX6: [[UITOFP:%[0-9]+]]:_(s16) = G_UITOFP [[AND]](s32)
178    ; GFX6: [[ANYEXT:%[0-9]+]]:_(s32) = G_ANYEXT [[UITOFP]](s16)
179    ; GFX6: $vgpr0 = COPY [[ANYEXT]](s32)
180    ; GFX8-LABEL: name: test_uitofp_s16_to_s16
181    ; GFX8: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
182    ; GFX8: [[TRUNC:%[0-9]+]]:_(s16) = G_TRUNC [[COPY]](s32)
183    ; GFX8: [[UITOFP:%[0-9]+]]:_(s16) = G_UITOFP [[TRUNC]](s16)
184    ; GFX8: [[ANYEXT:%[0-9]+]]:_(s32) = G_ANYEXT [[UITOFP]](s16)
185    ; GFX8: $vgpr0 = COPY [[ANYEXT]](s32)
186    %0:_(s32) = COPY $vgpr0
187    %1:_(s16) = G_TRUNC %0
188    %2:_(s16) = G_UITOFP %1
189    %3:_(s32) = G_ANYEXT %2
190    $vgpr0 = COPY %3
191...
192
193---
194name: test_uitofp_s16_to_s32
195body: |
196  bb.0:
197    liveins: $vgpr0
198
199    ; GFX6-LABEL: name: test_uitofp_s16_to_s32
200    ; GFX6: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
201    ; GFX6: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535
202    ; GFX6: [[COPY1:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
203    ; GFX6: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY1]], [[C]]
204    ; GFX6: [[UITOFP:%[0-9]+]]:_(s32) = G_UITOFP [[AND]](s32)
205    ; GFX6: $vgpr0 = COPY [[UITOFP]](s32)
206    ; GFX8-LABEL: name: test_uitofp_s16_to_s32
207    ; GFX8: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
208    ; GFX8: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535
209    ; GFX8: [[COPY1:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
210    ; GFX8: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY1]], [[C]]
211    ; GFX8: [[UITOFP:%[0-9]+]]:_(s32) = G_UITOFP [[AND]](s32)
212    ; GFX8: $vgpr0 = COPY [[UITOFP]](s32)
213    %0:_(s32) = COPY $vgpr0
214    %1:_(s16) = G_TRUNC %0
215    %2:_(s32) = G_UITOFP %1
216    $vgpr0 = COPY %2
217...
218
219---
220name: test_uitofp_s16_to_s64
221body: |
222  bb.0:
223    liveins: $vgpr0
224
225    ; GFX6-LABEL: name: test_uitofp_s16_to_s64
226    ; GFX6: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
227    ; GFX6: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535
228    ; GFX6: [[COPY1:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
229    ; GFX6: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY1]], [[C]]
230    ; GFX6: [[UITOFP:%[0-9]+]]:_(s64) = G_UITOFP [[AND]](s32)
231    ; GFX6: $vgpr0_vgpr1 = COPY [[UITOFP]](s64)
232    ; GFX8-LABEL: name: test_uitofp_s16_to_s64
233    ; GFX8: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
234    ; GFX8: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535
235    ; GFX8: [[COPY1:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
236    ; GFX8: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY1]], [[C]]
237    ; GFX8: [[UITOFP:%[0-9]+]]:_(s64) = G_UITOFP [[AND]](s32)
238    ; GFX8: $vgpr0_vgpr1 = COPY [[UITOFP]](s64)
239    %0:_(s32) = COPY $vgpr0
240    %1:_(s16) = G_TRUNC %0
241    %2:_(s64) = G_UITOFP %1
242    $vgpr0_vgpr1 = COPY %2
243...
244
245---
246name: test_uitofp_s8_to_s16
247body: |
248  bb.0:
249    liveins: $vgpr0
250
251    ; GFX6-LABEL: name: test_uitofp_s8_to_s16
252    ; GFX6: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
253    ; GFX6: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 255
254    ; GFX6: [[COPY1:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
255    ; GFX6: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY1]], [[C]]
256    ; GFX6: [[UITOFP:%[0-9]+]]:_(s16) = G_UITOFP [[AND]](s32)
257    ; GFX6: [[ANYEXT:%[0-9]+]]:_(s32) = G_ANYEXT [[UITOFP]](s16)
258    ; GFX6: $vgpr0 = COPY [[ANYEXT]](s32)
259    ; GFX8-LABEL: name: test_uitofp_s8_to_s16
260    ; GFX8: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
261    ; GFX8: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 255
262    ; GFX8: [[COPY1:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
263    ; GFX8: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY1]], [[C]]
264    ; GFX8: [[UITOFP:%[0-9]+]]:_(s16) = G_UITOFP [[AND]](s32)
265    ; GFX8: [[ANYEXT:%[0-9]+]]:_(s32) = G_ANYEXT [[UITOFP]](s16)
266    ; GFX8: $vgpr0 = COPY [[ANYEXT]](s32)
267    %0:_(s32) = COPY $vgpr0
268    %1:_(s8) = G_TRUNC %0
269    %2:_(s16) = G_UITOFP %1
270    %3:_(s32) = G_ANYEXT %2
271    $vgpr0 = COPY %3
272...
273
274---
275name: test_uitofp_s8_to_s32
276body: |
277  bb.0:
278    liveins: $vgpr0
279
280    ; GFX6-LABEL: name: test_uitofp_s8_to_s32
281    ; GFX6: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
282    ; GFX6: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 255
283    ; GFX6: [[COPY1:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
284    ; GFX6: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY1]], [[C]]
285    ; GFX6: [[UITOFP:%[0-9]+]]:_(s32) = G_UITOFP [[AND]](s32)
286    ; GFX6: $vgpr0 = COPY [[UITOFP]](s32)
287    ; GFX8-LABEL: name: test_uitofp_s8_to_s32
288    ; GFX8: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
289    ; GFX8: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 255
290    ; GFX8: [[COPY1:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
291    ; GFX8: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY1]], [[C]]
292    ; GFX8: [[UITOFP:%[0-9]+]]:_(s32) = G_UITOFP [[AND]](s32)
293    ; GFX8: $vgpr0 = COPY [[UITOFP]](s32)
294    %0:_(s32) = COPY $vgpr0
295    %1:_(s8) = G_TRUNC %0
296    %2:_(s32) = G_UITOFP %1
297    $vgpr0 = COPY %2
298...
299
300---
301name: test_uitofp_s8_to_s64
302body: |
303  bb.0:
304    liveins: $vgpr0
305
306    ; GFX6-LABEL: name: test_uitofp_s8_to_s64
307    ; GFX6: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
308    ; GFX6: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 255
309    ; GFX6: [[COPY1:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
310    ; GFX6: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY1]], [[C]]
311    ; GFX6: [[UITOFP:%[0-9]+]]:_(s64) = G_UITOFP [[AND]](s32)
312    ; GFX6: $vgpr0_vgpr1 = COPY [[UITOFP]](s64)
313    ; GFX8-LABEL: name: test_uitofp_s8_to_s64
314    ; GFX8: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
315    ; GFX8: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 255
316    ; GFX8: [[COPY1:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
317    ; GFX8: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY1]], [[C]]
318    ; GFX8: [[UITOFP:%[0-9]+]]:_(s64) = G_UITOFP [[AND]](s32)
319    ; GFX8: $vgpr0_vgpr1 = COPY [[UITOFP]](s64)
320    %0:_(s32) = COPY $vgpr0
321    %1:_(s8) = G_TRUNC %0
322    %2:_(s64) = G_UITOFP %1
323    $vgpr0_vgpr1 = COPY %2
324...
325
326---
327name: test_uitofp_s1_to_s16
328body: |
329  bb.0:
330    liveins: $vgpr0
331
332    ; GFX6-LABEL: name: test_uitofp_s1_to_s16
333    ; GFX6: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
334    ; GFX6: [[TRUNC:%[0-9]+]]:_(s1) = G_TRUNC [[COPY]](s32)
335    ; GFX6: [[C:%[0-9]+]]:_(s16) = G_FCONSTANT half 0xH3C00
336    ; GFX6: [[C1:%[0-9]+]]:_(s16) = G_FCONSTANT half 0xH0000
337    ; GFX6: [[SELECT:%[0-9]+]]:_(s16) = G_SELECT [[TRUNC]](s1), [[C]], [[C1]]
338    ; GFX6: [[ANYEXT:%[0-9]+]]:_(s32) = G_ANYEXT [[SELECT]](s16)
339    ; GFX6: $vgpr0 = COPY [[ANYEXT]](s32)
340    ; GFX8-LABEL: name: test_uitofp_s1_to_s16
341    ; GFX8: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
342    ; GFX8: [[TRUNC:%[0-9]+]]:_(s1) = G_TRUNC [[COPY]](s32)
343    ; GFX8: [[C:%[0-9]+]]:_(s16) = G_FCONSTANT half 0xH3C00
344    ; GFX8: [[C1:%[0-9]+]]:_(s16) = G_FCONSTANT half 0xH0000
345    ; GFX8: [[SELECT:%[0-9]+]]:_(s16) = G_SELECT [[TRUNC]](s1), [[C]], [[C1]]
346    ; GFX8: [[ANYEXT:%[0-9]+]]:_(s32) = G_ANYEXT [[SELECT]](s16)
347    ; GFX8: $vgpr0 = COPY [[ANYEXT]](s32)
348    %0:_(s32) = COPY $vgpr0
349    %1:_(s1) = G_TRUNC %0
350    %2:_(s16) = G_UITOFP %1
351    %3:_(s32) = G_ANYEXT %2
352    $vgpr0 = COPY %3
353...
354
355---
356name: test_uitofp_s1_to_s32
357body: |
358  bb.0:
359    liveins: $vgpr0
360
361    ; GFX6-LABEL: name: test_uitofp_s1_to_s32
362    ; GFX6: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
363    ; GFX6: [[TRUNC:%[0-9]+]]:_(s1) = G_TRUNC [[COPY]](s32)
364    ; GFX6: [[C:%[0-9]+]]:_(s32) = G_FCONSTANT float 1.000000e+00
365    ; GFX6: [[C1:%[0-9]+]]:_(s32) = G_FCONSTANT float 0.000000e+00
366    ; GFX6: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[TRUNC]](s1), [[C]], [[C1]]
367    ; GFX6: $vgpr0 = COPY [[SELECT]](s32)
368    ; GFX8-LABEL: name: test_uitofp_s1_to_s32
369    ; GFX8: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
370    ; GFX8: [[TRUNC:%[0-9]+]]:_(s1) = G_TRUNC [[COPY]](s32)
371    ; GFX8: [[C:%[0-9]+]]:_(s32) = G_FCONSTANT float 1.000000e+00
372    ; GFX8: [[C1:%[0-9]+]]:_(s32) = G_FCONSTANT float 0.000000e+00
373    ; GFX8: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[TRUNC]](s1), [[C]], [[C1]]
374    ; GFX8: $vgpr0 = COPY [[SELECT]](s32)
375    %0:_(s32) = COPY $vgpr0
376    %1:_(s1) = G_TRUNC %0
377    %2:_(s32) = G_UITOFP %1
378    $vgpr0 = COPY %2
379...
380
381---
382name: test_uitofp_s1_to_s64
383body: |
384  bb.0:
385    liveins: $vgpr0
386
387    ; GFX6-LABEL: name: test_uitofp_s1_to_s64
388    ; GFX6: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
389    ; GFX6: [[TRUNC:%[0-9]+]]:_(s1) = G_TRUNC [[COPY]](s32)
390    ; GFX6: [[C:%[0-9]+]]:_(s64) = G_FCONSTANT double 1.000000e+00
391    ; GFX6: [[C1:%[0-9]+]]:_(s64) = G_FCONSTANT double 0.000000e+00
392    ; GFX6: [[SELECT:%[0-9]+]]:_(s64) = G_SELECT [[TRUNC]](s1), [[C]], [[C1]]
393    ; GFX6: $vgpr0_vgpr1 = COPY [[SELECT]](s64)
394    ; GFX8-LABEL: name: test_uitofp_s1_to_s64
395    ; GFX8: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
396    ; GFX8: [[TRUNC:%[0-9]+]]:_(s1) = G_TRUNC [[COPY]](s32)
397    ; GFX8: [[C:%[0-9]+]]:_(s64) = G_FCONSTANT double 1.000000e+00
398    ; GFX8: [[C1:%[0-9]+]]:_(s64) = G_FCONSTANT double 0.000000e+00
399    ; GFX8: [[SELECT:%[0-9]+]]:_(s64) = G_SELECT [[TRUNC]](s1), [[C]], [[C1]]
400    ; GFX8: $vgpr0_vgpr1 = COPY [[SELECT]](s64)
401    %0:_(s32) = COPY $vgpr0
402    %1:_(s1) = G_TRUNC %0
403    %2:_(s64) = G_UITOFP %1
404    $vgpr0_vgpr1 = COPY %2
405...
406
407---
408name: test_uitofp_s33_to_s32
409body: |
410  bb.0:
411    liveins: $vgpr0_vgpr1
412
413    ; GFX6-LABEL: name: test_uitofp_s33_to_s32
414    ; GFX6: [[COPY:%[0-9]+]]:_(s64) = COPY $vgpr0_vgpr1
415    ; GFX6: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 8589934591
416    ; GFX6: [[COPY1:%[0-9]+]]:_(s64) = COPY [[COPY]](s64)
417    ; GFX6: [[AND:%[0-9]+]]:_(s64) = G_AND [[COPY1]], [[C]]
418    ; GFX6: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
419    ; GFX6: [[C2:%[0-9]+]]:_(s64) = G_CONSTANT i64 0
420    ; GFX6: [[CTLZ_ZERO_UNDEF:%[0-9]+]]:_(s32) = G_CTLZ_ZERO_UNDEF [[AND]](s64)
421    ; GFX6: [[C3:%[0-9]+]]:_(s32) = G_CONSTANT i32 190
422    ; GFX6: [[SUB:%[0-9]+]]:_(s32) = G_SUB [[C3]], [[CTLZ_ZERO_UNDEF]]
423    ; GFX6: [[ICMP:%[0-9]+]]:_(s1) = G_ICMP intpred(ne), [[AND]](s64), [[C2]]
424    ; GFX6: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[ICMP]](s1), [[SUB]], [[C1]]
425    ; GFX6: [[C4:%[0-9]+]]:_(s64) = G_CONSTANT i64 9223372036854775807
426    ; GFX6: [[SHL:%[0-9]+]]:_(s64) = G_SHL [[AND]], [[CTLZ_ZERO_UNDEF]](s32)
427    ; GFX6: [[AND1:%[0-9]+]]:_(s64) = G_AND [[SHL]], [[C4]]
428    ; GFX6: [[C5:%[0-9]+]]:_(s64) = G_CONSTANT i64 1099511627775
429    ; GFX6: [[AND2:%[0-9]+]]:_(s64) = G_AND [[AND1]], [[C5]]
430    ; GFX6: [[C6:%[0-9]+]]:_(s32) = G_CONSTANT i32 40
431    ; GFX6: [[LSHR:%[0-9]+]]:_(s64) = G_LSHR [[AND1]], [[C6]](s32)
432    ; GFX6: [[C7:%[0-9]+]]:_(s32) = G_CONSTANT i32 23
433    ; GFX6: [[SHL1:%[0-9]+]]:_(s32) = G_SHL [[SELECT]], [[C7]](s32)
434    ; GFX6: [[TRUNC:%[0-9]+]]:_(s32) = G_TRUNC [[LSHR]](s64)
435    ; GFX6: [[OR:%[0-9]+]]:_(s32) = G_OR [[SHL1]], [[TRUNC]]
436    ; GFX6: [[C8:%[0-9]+]]:_(s64) = G_CONSTANT i64 549755813888
437    ; GFX6: [[ICMP1:%[0-9]+]]:_(s1) = G_ICMP intpred(ugt), [[AND2]](s64), [[C8]]
438    ; GFX6: [[ICMP2:%[0-9]+]]:_(s1) = G_ICMP intpred(eq), [[AND2]](s64), [[C8]]
439    ; GFX6: [[C9:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
440    ; GFX6: [[AND3:%[0-9]+]]:_(s32) = G_AND [[OR]], [[C9]]
441    ; GFX6: [[SELECT1:%[0-9]+]]:_(s32) = G_SELECT [[ICMP2]](s1), [[AND3]], [[C1]]
442    ; GFX6: [[SELECT2:%[0-9]+]]:_(s32) = G_SELECT [[ICMP1]](s1), [[C9]], [[SELECT1]]
443    ; GFX6: [[ADD:%[0-9]+]]:_(s32) = G_ADD [[OR]], [[SELECT2]]
444    ; GFX6: $vgpr0 = COPY [[ADD]](s32)
445    ; GFX8-LABEL: name: test_uitofp_s33_to_s32
446    ; GFX8: [[COPY:%[0-9]+]]:_(s64) = COPY $vgpr0_vgpr1
447    ; GFX8: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 8589934591
448    ; GFX8: [[COPY1:%[0-9]+]]:_(s64) = COPY [[COPY]](s64)
449    ; GFX8: [[AND:%[0-9]+]]:_(s64) = G_AND [[COPY1]], [[C]]
450    ; GFX8: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
451    ; GFX8: [[C2:%[0-9]+]]:_(s64) = G_CONSTANT i64 0
452    ; GFX8: [[CTLZ_ZERO_UNDEF:%[0-9]+]]:_(s32) = G_CTLZ_ZERO_UNDEF [[AND]](s64)
453    ; GFX8: [[C3:%[0-9]+]]:_(s32) = G_CONSTANT i32 190
454    ; GFX8: [[SUB:%[0-9]+]]:_(s32) = G_SUB [[C3]], [[CTLZ_ZERO_UNDEF]]
455    ; GFX8: [[ICMP:%[0-9]+]]:_(s1) = G_ICMP intpred(ne), [[AND]](s64), [[C2]]
456    ; GFX8: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[ICMP]](s1), [[SUB]], [[C1]]
457    ; GFX8: [[C4:%[0-9]+]]:_(s64) = G_CONSTANT i64 9223372036854775807
458    ; GFX8: [[SHL:%[0-9]+]]:_(s64) = G_SHL [[AND]], [[CTLZ_ZERO_UNDEF]](s32)
459    ; GFX8: [[AND1:%[0-9]+]]:_(s64) = G_AND [[SHL]], [[C4]]
460    ; GFX8: [[C5:%[0-9]+]]:_(s64) = G_CONSTANT i64 1099511627775
461    ; GFX8: [[AND2:%[0-9]+]]:_(s64) = G_AND [[AND1]], [[C5]]
462    ; GFX8: [[C6:%[0-9]+]]:_(s32) = G_CONSTANT i32 40
463    ; GFX8: [[LSHR:%[0-9]+]]:_(s64) = G_LSHR [[AND1]], [[C6]](s32)
464    ; GFX8: [[C7:%[0-9]+]]:_(s32) = G_CONSTANT i32 23
465    ; GFX8: [[SHL1:%[0-9]+]]:_(s32) = G_SHL [[SELECT]], [[C7]](s32)
466    ; GFX8: [[TRUNC:%[0-9]+]]:_(s32) = G_TRUNC [[LSHR]](s64)
467    ; GFX8: [[OR:%[0-9]+]]:_(s32) = G_OR [[SHL1]], [[TRUNC]]
468    ; GFX8: [[C8:%[0-9]+]]:_(s64) = G_CONSTANT i64 549755813888
469    ; GFX8: [[ICMP1:%[0-9]+]]:_(s1) = G_ICMP intpred(ugt), [[AND2]](s64), [[C8]]
470    ; GFX8: [[ICMP2:%[0-9]+]]:_(s1) = G_ICMP intpred(eq), [[AND2]](s64), [[C8]]
471    ; GFX8: [[C9:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
472    ; GFX8: [[AND3:%[0-9]+]]:_(s32) = G_AND [[OR]], [[C9]]
473    ; GFX8: [[SELECT1:%[0-9]+]]:_(s32) = G_SELECT [[ICMP2]](s1), [[AND3]], [[C1]]
474    ; GFX8: [[SELECT2:%[0-9]+]]:_(s32) = G_SELECT [[ICMP1]](s1), [[C9]], [[SELECT1]]
475    ; GFX8: [[ADD:%[0-9]+]]:_(s32) = G_ADD [[OR]], [[SELECT2]]
476    ; GFX8: $vgpr0 = COPY [[ADD]](s32)
477    %0:_(s64) = COPY $vgpr0_vgpr1
478    %1:_(s33) = G_TRUNC %0
479    %2:_(s32) = G_UITOFP %1
480    $vgpr0 = COPY %2
481...
482