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
6 name: test_uitofp_s32_to_s32
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
25 name: test_uitofp_s32_to_s64
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
44 name: test_uitofp_v2s32_to_v2s32
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
69 name: test_uitofp_s64_to_s32
74 ; GFX6-LABEL: name: test_uitofp_s64_to_s32
75 ; GFX6: [[COPY:%[0-9]+]]:_(s64) = COPY $vgpr0_vgpr1
76 ; GFX6: [[UV:%[0-9]+]]:_(s32), [[UV1:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[COPY]](s64)
77 ; GFX6: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 32
78 ; GFX6: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
79 ; GFX6: [[AMDGPU_FFBH_U32_:%[0-9]+]]:_(s32) = G_AMDGPU_FFBH_U32 [[UV1]](s32)
80 ; GFX6: [[UMIN:%[0-9]+]]:_(s32) = G_UMIN [[AMDGPU_FFBH_U32_]], [[C]]
81 ; GFX6: [[SHL:%[0-9]+]]:_(s64) = G_SHL [[COPY]], [[UMIN]](s32)
82 ; GFX6: [[UV2:%[0-9]+]]:_(s32), [[UV3:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[SHL]](s64)
83 ; GFX6: [[UMIN1:%[0-9]+]]:_(s32) = G_UMIN [[C1]], [[UV2]]
84 ; GFX6: [[OR:%[0-9]+]]:_(s32) = G_OR [[UV3]], [[UMIN1]]
85 ; GFX6: [[UITOFP:%[0-9]+]]:_(s32) = G_UITOFP [[OR]](s32)
86 ; GFX6: [[SUB:%[0-9]+]]:_(s32) = G_SUB [[C]], [[UMIN]]
87 ; GFX6: [[INT:%[0-9]+]]:_(s32) = G_INTRINSIC intrinsic(@llvm.amdgcn.ldexp), [[UITOFP]](s32), [[SUB]](s32)
88 ; GFX6: $vgpr0 = COPY [[INT]](s32)
89 ; GFX8-LABEL: name: test_uitofp_s64_to_s32
90 ; GFX8: [[COPY:%[0-9]+]]:_(s64) = COPY $vgpr0_vgpr1
91 ; GFX8: [[UV:%[0-9]+]]:_(s32), [[UV1:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[COPY]](s64)
92 ; GFX8: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 32
93 ; GFX8: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
94 ; GFX8: [[AMDGPU_FFBH_U32_:%[0-9]+]]:_(s32) = G_AMDGPU_FFBH_U32 [[UV1]](s32)
95 ; GFX8: [[UMIN:%[0-9]+]]:_(s32) = G_UMIN [[AMDGPU_FFBH_U32_]], [[C]]
96 ; GFX8: [[SHL:%[0-9]+]]:_(s64) = G_SHL [[COPY]], [[UMIN]](s32)
97 ; GFX8: [[UV2:%[0-9]+]]:_(s32), [[UV3:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[SHL]](s64)
98 ; GFX8: [[UMIN1:%[0-9]+]]:_(s32) = G_UMIN [[C1]], [[UV2]]
99 ; GFX8: [[OR:%[0-9]+]]:_(s32) = G_OR [[UV3]], [[UMIN1]]
100 ; GFX8: [[UITOFP:%[0-9]+]]:_(s32) = G_UITOFP [[OR]](s32)
101 ; GFX8: [[SUB:%[0-9]+]]:_(s32) = G_SUB [[C]], [[UMIN]]
102 ; GFX8: [[INT:%[0-9]+]]:_(s32) = G_INTRINSIC intrinsic(@llvm.amdgcn.ldexp), [[UITOFP]](s32), [[SUB]](s32)
103 ; GFX8: $vgpr0 = COPY [[INT]](s32)
104 %0:_(s64) = COPY $vgpr0_vgpr1
105 %1:_(s32) = G_UITOFP %0
110 name: test_uitofp_s64_to_s64
113 liveins: $vgpr0_vgpr1
115 ; GFX6-LABEL: name: test_uitofp_s64_to_s64
116 ; GFX6: [[COPY:%[0-9]+]]:_(s64) = COPY $vgpr0_vgpr1
117 ; GFX6: [[UV:%[0-9]+]]:_(s32), [[UV1:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[COPY]](s64)
118 ; GFX6: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 32
119 ; GFX6: [[UITOFP:%[0-9]+]]:_(s64) = G_UITOFP [[UV1]](s32)
120 ; GFX6: [[UITOFP1:%[0-9]+]]:_(s64) = G_UITOFP [[UV]](s32)
121 ; GFX6: [[INT:%[0-9]+]]:_(s64) = G_INTRINSIC intrinsic(@llvm.amdgcn.ldexp), [[UITOFP]](s64), [[C]](s32)
122 ; GFX6: [[FADD:%[0-9]+]]:_(s64) = G_FADD [[INT]], [[UITOFP1]]
123 ; GFX6: $vgpr0_vgpr1 = COPY [[FADD]](s64)
124 ; GFX8-LABEL: name: test_uitofp_s64_to_s64
125 ; GFX8: [[COPY:%[0-9]+]]:_(s64) = COPY $vgpr0_vgpr1
126 ; GFX8: [[UV:%[0-9]+]]:_(s32), [[UV1:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[COPY]](s64)
127 ; GFX8: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 32
128 ; GFX8: [[UITOFP:%[0-9]+]]:_(s64) = G_UITOFP [[UV1]](s32)
129 ; GFX8: [[UITOFP1:%[0-9]+]]:_(s64) = G_UITOFP [[UV]](s32)
130 ; GFX8: [[INT:%[0-9]+]]:_(s64) = G_INTRINSIC intrinsic(@llvm.amdgcn.ldexp), [[UITOFP]](s64), [[C]](s32)
131 ; GFX8: [[FADD:%[0-9]+]]:_(s64) = G_FADD [[INT]], [[UITOFP1]]
132 ; GFX8: $vgpr0_vgpr1 = COPY [[FADD]](s64)
133 %0:_(s64) = COPY $vgpr0_vgpr1
134 %1:_(s64) = G_UITOFP %0
135 $vgpr0_vgpr1 = COPY %1
139 name: test_uitofp_s16_to_s16
144 ; GFX6-LABEL: name: test_uitofp_s16_to_s16
145 ; GFX6: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
146 ; GFX6: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535
147 ; GFX6: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY]], [[C]]
148 ; GFX6: [[UITOFP:%[0-9]+]]:_(s16) = G_UITOFP [[AND]](s32)
149 ; GFX6: [[ANYEXT:%[0-9]+]]:_(s32) = G_ANYEXT [[UITOFP]](s16)
150 ; GFX6: $vgpr0 = COPY [[ANYEXT]](s32)
151 ; GFX8-LABEL: name: test_uitofp_s16_to_s16
152 ; GFX8: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
153 ; GFX8: [[TRUNC:%[0-9]+]]:_(s16) = G_TRUNC [[COPY]](s32)
154 ; GFX8: [[UITOFP:%[0-9]+]]:_(s16) = G_UITOFP [[TRUNC]](s16)
155 ; GFX8: [[ANYEXT:%[0-9]+]]:_(s32) = G_ANYEXT [[UITOFP]](s16)
156 ; GFX8: $vgpr0 = COPY [[ANYEXT]](s32)
157 %0:_(s32) = COPY $vgpr0
158 %1:_(s16) = G_TRUNC %0
159 %2:_(s16) = G_UITOFP %1
160 %3:_(s32) = G_ANYEXT %2
165 name: test_uitofp_s16_to_s32
170 ; GFX6-LABEL: name: test_uitofp_s16_to_s32
171 ; GFX6: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
172 ; GFX6: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535
173 ; GFX6: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY]], [[C]]
174 ; GFX6: [[UITOFP:%[0-9]+]]:_(s32) = G_UITOFP [[AND]](s32)
175 ; GFX6: $vgpr0 = COPY [[UITOFP]](s32)
176 ; GFX8-LABEL: name: test_uitofp_s16_to_s32
177 ; GFX8: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
178 ; GFX8: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535
179 ; GFX8: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY]], [[C]]
180 ; GFX8: [[UITOFP:%[0-9]+]]:_(s32) = G_UITOFP [[AND]](s32)
181 ; GFX8: $vgpr0 = COPY [[UITOFP]](s32)
182 %0:_(s32) = COPY $vgpr0
183 %1:_(s16) = G_TRUNC %0
184 %2:_(s32) = G_UITOFP %1
189 name: test_uitofp_s16_to_s64
194 ; GFX6-LABEL: name: test_uitofp_s16_to_s64
195 ; GFX6: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
196 ; GFX6: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535
197 ; GFX6: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY]], [[C]]
198 ; GFX6: [[UITOFP:%[0-9]+]]:_(s64) = G_UITOFP [[AND]](s32)
199 ; GFX6: $vgpr0_vgpr1 = COPY [[UITOFP]](s64)
200 ; GFX8-LABEL: name: test_uitofp_s16_to_s64
201 ; GFX8: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
202 ; GFX8: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535
203 ; GFX8: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY]], [[C]]
204 ; GFX8: [[UITOFP:%[0-9]+]]:_(s64) = G_UITOFP [[AND]](s32)
205 ; GFX8: $vgpr0_vgpr1 = COPY [[UITOFP]](s64)
206 %0:_(s32) = COPY $vgpr0
207 %1:_(s16) = G_TRUNC %0
208 %2:_(s64) = G_UITOFP %1
209 $vgpr0_vgpr1 = COPY %2
213 name: test_uitofp_s8_to_s16
218 ; GFX6-LABEL: name: test_uitofp_s8_to_s16
219 ; GFX6: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
220 ; GFX6: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 255
221 ; GFX6: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY]], [[C]]
222 ; GFX6: [[UITOFP:%[0-9]+]]:_(s16) = G_UITOFP [[AND]](s32)
223 ; GFX6: [[ANYEXT:%[0-9]+]]:_(s32) = G_ANYEXT [[UITOFP]](s16)
224 ; GFX6: $vgpr0 = COPY [[ANYEXT]](s32)
225 ; GFX8-LABEL: name: test_uitofp_s8_to_s16
226 ; GFX8: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
227 ; GFX8: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 255
228 ; GFX8: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY]], [[C]]
229 ; GFX8: [[UITOFP:%[0-9]+]]:_(s16) = G_UITOFP [[AND]](s32)
230 ; GFX8: [[ANYEXT:%[0-9]+]]:_(s32) = G_ANYEXT [[UITOFP]](s16)
231 ; GFX8: $vgpr0 = COPY [[ANYEXT]](s32)
232 %0:_(s32) = COPY $vgpr0
233 %1:_(s8) = G_TRUNC %0
234 %2:_(s16) = G_UITOFP %1
235 %3:_(s32) = G_ANYEXT %2
240 name: test_uitofp_s8_to_s32
245 ; GFX6-LABEL: name: test_uitofp_s8_to_s32
246 ; GFX6: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
247 ; GFX6: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 255
248 ; GFX6: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY]], [[C]]
249 ; GFX6: [[UITOFP:%[0-9]+]]:_(s32) = G_UITOFP [[AND]](s32)
250 ; GFX6: $vgpr0 = COPY [[UITOFP]](s32)
251 ; GFX8-LABEL: name: test_uitofp_s8_to_s32
252 ; GFX8: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
253 ; GFX8: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 255
254 ; GFX8: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY]], [[C]]
255 ; GFX8: [[UITOFP:%[0-9]+]]:_(s32) = G_UITOFP [[AND]](s32)
256 ; GFX8: $vgpr0 = COPY [[UITOFP]](s32)
257 %0:_(s32) = COPY $vgpr0
258 %1:_(s8) = G_TRUNC %0
259 %2:_(s32) = G_UITOFP %1
264 name: test_uitofp_s8_to_s64
269 ; GFX6-LABEL: name: test_uitofp_s8_to_s64
270 ; GFX6: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
271 ; GFX6: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 255
272 ; GFX6: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY]], [[C]]
273 ; GFX6: [[UITOFP:%[0-9]+]]:_(s64) = G_UITOFP [[AND]](s32)
274 ; GFX6: $vgpr0_vgpr1 = COPY [[UITOFP]](s64)
275 ; GFX8-LABEL: name: test_uitofp_s8_to_s64
276 ; GFX8: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
277 ; GFX8: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 255
278 ; GFX8: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY]], [[C]]
279 ; GFX8: [[UITOFP:%[0-9]+]]:_(s64) = G_UITOFP [[AND]](s32)
280 ; GFX8: $vgpr0_vgpr1 = COPY [[UITOFP]](s64)
281 %0:_(s32) = COPY $vgpr0
282 %1:_(s8) = G_TRUNC %0
283 %2:_(s64) = G_UITOFP %1
284 $vgpr0_vgpr1 = COPY %2
288 name: test_uitofp_s1_to_s16
293 ; GFX6-LABEL: name: test_uitofp_s1_to_s16
294 ; GFX6: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
295 ; GFX6: [[TRUNC:%[0-9]+]]:_(s1) = G_TRUNC [[COPY]](s32)
296 ; GFX6: [[C:%[0-9]+]]:_(s16) = G_FCONSTANT half 0xH3C00
297 ; GFX6: [[C1:%[0-9]+]]:_(s16) = G_FCONSTANT half 0xH0000
298 ; GFX6: [[SELECT:%[0-9]+]]:_(s16) = G_SELECT [[TRUNC]](s1), [[C]], [[C1]]
299 ; GFX6: [[ANYEXT:%[0-9]+]]:_(s32) = G_ANYEXT [[SELECT]](s16)
300 ; GFX6: $vgpr0 = COPY [[ANYEXT]](s32)
301 ; GFX8-LABEL: name: test_uitofp_s1_to_s16
302 ; GFX8: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
303 ; GFX8: [[TRUNC:%[0-9]+]]:_(s1) = G_TRUNC [[COPY]](s32)
304 ; GFX8: [[C:%[0-9]+]]:_(s16) = G_FCONSTANT half 0xH3C00
305 ; GFX8: [[C1:%[0-9]+]]:_(s16) = G_FCONSTANT half 0xH0000
306 ; GFX8: [[SELECT:%[0-9]+]]:_(s16) = G_SELECT [[TRUNC]](s1), [[C]], [[C1]]
307 ; GFX8: [[ANYEXT:%[0-9]+]]:_(s32) = G_ANYEXT [[SELECT]](s16)
308 ; GFX8: $vgpr0 = COPY [[ANYEXT]](s32)
309 %0:_(s32) = COPY $vgpr0
310 %1:_(s1) = G_TRUNC %0
311 %2:_(s16) = G_UITOFP %1
312 %3:_(s32) = G_ANYEXT %2
317 name: test_uitofp_s1_to_s32
322 ; GFX6-LABEL: name: test_uitofp_s1_to_s32
323 ; GFX6: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
324 ; GFX6: [[TRUNC:%[0-9]+]]:_(s1) = G_TRUNC [[COPY]](s32)
325 ; GFX6: [[C:%[0-9]+]]:_(s32) = G_FCONSTANT float 1.000000e+00
326 ; GFX6: [[C1:%[0-9]+]]:_(s32) = G_FCONSTANT float 0.000000e+00
327 ; GFX6: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[TRUNC]](s1), [[C]], [[C1]]
328 ; GFX6: $vgpr0 = COPY [[SELECT]](s32)
329 ; GFX8-LABEL: name: test_uitofp_s1_to_s32
330 ; GFX8: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
331 ; GFX8: [[TRUNC:%[0-9]+]]:_(s1) = G_TRUNC [[COPY]](s32)
332 ; GFX8: [[C:%[0-9]+]]:_(s32) = G_FCONSTANT float 1.000000e+00
333 ; GFX8: [[C1:%[0-9]+]]:_(s32) = G_FCONSTANT float 0.000000e+00
334 ; GFX8: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[TRUNC]](s1), [[C]], [[C1]]
335 ; GFX8: $vgpr0 = COPY [[SELECT]](s32)
336 %0:_(s32) = COPY $vgpr0
337 %1:_(s1) = G_TRUNC %0
338 %2:_(s32) = G_UITOFP %1
343 name: test_uitofp_s1_to_s64
348 ; GFX6-LABEL: name: test_uitofp_s1_to_s64
349 ; GFX6: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
350 ; GFX6: [[TRUNC:%[0-9]+]]:_(s1) = G_TRUNC [[COPY]](s32)
351 ; GFX6: [[C:%[0-9]+]]:_(s64) = G_FCONSTANT double 1.000000e+00
352 ; GFX6: [[C1:%[0-9]+]]:_(s64) = G_FCONSTANT double 0.000000e+00
353 ; GFX6: [[SELECT:%[0-9]+]]:_(s64) = G_SELECT [[TRUNC]](s1), [[C]], [[C1]]
354 ; GFX6: $vgpr0_vgpr1 = COPY [[SELECT]](s64)
355 ; GFX8-LABEL: name: test_uitofp_s1_to_s64
356 ; GFX8: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
357 ; GFX8: [[TRUNC:%[0-9]+]]:_(s1) = G_TRUNC [[COPY]](s32)
358 ; GFX8: [[C:%[0-9]+]]:_(s64) = G_FCONSTANT double 1.000000e+00
359 ; GFX8: [[C1:%[0-9]+]]:_(s64) = G_FCONSTANT double 0.000000e+00
360 ; GFX8: [[SELECT:%[0-9]+]]:_(s64) = G_SELECT [[TRUNC]](s1), [[C]], [[C1]]
361 ; GFX8: $vgpr0_vgpr1 = COPY [[SELECT]](s64)
362 %0:_(s32) = COPY $vgpr0
363 %1:_(s1) = G_TRUNC %0
364 %2:_(s64) = G_UITOFP %1
365 $vgpr0_vgpr1 = COPY %2
369 name: test_uitofp_s33_to_s32
372 liveins: $vgpr0_vgpr1
374 ; GFX6-LABEL: name: test_uitofp_s33_to_s32
375 ; GFX6: [[COPY:%[0-9]+]]:_(s64) = COPY $vgpr0_vgpr1
376 ; GFX6: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 8589934591
377 ; GFX6: [[AND:%[0-9]+]]:_(s64) = G_AND [[COPY]], [[C]]
378 ; GFX6: [[UV:%[0-9]+]]:_(s32), [[UV1:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[AND]](s64)
379 ; GFX6: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 32
380 ; GFX6: [[C2:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
381 ; GFX6: [[AMDGPU_FFBH_U32_:%[0-9]+]]:_(s32) = G_AMDGPU_FFBH_U32 [[UV1]](s32)
382 ; GFX6: [[UMIN:%[0-9]+]]:_(s32) = G_UMIN [[AMDGPU_FFBH_U32_]], [[C1]]
383 ; GFX6: [[SHL:%[0-9]+]]:_(s64) = G_SHL [[AND]], [[UMIN]](s32)
384 ; GFX6: [[UV2:%[0-9]+]]:_(s32), [[UV3:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[SHL]](s64)
385 ; GFX6: [[UMIN1:%[0-9]+]]:_(s32) = G_UMIN [[C2]], [[UV2]]
386 ; GFX6: [[OR:%[0-9]+]]:_(s32) = G_OR [[UV3]], [[UMIN1]]
387 ; GFX6: [[UITOFP:%[0-9]+]]:_(s32) = G_UITOFP [[OR]](s32)
388 ; GFX6: [[SUB:%[0-9]+]]:_(s32) = G_SUB [[C1]], [[UMIN]]
389 ; GFX6: [[INT:%[0-9]+]]:_(s32) = G_INTRINSIC intrinsic(@llvm.amdgcn.ldexp), [[UITOFP]](s32), [[SUB]](s32)
390 ; GFX6: $vgpr0 = COPY [[INT]](s32)
391 ; GFX8-LABEL: name: test_uitofp_s33_to_s32
392 ; GFX8: [[COPY:%[0-9]+]]:_(s64) = COPY $vgpr0_vgpr1
393 ; GFX8: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 8589934591
394 ; GFX8: [[AND:%[0-9]+]]:_(s64) = G_AND [[COPY]], [[C]]
395 ; GFX8: [[UV:%[0-9]+]]:_(s32), [[UV1:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[AND]](s64)
396 ; GFX8: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 32
397 ; GFX8: [[C2:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
398 ; GFX8: [[AMDGPU_FFBH_U32_:%[0-9]+]]:_(s32) = G_AMDGPU_FFBH_U32 [[UV1]](s32)
399 ; GFX8: [[UMIN:%[0-9]+]]:_(s32) = G_UMIN [[AMDGPU_FFBH_U32_]], [[C1]]
400 ; GFX8: [[SHL:%[0-9]+]]:_(s64) = G_SHL [[AND]], [[UMIN]](s32)
401 ; GFX8: [[UV2:%[0-9]+]]:_(s32), [[UV3:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[SHL]](s64)
402 ; GFX8: [[UMIN1:%[0-9]+]]:_(s32) = G_UMIN [[C2]], [[UV2]]
403 ; GFX8: [[OR:%[0-9]+]]:_(s32) = G_OR [[UV3]], [[UMIN1]]
404 ; GFX8: [[UITOFP:%[0-9]+]]:_(s32) = G_UITOFP [[OR]](s32)
405 ; GFX8: [[SUB:%[0-9]+]]:_(s32) = G_SUB [[C1]], [[UMIN]]
406 ; GFX8: [[INT:%[0-9]+]]:_(s32) = G_INTRINSIC intrinsic(@llvm.amdgcn.ldexp), [[UITOFP]](s32), [[SUB]](s32)
407 ; GFX8: $vgpr0 = COPY [[INT]](s32)
408 %0:_(s64) = COPY $vgpr0_vgpr1
409 %1:_(s33) = G_TRUNC %0
410 %2:_(s32) = G_UITOFP %1
415 name: test_uitofp_s64_to_s16
418 liveins: $vgpr0_vgpr1
420 ; GFX6-LABEL: name: test_uitofp_s64_to_s16
421 ; GFX6: [[COPY:%[0-9]+]]:_(s64) = COPY $vgpr0_vgpr1
422 ; GFX6: [[UV:%[0-9]+]]:_(s32), [[UV1:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[COPY]](s64)
423 ; GFX6: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 32
424 ; GFX6: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
425 ; GFX6: [[AMDGPU_FFBH_U32_:%[0-9]+]]:_(s32) = G_AMDGPU_FFBH_U32 [[UV1]](s32)
426 ; GFX6: [[UMIN:%[0-9]+]]:_(s32) = G_UMIN [[AMDGPU_FFBH_U32_]], [[C]]
427 ; GFX6: [[SHL:%[0-9]+]]:_(s64) = G_SHL [[COPY]], [[UMIN]](s32)
428 ; GFX6: [[UV2:%[0-9]+]]:_(s32), [[UV3:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[SHL]](s64)
429 ; GFX6: [[UMIN1:%[0-9]+]]:_(s32) = G_UMIN [[C1]], [[UV2]]
430 ; GFX6: [[OR:%[0-9]+]]:_(s32) = G_OR [[UV3]], [[UMIN1]]
431 ; GFX6: [[UITOFP:%[0-9]+]]:_(s32) = G_UITOFP [[OR]](s32)
432 ; GFX6: [[SUB:%[0-9]+]]:_(s32) = G_SUB [[C]], [[UMIN]]
433 ; GFX6: [[INT:%[0-9]+]]:_(s32) = G_INTRINSIC intrinsic(@llvm.amdgcn.ldexp), [[UITOFP]](s32), [[SUB]](s32)
434 ; GFX6: [[FPTRUNC:%[0-9]+]]:_(s16) = G_FPTRUNC [[INT]](s32)
435 ; GFX6: [[ANYEXT:%[0-9]+]]:_(s32) = G_ANYEXT [[FPTRUNC]](s16)
436 ; GFX6: $vgpr0 = COPY [[ANYEXT]](s32)
437 ; GFX8-LABEL: name: test_uitofp_s64_to_s16
438 ; GFX8: [[COPY:%[0-9]+]]:_(s64) = COPY $vgpr0_vgpr1
439 ; GFX8: [[UV:%[0-9]+]]:_(s32), [[UV1:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[COPY]](s64)
440 ; GFX8: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 32
441 ; GFX8: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
442 ; GFX8: [[AMDGPU_FFBH_U32_:%[0-9]+]]:_(s32) = G_AMDGPU_FFBH_U32 [[UV1]](s32)
443 ; GFX8: [[UMIN:%[0-9]+]]:_(s32) = G_UMIN [[AMDGPU_FFBH_U32_]], [[C]]
444 ; GFX8: [[SHL:%[0-9]+]]:_(s64) = G_SHL [[COPY]], [[UMIN]](s32)
445 ; GFX8: [[UV2:%[0-9]+]]:_(s32), [[UV3:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[SHL]](s64)
446 ; GFX8: [[UMIN1:%[0-9]+]]:_(s32) = G_UMIN [[C1]], [[UV2]]
447 ; GFX8: [[OR:%[0-9]+]]:_(s32) = G_OR [[UV3]], [[UMIN1]]
448 ; GFX8: [[UITOFP:%[0-9]+]]:_(s32) = G_UITOFP [[OR]](s32)
449 ; GFX8: [[SUB:%[0-9]+]]:_(s32) = G_SUB [[C]], [[UMIN]]
450 ; GFX8: [[INT:%[0-9]+]]:_(s32) = G_INTRINSIC intrinsic(@llvm.amdgcn.ldexp), [[UITOFP]](s32), [[SUB]](s32)
451 ; GFX8: [[FPTRUNC:%[0-9]+]]:_(s16) = G_FPTRUNC [[INT]](s32)
452 ; GFX8: [[ANYEXT:%[0-9]+]]:_(s32) = G_ANYEXT [[FPTRUNC]](s16)
453 ; GFX8: $vgpr0 = COPY [[ANYEXT]](s32)
454 %0:_(s64) = COPY $vgpr0_vgpr1
455 %1:_(s16) = G_UITOFP %0
456 %2:_(s32) = G_ANYEXT %1
461 name: test_sitofp_v2s64_to_v2s16
464 liveins: $vgpr0_vgpr1_vgpr2_vgpr3
466 ; GFX6-LABEL: name: test_sitofp_v2s64_to_v2s16
467 ; GFX6: [[COPY:%[0-9]+]]:_(<2 x s64>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
468 ; GFX6: [[UV:%[0-9]+]]:_(s64), [[UV1:%[0-9]+]]:_(s64) = G_UNMERGE_VALUES [[COPY]](<2 x s64>)
469 ; GFX6: [[UV2:%[0-9]+]]:_(s32), [[UV3:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[UV]](s64)
470 ; GFX6: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 32
471 ; GFX6: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
472 ; GFX6: [[AMDGPU_FFBH_U32_:%[0-9]+]]:_(s32) = G_AMDGPU_FFBH_U32 [[UV3]](s32)
473 ; GFX6: [[UMIN:%[0-9]+]]:_(s32) = G_UMIN [[AMDGPU_FFBH_U32_]], [[C]]
474 ; GFX6: [[SHL:%[0-9]+]]:_(s64) = G_SHL [[UV]], [[UMIN]](s32)
475 ; GFX6: [[UV4:%[0-9]+]]:_(s32), [[UV5:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[SHL]](s64)
476 ; GFX6: [[UMIN1:%[0-9]+]]:_(s32) = G_UMIN [[C1]], [[UV4]]
477 ; GFX6: [[OR:%[0-9]+]]:_(s32) = G_OR [[UV5]], [[UMIN1]]
478 ; GFX6: [[UITOFP:%[0-9]+]]:_(s32) = G_UITOFP [[OR]](s32)
479 ; GFX6: [[SUB:%[0-9]+]]:_(s32) = G_SUB [[C]], [[UMIN]]
480 ; GFX6: [[INT:%[0-9]+]]:_(s32) = G_INTRINSIC intrinsic(@llvm.amdgcn.ldexp), [[UITOFP]](s32), [[SUB]](s32)
481 ; GFX6: [[FPTRUNC:%[0-9]+]]:_(s16) = G_FPTRUNC [[INT]](s32)
482 ; GFX6: [[UV6:%[0-9]+]]:_(s32), [[UV7:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[UV1]](s64)
483 ; GFX6: [[AMDGPU_FFBH_U32_1:%[0-9]+]]:_(s32) = G_AMDGPU_FFBH_U32 [[UV7]](s32)
484 ; GFX6: [[UMIN2:%[0-9]+]]:_(s32) = G_UMIN [[AMDGPU_FFBH_U32_1]], [[C]]
485 ; GFX6: [[SHL1:%[0-9]+]]:_(s64) = G_SHL [[UV1]], [[UMIN2]](s32)
486 ; GFX6: [[UV8:%[0-9]+]]:_(s32), [[UV9:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[SHL1]](s64)
487 ; GFX6: [[UMIN3:%[0-9]+]]:_(s32) = G_UMIN [[C1]], [[UV8]]
488 ; GFX6: [[OR1:%[0-9]+]]:_(s32) = G_OR [[UV9]], [[UMIN3]]
489 ; GFX6: [[UITOFP1:%[0-9]+]]:_(s32) = G_UITOFP [[OR1]](s32)
490 ; GFX6: [[SUB1:%[0-9]+]]:_(s32) = G_SUB [[C]], [[UMIN2]]
491 ; GFX6: [[INT1:%[0-9]+]]:_(s32) = G_INTRINSIC intrinsic(@llvm.amdgcn.ldexp), [[UITOFP1]](s32), [[SUB1]](s32)
492 ; GFX6: [[FPTRUNC1:%[0-9]+]]:_(s16) = G_FPTRUNC [[INT1]](s32)
493 ; GFX6: [[ZEXT:%[0-9]+]]:_(s32) = G_ZEXT [[FPTRUNC]](s16)
494 ; GFX6: [[ZEXT1:%[0-9]+]]:_(s32) = G_ZEXT [[FPTRUNC1]](s16)
495 ; GFX6: [[C2:%[0-9]+]]:_(s32) = G_CONSTANT i32 16
496 ; GFX6: [[SHL2:%[0-9]+]]:_(s32) = G_SHL [[ZEXT1]], [[C2]](s32)
497 ; GFX6: [[OR2:%[0-9]+]]:_(s32) = G_OR [[ZEXT]], [[SHL2]]
498 ; GFX6: [[BITCAST:%[0-9]+]]:_(<2 x s16>) = G_BITCAST [[OR2]](s32)
499 ; GFX6: $vgpr0 = COPY [[BITCAST]](<2 x s16>)
500 ; GFX8-LABEL: name: test_sitofp_v2s64_to_v2s16
501 ; GFX8: [[COPY:%[0-9]+]]:_(<2 x s64>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
502 ; GFX8: [[UV:%[0-9]+]]:_(s64), [[UV1:%[0-9]+]]:_(s64) = G_UNMERGE_VALUES [[COPY]](<2 x s64>)
503 ; GFX8: [[UV2:%[0-9]+]]:_(s32), [[UV3:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[UV]](s64)
504 ; GFX8: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 32
505 ; GFX8: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
506 ; GFX8: [[AMDGPU_FFBH_U32_:%[0-9]+]]:_(s32) = G_AMDGPU_FFBH_U32 [[UV3]](s32)
507 ; GFX8: [[UMIN:%[0-9]+]]:_(s32) = G_UMIN [[AMDGPU_FFBH_U32_]], [[C]]
508 ; GFX8: [[SHL:%[0-9]+]]:_(s64) = G_SHL [[UV]], [[UMIN]](s32)
509 ; GFX8: [[UV4:%[0-9]+]]:_(s32), [[UV5:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[SHL]](s64)
510 ; GFX8: [[UMIN1:%[0-9]+]]:_(s32) = G_UMIN [[C1]], [[UV4]]
511 ; GFX8: [[OR:%[0-9]+]]:_(s32) = G_OR [[UV5]], [[UMIN1]]
512 ; GFX8: [[UITOFP:%[0-9]+]]:_(s32) = G_UITOFP [[OR]](s32)
513 ; GFX8: [[SUB:%[0-9]+]]:_(s32) = G_SUB [[C]], [[UMIN]]
514 ; GFX8: [[INT:%[0-9]+]]:_(s32) = G_INTRINSIC intrinsic(@llvm.amdgcn.ldexp), [[UITOFP]](s32), [[SUB]](s32)
515 ; GFX8: [[FPTRUNC:%[0-9]+]]:_(s16) = G_FPTRUNC [[INT]](s32)
516 ; GFX8: [[UV6:%[0-9]+]]:_(s32), [[UV7:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[UV1]](s64)
517 ; GFX8: [[AMDGPU_FFBH_U32_1:%[0-9]+]]:_(s32) = G_AMDGPU_FFBH_U32 [[UV7]](s32)
518 ; GFX8: [[UMIN2:%[0-9]+]]:_(s32) = G_UMIN [[AMDGPU_FFBH_U32_1]], [[C]]
519 ; GFX8: [[SHL1:%[0-9]+]]:_(s64) = G_SHL [[UV1]], [[UMIN2]](s32)
520 ; GFX8: [[UV8:%[0-9]+]]:_(s32), [[UV9:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[SHL1]](s64)
521 ; GFX8: [[UMIN3:%[0-9]+]]:_(s32) = G_UMIN [[C1]], [[UV8]]
522 ; GFX8: [[OR1:%[0-9]+]]:_(s32) = G_OR [[UV9]], [[UMIN3]]
523 ; GFX8: [[UITOFP1:%[0-9]+]]:_(s32) = G_UITOFP [[OR1]](s32)
524 ; GFX8: [[SUB1:%[0-9]+]]:_(s32) = G_SUB [[C]], [[UMIN2]]
525 ; GFX8: [[INT1:%[0-9]+]]:_(s32) = G_INTRINSIC intrinsic(@llvm.amdgcn.ldexp), [[UITOFP1]](s32), [[SUB1]](s32)
526 ; GFX8: [[FPTRUNC1:%[0-9]+]]:_(s16) = G_FPTRUNC [[INT1]](s32)
527 ; GFX8: [[ZEXT:%[0-9]+]]:_(s32) = G_ZEXT [[FPTRUNC]](s16)
528 ; GFX8: [[ZEXT1:%[0-9]+]]:_(s32) = G_ZEXT [[FPTRUNC1]](s16)
529 ; GFX8: [[C2:%[0-9]+]]:_(s32) = G_CONSTANT i32 16
530 ; GFX8: [[SHL2:%[0-9]+]]:_(s32) = G_SHL [[ZEXT1]], [[C2]](s32)
531 ; GFX8: [[OR2:%[0-9]+]]:_(s32) = G_OR [[ZEXT]], [[SHL2]]
532 ; GFX8: [[BITCAST:%[0-9]+]]:_(<2 x s16>) = G_BITCAST [[OR2]](s32)
533 ; GFX8: $vgpr0 = COPY [[BITCAST]](<2 x s16>)
534 %0:_(<2 x s64>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
535 %1:_(<2 x s16>) = G_UITOFP %0