1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 4
2 ; RUN: llc -global-isel=0 -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 < %s | FileCheck -check-prefixes=GCN,SDAG %s
3 ; RUN: llc -global-isel=1 -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 < %s | FileCheck -check-prefixes=GCN,GISEL %s
5 define float @sitofp_i128_to_f32(i128 %x) {
6 ; SDAG-LABEL: sitofp_i128_to_f32:
7 ; SDAG: ; %bb.0: ; %itofp-entry
8 ; SDAG-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
9 ; SDAG-NEXT: v_or_b32_e32 v5, v1, v3
10 ; SDAG-NEXT: v_or_b32_e32 v4, v0, v2
11 ; SDAG-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[4:5]
12 ; SDAG-NEXT: v_mov_b32_e32 v4, 0
13 ; SDAG-NEXT: s_and_saveexec_b64 s[6:7], vcc
14 ; SDAG-NEXT: s_cbranch_execz .LBB0_14
15 ; SDAG-NEXT: ; %bb.1: ; %itofp-if-end
16 ; SDAG-NEXT: v_sub_co_u32_e32 v4, vcc, 0, v0
17 ; SDAG-NEXT: v_subb_co_u32_e32 v5, vcc, 0, v1, vcc
18 ; SDAG-NEXT: v_subb_co_u32_e32 v6, vcc, 0, v2, vcc
19 ; SDAG-NEXT: v_subb_co_u32_e32 v7, vcc, 0, v3, vcc
20 ; SDAG-NEXT: v_cmp_gt_i64_e32 vcc, 0, v[2:3]
21 ; SDAG-NEXT: ; implicit-def: $vgpr8
22 ; SDAG-NEXT: v_cndmask_b32_e32 v0, v0, v4, vcc
23 ; SDAG-NEXT: v_cndmask_b32_e32 v4, v2, v6, vcc
24 ; SDAG-NEXT: v_cndmask_b32_e32 v1, v1, v5, vcc
25 ; SDAG-NEXT: v_cndmask_b32_e32 v5, v3, v7, vcc
26 ; SDAG-NEXT: v_ffbh_u32_e32 v2, v4
27 ; SDAG-NEXT: v_add_u32_e32 v2, 32, v2
28 ; SDAG-NEXT: v_ffbh_u32_e32 v6, v5
29 ; SDAG-NEXT: v_min_u32_e32 v2, v2, v6
30 ; SDAG-NEXT: v_ffbh_u32_e32 v6, v0
31 ; SDAG-NEXT: v_add_u32_e32 v6, 32, v6
32 ; SDAG-NEXT: v_ffbh_u32_e32 v7, v1
33 ; SDAG-NEXT: v_min_u32_e32 v6, v6, v7
34 ; SDAG-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[4:5]
35 ; SDAG-NEXT: v_add_u32_e32 v6, 64, v6
36 ; SDAG-NEXT: v_cndmask_b32_e32 v7, v6, v2, vcc
37 ; SDAG-NEXT: v_sub_u32_e32 v6, 0x80, v7
38 ; SDAG-NEXT: v_sub_u32_e32 v2, 0x7f, v7
39 ; SDAG-NEXT: v_cmp_gt_i32_e32 vcc, 25, v6
40 ; SDAG-NEXT: s_and_saveexec_b64 s[4:5], vcc
41 ; SDAG-NEXT: s_xor_b64 s[4:5], exec, s[4:5]
42 ; SDAG-NEXT: ; %bb.2: ; %itofp-if-else
43 ; SDAG-NEXT: v_add_u32_e32 v4, 0xffffff98, v7
44 ; SDAG-NEXT: v_lshlrev_b64 v[0:1], v4, v[0:1]
45 ; SDAG-NEXT: v_cmp_gt_u32_e32 vcc, 64, v4
46 ; SDAG-NEXT: v_cndmask_b32_e32 v8, 0, v0, vcc
47 ; SDAG-NEXT: ; implicit-def: $vgpr6
48 ; SDAG-NEXT: ; implicit-def: $vgpr0_vgpr1
49 ; SDAG-NEXT: ; implicit-def: $vgpr7
50 ; SDAG-NEXT: ; implicit-def: $vgpr4_vgpr5
51 ; SDAG-NEXT: ; %bb.3: ; %Flow3
52 ; SDAG-NEXT: s_andn2_saveexec_b64 s[8:9], s[4:5]
53 ; SDAG-NEXT: s_cbranch_execz .LBB0_13
54 ; SDAG-NEXT: ; %bb.4: ; %NodeBlock
55 ; SDAG-NEXT: v_cmp_lt_i32_e32 vcc, 25, v6
56 ; SDAG-NEXT: s_and_saveexec_b64 s[4:5], vcc
57 ; SDAG-NEXT: s_xor_b64 s[10:11], exec, s[4:5]
58 ; SDAG-NEXT: s_cbranch_execz .LBB0_8
59 ; SDAG-NEXT: ; %bb.5: ; %LeafBlock
60 ; SDAG-NEXT: v_cmp_ne_u32_e32 vcc, 26, v6
61 ; SDAG-NEXT: s_and_saveexec_b64 s[12:13], vcc
62 ; SDAG-NEXT: s_cbranch_execz .LBB0_7
63 ; SDAG-NEXT: ; %bb.6: ; %itofp-sw-default
64 ; SDAG-NEXT: v_sub_u32_e32 v12, 0x66, v7
65 ; SDAG-NEXT: v_sub_u32_e32 v10, 64, v12
66 ; SDAG-NEXT: v_lshrrev_b64 v[8:9], v12, v[0:1]
67 ; SDAG-NEXT: v_lshlrev_b64 v[10:11], v10, v[4:5]
68 ; SDAG-NEXT: v_sub_u32_e32 v13, 38, v7
69 ; SDAG-NEXT: v_or_b32_e32 v11, v9, v11
70 ; SDAG-NEXT: v_or_b32_e32 v10, v8, v10
71 ; SDAG-NEXT: v_lshrrev_b64 v[8:9], v13, v[4:5]
72 ; SDAG-NEXT: v_cmp_gt_u32_e32 vcc, 64, v12
73 ; SDAG-NEXT: v_add_u32_e32 v14, 26, v7
74 ; SDAG-NEXT: v_cndmask_b32_e32 v9, v9, v11, vcc
75 ; SDAG-NEXT: v_cmp_eq_u32_e64 s[4:5], 0, v12
76 ; SDAG-NEXT: v_cndmask_b32_e32 v8, v8, v10, vcc
77 ; SDAG-NEXT: v_lshrrev_b64 v[10:11], v13, v[0:1]
78 ; SDAG-NEXT: v_lshlrev_b64 v[12:13], v14, v[4:5]
79 ; SDAG-NEXT: v_subrev_u32_e32 v7, 38, v7
80 ; SDAG-NEXT: v_cndmask_b32_e64 v15, v8, v0, s[4:5]
81 ; SDAG-NEXT: v_lshlrev_b64 v[7:8], v7, v[0:1]
82 ; SDAG-NEXT: v_cndmask_b32_e64 v9, v9, v1, s[4:5]
83 ; SDAG-NEXT: v_or_b32_e32 v11, v13, v11
84 ; SDAG-NEXT: v_or_b32_e32 v10, v12, v10
85 ; SDAG-NEXT: v_cmp_gt_u32_e32 vcc, 64, v14
86 ; SDAG-NEXT: v_lshlrev_b64 v[0:1], v14, v[0:1]
87 ; SDAG-NEXT: v_cndmask_b32_e32 v8, v8, v11, vcc
88 ; SDAG-NEXT: v_cmp_eq_u32_e64 s[4:5], 0, v14
89 ; SDAG-NEXT: v_cndmask_b32_e32 v7, v7, v10, vcc
90 ; SDAG-NEXT: v_cndmask_b32_e64 v5, v8, v5, s[4:5]
91 ; SDAG-NEXT: v_cndmask_b32_e64 v4, v7, v4, s[4:5]
92 ; SDAG-NEXT: v_cndmask_b32_e32 v1, 0, v1, vcc
93 ; SDAG-NEXT: v_cndmask_b32_e32 v0, 0, v0, vcc
94 ; SDAG-NEXT: v_or_b32_e32 v1, v1, v5
95 ; SDAG-NEXT: v_or_b32_e32 v0, v0, v4
96 ; SDAG-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[0:1]
97 ; SDAG-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc
98 ; SDAG-NEXT: v_or_b32_e32 v8, v15, v0
99 ; SDAG-NEXT: v_mov_b32_e32 v0, v8
100 ; SDAG-NEXT: v_mov_b32_e32 v1, v9
101 ; SDAG-NEXT: .LBB0_7: ; %Flow1
102 ; SDAG-NEXT: s_or_b64 exec, exec, s[12:13]
103 ; SDAG-NEXT: .LBB0_8: ; %Flow2
104 ; SDAG-NEXT: s_andn2_saveexec_b64 s[4:5], s[10:11]
105 ; SDAG-NEXT: ; %bb.9: ; %itofp-sw-bb
106 ; SDAG-NEXT: v_lshlrev_b64 v[0:1], 1, v[0:1]
107 ; SDAG-NEXT: ; %bb.10: ; %itofp-sw-epilog
108 ; SDAG-NEXT: s_or_b64 exec, exec, s[4:5]
109 ; SDAG-NEXT: v_lshrrev_b32_e32 v4, 2, v0
110 ; SDAG-NEXT: v_and_or_b32 v0, v4, 1, v0
111 ; SDAG-NEXT: v_add_co_u32_e32 v0, vcc, 1, v0
112 ; SDAG-NEXT: v_addc_co_u32_e32 v1, vcc, 0, v1, vcc
113 ; SDAG-NEXT: v_and_b32_e32 v4, 0x4000000, v0
114 ; SDAG-NEXT: v_cmp_ne_u32_e32 vcc, 0, v4
115 ; SDAG-NEXT: v_alignbit_b32 v8, v1, v0, 2
116 ; SDAG-NEXT: s_and_saveexec_b64 s[4:5], vcc
117 ; SDAG-NEXT: ; %bb.11: ; %itofp-if-then20
118 ; SDAG-NEXT: v_alignbit_b32 v8, v1, v0, 3
119 ; SDAG-NEXT: v_mov_b32_e32 v2, v6
120 ; SDAG-NEXT: ; %bb.12: ; %Flow
121 ; SDAG-NEXT: s_or_b64 exec, exec, s[4:5]
122 ; SDAG-NEXT: .LBB0_13: ; %Flow4
123 ; SDAG-NEXT: s_or_b64 exec, exec, s[8:9]
124 ; SDAG-NEXT: v_and_b32_e32 v0, 0x80000000, v3
125 ; SDAG-NEXT: v_lshl_add_u32 v1, v2, 23, 1.0
126 ; SDAG-NEXT: v_and_b32_e32 v2, 0x7fffff, v8
127 ; SDAG-NEXT: v_or3_b32 v4, v2, v0, v1
128 ; SDAG-NEXT: .LBB0_14: ; %Flow5
129 ; SDAG-NEXT: s_or_b64 exec, exec, s[6:7]
130 ; SDAG-NEXT: v_mov_b32_e32 v0, v4
131 ; SDAG-NEXT: s_setpc_b64 s[30:31]
133 ; GISEL-LABEL: sitofp_i128_to_f32:
134 ; GISEL: ; %bb.0: ; %itofp-entry
135 ; GISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
136 ; GISEL-NEXT: v_or_b32_e32 v4, v0, v2
137 ; GISEL-NEXT: v_or_b32_e32 v5, v1, v3
138 ; GISEL-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[4:5]
139 ; GISEL-NEXT: s_mov_b32 s4, 0
140 ; GISEL-NEXT: v_mov_b32_e32 v4, s4
141 ; GISEL-NEXT: s_and_saveexec_b64 s[6:7], vcc
142 ; GISEL-NEXT: s_cbranch_execz .LBB0_14
143 ; GISEL-NEXT: ; %bb.1: ; %itofp-if-end
144 ; GISEL-NEXT: v_ashrrev_i32_e32 v6, 31, v3
145 ; GISEL-NEXT: v_xor_b32_e32 v0, v6, v0
146 ; GISEL-NEXT: v_xor_b32_e32 v1, v6, v1
147 ; GISEL-NEXT: v_sub_co_u32_e32 v0, vcc, v0, v6
148 ; GISEL-NEXT: v_xor_b32_e32 v2, v6, v2
149 ; GISEL-NEXT: v_subb_co_u32_e32 v1, vcc, v1, v6, vcc
150 ; GISEL-NEXT: v_xor_b32_e32 v3, v6, v3
151 ; GISEL-NEXT: v_subb_co_u32_e32 v2, vcc, v2, v6, vcc
152 ; GISEL-NEXT: v_ffbh_u32_e32 v5, v0
153 ; GISEL-NEXT: v_subb_co_u32_e32 v3, vcc, v3, v6, vcc
154 ; GISEL-NEXT: v_ffbh_u32_e32 v4, v1
155 ; GISEL-NEXT: v_add_u32_e32 v5, 32, v5
156 ; GISEL-NEXT: v_ffbh_u32_e32 v7, v2
157 ; GISEL-NEXT: v_min_u32_e32 v4, v4, v5
158 ; GISEL-NEXT: v_ffbh_u32_e32 v5, v3
159 ; GISEL-NEXT: v_add_u32_e32 v7, 32, v7
160 ; GISEL-NEXT: v_cmp_eq_u64_e32 vcc, 0, v[2:3]
161 ; GISEL-NEXT: v_add_u32_e32 v4, 64, v4
162 ; GISEL-NEXT: v_min_u32_e32 v5, v5, v7
163 ; GISEL-NEXT: v_cndmask_b32_e32 v5, v5, v4, vcc
164 ; GISEL-NEXT: v_sub_u32_e32 v8, 0x80, v5
165 ; GISEL-NEXT: v_sub_u32_e32 v7, 0x7f, v5
166 ; GISEL-NEXT: v_cmp_ge_i32_e32 vcc, 24, v8
167 ; GISEL-NEXT: ; implicit-def: $vgpr4
168 ; GISEL-NEXT: s_and_saveexec_b64 s[4:5], vcc
169 ; GISEL-NEXT: s_xor_b64 s[4:5], exec, s[4:5]
170 ; GISEL-NEXT: ; %bb.2: ; %itofp-if-else
171 ; GISEL-NEXT: v_add_u32_e32 v2, 0xffffff98, v5
172 ; GISEL-NEXT: v_lshlrev_b64 v[0:1], v2, v[0:1]
173 ; GISEL-NEXT: v_cmp_gt_u32_e32 vcc, 64, v2
174 ; GISEL-NEXT: v_cndmask_b32_e32 v4, 0, v0, vcc
175 ; GISEL-NEXT: ; implicit-def: $vgpr8
176 ; GISEL-NEXT: ; implicit-def: $vgpr0
177 ; GISEL-NEXT: ; implicit-def: $vgpr5
178 ; GISEL-NEXT: ; implicit-def: $vgpr2
179 ; GISEL-NEXT: ; %bb.3: ; %Flow3
180 ; GISEL-NEXT: s_andn2_saveexec_b64 s[8:9], s[4:5]
181 ; GISEL-NEXT: s_cbranch_execz .LBB0_13
182 ; GISEL-NEXT: ; %bb.4: ; %NodeBlock
183 ; GISEL-NEXT: v_cmp_le_i32_e32 vcc, 26, v8
184 ; GISEL-NEXT: s_and_saveexec_b64 s[4:5], vcc
185 ; GISEL-NEXT: s_xor_b64 s[10:11], exec, s[4:5]
186 ; GISEL-NEXT: s_cbranch_execz .LBB0_8
187 ; GISEL-NEXT: ; %bb.5: ; %LeafBlock
188 ; GISEL-NEXT: v_cmp_ne_u32_e32 vcc, 26, v8
189 ; GISEL-NEXT: s_and_saveexec_b64 s[12:13], vcc
190 ; GISEL-NEXT: s_cbranch_execz .LBB0_7
191 ; GISEL-NEXT: ; %bb.6: ; %itofp-sw-default
192 ; GISEL-NEXT: v_sub_u32_e32 v4, 0x66, v5
193 ; GISEL-NEXT: v_sub_u32_e32 v11, 64, v4
194 ; GISEL-NEXT: v_lshrrev_b64 v[9:10], v4, v[0:1]
195 ; GISEL-NEXT: v_lshlrev_b64 v[11:12], v11, v[2:3]
196 ; GISEL-NEXT: v_subrev_u32_e32 v13, 64, v4
197 ; GISEL-NEXT: v_or_b32_e32 v11, v9, v11
198 ; GISEL-NEXT: v_or_b32_e32 v12, v10, v12
199 ; GISEL-NEXT: v_lshrrev_b64 v[9:10], v13, v[2:3]
200 ; GISEL-NEXT: v_cmp_gt_u32_e32 vcc, 64, v4
201 ; GISEL-NEXT: v_add_u32_e32 v5, 26, v5
202 ; GISEL-NEXT: v_cndmask_b32_e32 v9, v9, v11, vcc
203 ; GISEL-NEXT: v_cndmask_b32_e32 v10, v10, v12, vcc
204 ; GISEL-NEXT: v_cmp_eq_u32_e32 vcc, 0, v4
205 ; GISEL-NEXT: v_sub_u32_e32 v11, 64, v5
206 ; GISEL-NEXT: v_cndmask_b32_e32 v13, v9, v0, vcc
207 ; GISEL-NEXT: v_cndmask_b32_e32 v4, v10, v1, vcc
208 ; GISEL-NEXT: v_lshrrev_b64 v[9:10], v5, -1
209 ; GISEL-NEXT: v_lshlrev_b64 v[11:12], v11, -1
210 ; GISEL-NEXT: v_subrev_u32_e32 v14, 64, v5
211 ; GISEL-NEXT: v_or_b32_e32 v15, v9, v11
212 ; GISEL-NEXT: v_or_b32_e32 v16, v10, v12
213 ; GISEL-NEXT: v_lshrrev_b64 v[11:12], v14, -1
214 ; GISEL-NEXT: v_cmp_gt_u32_e32 vcc, 64, v5
215 ; GISEL-NEXT: v_cndmask_b32_e32 v11, v11, v15, vcc
216 ; GISEL-NEXT: v_cndmask_b32_e32 v12, v12, v16, vcc
217 ; GISEL-NEXT: v_cmp_eq_u32_e64 s[4:5], 0, v5
218 ; GISEL-NEXT: v_cndmask_b32_e32 v9, 0, v9, vcc
219 ; GISEL-NEXT: v_cndmask_b32_e32 v10, 0, v10, vcc
220 ; GISEL-NEXT: v_cndmask_b32_e64 v5, v11, -1, s[4:5]
221 ; GISEL-NEXT: v_cndmask_b32_e64 v11, v12, -1, s[4:5]
222 ; GISEL-NEXT: v_and_b32_e32 v2, v9, v2
223 ; GISEL-NEXT: v_and_b32_e32 v3, v10, v3
224 ; GISEL-NEXT: v_and_or_b32 v0, v5, v0, v2
225 ; GISEL-NEXT: v_and_or_b32 v1, v11, v1, v3
226 ; GISEL-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[0:1]
227 ; GISEL-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc
228 ; GISEL-NEXT: v_or_b32_e32 v3, v13, v0
229 ; GISEL-NEXT: v_mov_b32_e32 v0, v3
230 ; GISEL-NEXT: v_mov_b32_e32 v1, v4
231 ; GISEL-NEXT: v_mov_b32_e32 v2, v5
232 ; GISEL-NEXT: v_mov_b32_e32 v3, v6
233 ; GISEL-NEXT: .LBB0_7: ; %Flow1
234 ; GISEL-NEXT: s_or_b64 exec, exec, s[12:13]
235 ; GISEL-NEXT: .LBB0_8: ; %Flow2
236 ; GISEL-NEXT: s_andn2_saveexec_b64 s[4:5], s[10:11]
237 ; GISEL-NEXT: ; %bb.9: ; %itofp-sw-bb
238 ; GISEL-NEXT: v_lshlrev_b64 v[0:1], 1, v[0:1]
239 ; GISEL-NEXT: ; %bb.10: ; %itofp-sw-epilog
240 ; GISEL-NEXT: s_or_b64 exec, exec, s[4:5]
241 ; GISEL-NEXT: v_bfe_u32 v2, v0, 2, 1
242 ; GISEL-NEXT: v_or_b32_e32 v0, v0, v2
243 ; GISEL-NEXT: v_add_co_u32_e32 v0, vcc, 1, v0
244 ; GISEL-NEXT: v_addc_co_u32_e32 v1, vcc, 0, v1, vcc
245 ; GISEL-NEXT: v_and_b32_e32 v2, 0x4000000, v0
246 ; GISEL-NEXT: v_mov_b32_e32 v3, 0
247 ; GISEL-NEXT: v_lshrrev_b64 v[4:5], 2, v[0:1]
248 ; GISEL-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[2:3]
249 ; GISEL-NEXT: s_and_saveexec_b64 s[4:5], vcc
250 ; GISEL-NEXT: ; %bb.11: ; %itofp-if-then20
251 ; GISEL-NEXT: v_lshrrev_b64 v[4:5], 3, v[0:1]
252 ; GISEL-NEXT: v_mov_b32_e32 v7, v8
253 ; GISEL-NEXT: ; %bb.12: ; %Flow
254 ; GISEL-NEXT: s_or_b64 exec, exec, s[4:5]
255 ; GISEL-NEXT: .LBB0_13: ; %Flow4
256 ; GISEL-NEXT: s_or_b64 exec, exec, s[8:9]
257 ; GISEL-NEXT: v_and_b32_e32 v0, 0x80000000, v6
258 ; GISEL-NEXT: v_lshl_add_u32 v1, v7, 23, 1.0
259 ; GISEL-NEXT: v_and_b32_e32 v2, 0x7fffff, v4
260 ; GISEL-NEXT: v_or3_b32 v4, v2, v0, v1
261 ; GISEL-NEXT: .LBB0_14: ; %Flow5
262 ; GISEL-NEXT: s_or_b64 exec, exec, s[6:7]
263 ; GISEL-NEXT: v_mov_b32_e32 v0, v4
264 ; GISEL-NEXT: s_setpc_b64 s[30:31]
265 %cvt = sitofp i128 %x to float
269 define float @uitofp_i128_to_f32(i128 %x) {
270 ; SDAG-LABEL: uitofp_i128_to_f32:
271 ; SDAG: ; %bb.0: ; %itofp-entry
272 ; SDAG-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
273 ; SDAG-NEXT: v_or_b32_e32 v5, v1, v3
274 ; SDAG-NEXT: v_or_b32_e32 v4, v0, v2
275 ; SDAG-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[4:5]
276 ; SDAG-NEXT: v_mov_b32_e32 v4, 0
277 ; SDAG-NEXT: s_and_saveexec_b64 s[6:7], vcc
278 ; SDAG-NEXT: s_cbranch_execz .LBB1_14
279 ; SDAG-NEXT: ; %bb.1: ; %itofp-if-end
280 ; SDAG-NEXT: v_ffbh_u32_e32 v4, v2
281 ; SDAG-NEXT: v_add_u32_e32 v4, 32, v4
282 ; SDAG-NEXT: v_ffbh_u32_e32 v5, v3
283 ; SDAG-NEXT: v_min_u32_e32 v4, v4, v5
284 ; SDAG-NEXT: v_ffbh_u32_e32 v5, v0
285 ; SDAG-NEXT: v_add_u32_e32 v5, 32, v5
286 ; SDAG-NEXT: v_ffbh_u32_e32 v6, v1
287 ; SDAG-NEXT: v_min_u32_e32 v5, v5, v6
288 ; SDAG-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[2:3]
289 ; SDAG-NEXT: v_add_u32_e32 v5, 64, v5
290 ; SDAG-NEXT: v_cndmask_b32_e32 v6, v5, v4, vcc
291 ; SDAG-NEXT: v_sub_u32_e32 v5, 0x80, v6
292 ; SDAG-NEXT: v_sub_u32_e32 v4, 0x7f, v6
293 ; SDAG-NEXT: v_cmp_gt_i32_e32 vcc, 25, v5
294 ; SDAG-NEXT: ; implicit-def: $vgpr7
295 ; SDAG-NEXT: s_and_saveexec_b64 s[4:5], vcc
296 ; SDAG-NEXT: s_xor_b64 s[4:5], exec, s[4:5]
297 ; SDAG-NEXT: ; %bb.2: ; %itofp-if-else
298 ; SDAG-NEXT: v_add_u32_e32 v2, 0xffffff98, v6
299 ; SDAG-NEXT: v_lshlrev_b64 v[0:1], v2, v[0:1]
300 ; SDAG-NEXT: v_cmp_gt_u32_e32 vcc, 64, v2
301 ; SDAG-NEXT: v_cndmask_b32_e32 v7, 0, v0, vcc
302 ; SDAG-NEXT: ; implicit-def: $vgpr5
303 ; SDAG-NEXT: ; implicit-def: $vgpr0_vgpr1
304 ; SDAG-NEXT: ; implicit-def: $vgpr6
305 ; SDAG-NEXT: ; implicit-def: $vgpr2_vgpr3
306 ; SDAG-NEXT: ; %bb.3: ; %Flow3
307 ; SDAG-NEXT: s_andn2_saveexec_b64 s[8:9], s[4:5]
308 ; SDAG-NEXT: s_cbranch_execz .LBB1_13
309 ; SDAG-NEXT: ; %bb.4: ; %NodeBlock
310 ; SDAG-NEXT: v_cmp_lt_i32_e32 vcc, 25, v5
311 ; SDAG-NEXT: s_and_saveexec_b64 s[4:5], vcc
312 ; SDAG-NEXT: s_xor_b64 s[10:11], exec, s[4:5]
313 ; SDAG-NEXT: s_cbranch_execz .LBB1_8
314 ; SDAG-NEXT: ; %bb.5: ; %LeafBlock
315 ; SDAG-NEXT: v_cmp_ne_u32_e32 vcc, 26, v5
316 ; SDAG-NEXT: s_and_saveexec_b64 s[12:13], vcc
317 ; SDAG-NEXT: s_cbranch_execz .LBB1_7
318 ; SDAG-NEXT: ; %bb.6: ; %itofp-sw-default
319 ; SDAG-NEXT: v_sub_u32_e32 v11, 0x66, v6
320 ; SDAG-NEXT: v_sub_u32_e32 v9, 64, v11
321 ; SDAG-NEXT: v_lshrrev_b64 v[7:8], v11, v[0:1]
322 ; SDAG-NEXT: v_lshlrev_b64 v[9:10], v9, v[2:3]
323 ; SDAG-NEXT: v_sub_u32_e32 v12, 38, v6
324 ; SDAG-NEXT: v_or_b32_e32 v10, v8, v10
325 ; SDAG-NEXT: v_or_b32_e32 v9, v7, v9
326 ; SDAG-NEXT: v_lshrrev_b64 v[7:8], v12, v[2:3]
327 ; SDAG-NEXT: v_cmp_gt_u32_e32 vcc, 64, v11
328 ; SDAG-NEXT: v_add_u32_e32 v13, 26, v6
329 ; SDAG-NEXT: v_cndmask_b32_e32 v8, v8, v10, vcc
330 ; SDAG-NEXT: v_cmp_eq_u32_e64 s[4:5], 0, v11
331 ; SDAG-NEXT: v_cndmask_b32_e32 v7, v7, v9, vcc
332 ; SDAG-NEXT: v_lshrrev_b64 v[9:10], v12, v[0:1]
333 ; SDAG-NEXT: v_lshlrev_b64 v[11:12], v13, v[2:3]
334 ; SDAG-NEXT: v_subrev_u32_e32 v6, 38, v6
335 ; SDAG-NEXT: v_cndmask_b32_e64 v14, v7, v0, s[4:5]
336 ; SDAG-NEXT: v_lshlrev_b64 v[6:7], v6, v[0:1]
337 ; SDAG-NEXT: v_cndmask_b32_e64 v8, v8, v1, s[4:5]
338 ; SDAG-NEXT: v_or_b32_e32 v10, v12, v10
339 ; SDAG-NEXT: v_or_b32_e32 v9, v11, v9
340 ; SDAG-NEXT: v_cmp_gt_u32_e32 vcc, 64, v13
341 ; SDAG-NEXT: v_lshlrev_b64 v[0:1], v13, v[0:1]
342 ; SDAG-NEXT: v_cndmask_b32_e32 v7, v7, v10, vcc
343 ; SDAG-NEXT: v_cmp_eq_u32_e64 s[4:5], 0, v13
344 ; SDAG-NEXT: v_cndmask_b32_e32 v6, v6, v9, vcc
345 ; SDAG-NEXT: v_cndmask_b32_e64 v3, v7, v3, s[4:5]
346 ; SDAG-NEXT: v_cndmask_b32_e64 v2, v6, v2, s[4:5]
347 ; SDAG-NEXT: v_cndmask_b32_e32 v1, 0, v1, vcc
348 ; SDAG-NEXT: v_cndmask_b32_e32 v0, 0, v0, vcc
349 ; SDAG-NEXT: v_or_b32_e32 v1, v1, v3
350 ; SDAG-NEXT: v_or_b32_e32 v0, v0, v2
351 ; SDAG-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[0:1]
352 ; SDAG-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc
353 ; SDAG-NEXT: v_or_b32_e32 v7, v14, v0
354 ; SDAG-NEXT: v_mov_b32_e32 v0, v7
355 ; SDAG-NEXT: v_mov_b32_e32 v1, v8
356 ; SDAG-NEXT: .LBB1_7: ; %Flow1
357 ; SDAG-NEXT: s_or_b64 exec, exec, s[12:13]
358 ; SDAG-NEXT: .LBB1_8: ; %Flow2
359 ; SDAG-NEXT: s_andn2_saveexec_b64 s[4:5], s[10:11]
360 ; SDAG-NEXT: ; %bb.9: ; %itofp-sw-bb
361 ; SDAG-NEXT: v_lshlrev_b64 v[0:1], 1, v[0:1]
362 ; SDAG-NEXT: ; %bb.10: ; %itofp-sw-epilog
363 ; SDAG-NEXT: s_or_b64 exec, exec, s[4:5]
364 ; SDAG-NEXT: v_lshrrev_b32_e32 v2, 2, v0
365 ; SDAG-NEXT: v_and_or_b32 v0, v2, 1, v0
366 ; SDAG-NEXT: v_add_co_u32_e32 v0, vcc, 1, v0
367 ; SDAG-NEXT: v_addc_co_u32_e32 v1, vcc, 0, v1, vcc
368 ; SDAG-NEXT: v_and_b32_e32 v2, 0x4000000, v0
369 ; SDAG-NEXT: v_cmp_ne_u32_e32 vcc, 0, v2
370 ; SDAG-NEXT: v_alignbit_b32 v7, v1, v0, 2
371 ; SDAG-NEXT: s_and_saveexec_b64 s[4:5], vcc
372 ; SDAG-NEXT: ; %bb.11: ; %itofp-if-then20
373 ; SDAG-NEXT: v_alignbit_b32 v7, v1, v0, 3
374 ; SDAG-NEXT: v_mov_b32_e32 v4, v5
375 ; SDAG-NEXT: ; %bb.12: ; %Flow
376 ; SDAG-NEXT: s_or_b64 exec, exec, s[4:5]
377 ; SDAG-NEXT: .LBB1_13: ; %Flow4
378 ; SDAG-NEXT: s_or_b64 exec, exec, s[8:9]
379 ; SDAG-NEXT: v_and_b32_e32 v0, 0x7fffff, v7
380 ; SDAG-NEXT: v_lshl_or_b32 v0, v4, 23, v0
381 ; SDAG-NEXT: v_add_u32_e32 v4, 1.0, v0
382 ; SDAG-NEXT: .LBB1_14: ; %Flow5
383 ; SDAG-NEXT: s_or_b64 exec, exec, s[6:7]
384 ; SDAG-NEXT: v_mov_b32_e32 v0, v4
385 ; SDAG-NEXT: s_setpc_b64 s[30:31]
387 ; GISEL-LABEL: uitofp_i128_to_f32:
388 ; GISEL: ; %bb.0: ; %itofp-entry
389 ; GISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
390 ; GISEL-NEXT: v_or_b32_e32 v4, v0, v2
391 ; GISEL-NEXT: v_or_b32_e32 v5, v1, v3
392 ; GISEL-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[4:5]
393 ; GISEL-NEXT: s_mov_b32 s4, 0
394 ; GISEL-NEXT: v_mov_b32_e32 v4, s4
395 ; GISEL-NEXT: s_and_saveexec_b64 s[6:7], vcc
396 ; GISEL-NEXT: s_cbranch_execz .LBB1_14
397 ; GISEL-NEXT: ; %bb.1: ; %itofp-if-end
398 ; GISEL-NEXT: v_ffbh_u32_e32 v5, v0
399 ; GISEL-NEXT: v_ffbh_u32_e32 v4, v1
400 ; GISEL-NEXT: v_add_u32_e32 v5, 32, v5
401 ; GISEL-NEXT: v_ffbh_u32_e32 v6, v2
402 ; GISEL-NEXT: v_min_u32_e32 v4, v4, v5
403 ; GISEL-NEXT: v_ffbh_u32_e32 v5, v3
404 ; GISEL-NEXT: v_add_u32_e32 v6, 32, v6
405 ; GISEL-NEXT: v_cmp_eq_u64_e32 vcc, 0, v[2:3]
406 ; GISEL-NEXT: v_add_u32_e32 v4, 64, v4
407 ; GISEL-NEXT: v_min_u32_e32 v5, v5, v6
408 ; GISEL-NEXT: v_cndmask_b32_e32 v5, v5, v4, vcc
409 ; GISEL-NEXT: v_sub_u32_e32 v7, 0x80, v5
410 ; GISEL-NEXT: v_sub_u32_e32 v6, 0x7f, v5
411 ; GISEL-NEXT: v_cmp_ge_i32_e32 vcc, 24, v7
412 ; GISEL-NEXT: ; implicit-def: $vgpr4
413 ; GISEL-NEXT: s_and_saveexec_b64 s[4:5], vcc
414 ; GISEL-NEXT: s_xor_b64 s[4:5], exec, s[4:5]
415 ; GISEL-NEXT: ; %bb.2: ; %itofp-if-else
416 ; GISEL-NEXT: v_add_u32_e32 v2, 0xffffff98, v5
417 ; GISEL-NEXT: v_lshlrev_b64 v[0:1], v2, v[0:1]
418 ; GISEL-NEXT: v_cmp_gt_u32_e32 vcc, 64, v2
419 ; GISEL-NEXT: v_cndmask_b32_e32 v4, 0, v0, vcc
420 ; GISEL-NEXT: ; implicit-def: $vgpr7
421 ; GISEL-NEXT: ; implicit-def: $vgpr0
422 ; GISEL-NEXT: ; implicit-def: $vgpr5
423 ; GISEL-NEXT: ; implicit-def: $vgpr2
424 ; GISEL-NEXT: ; %bb.3: ; %Flow3
425 ; GISEL-NEXT: s_andn2_saveexec_b64 s[8:9], s[4:5]
426 ; GISEL-NEXT: s_cbranch_execz .LBB1_13
427 ; GISEL-NEXT: ; %bb.4: ; %NodeBlock
428 ; GISEL-NEXT: v_cmp_le_i32_e32 vcc, 26, v7
429 ; GISEL-NEXT: s_and_saveexec_b64 s[4:5], vcc
430 ; GISEL-NEXT: s_xor_b64 s[10:11], exec, s[4:5]
431 ; GISEL-NEXT: s_cbranch_execz .LBB1_8
432 ; GISEL-NEXT: ; %bb.5: ; %LeafBlock
433 ; GISEL-NEXT: v_cmp_ne_u32_e32 vcc, 26, v7
434 ; GISEL-NEXT: s_and_saveexec_b64 s[12:13], vcc
435 ; GISEL-NEXT: s_cbranch_execz .LBB1_7
436 ; GISEL-NEXT: ; %bb.6: ; %itofp-sw-default
437 ; GISEL-NEXT: v_sub_u32_e32 v4, 0x66, v5
438 ; GISEL-NEXT: v_sub_u32_e32 v10, 64, v4
439 ; GISEL-NEXT: v_lshrrev_b64 v[8:9], v4, v[0:1]
440 ; GISEL-NEXT: v_lshlrev_b64 v[10:11], v10, v[2:3]
441 ; GISEL-NEXT: v_subrev_u32_e32 v12, 64, v4
442 ; GISEL-NEXT: v_or_b32_e32 v10, v8, v10
443 ; GISEL-NEXT: v_or_b32_e32 v11, v9, v11
444 ; GISEL-NEXT: v_lshrrev_b64 v[8:9], v12, v[2:3]
445 ; GISEL-NEXT: v_cmp_gt_u32_e32 vcc, 64, v4
446 ; GISEL-NEXT: v_add_u32_e32 v5, 26, v5
447 ; GISEL-NEXT: v_cndmask_b32_e32 v8, v8, v10, vcc
448 ; GISEL-NEXT: v_cndmask_b32_e32 v9, v9, v11, vcc
449 ; GISEL-NEXT: v_cmp_eq_u32_e32 vcc, 0, v4
450 ; GISEL-NEXT: v_sub_u32_e32 v10, 64, v5
451 ; GISEL-NEXT: v_cndmask_b32_e32 v12, v8, v0, vcc
452 ; GISEL-NEXT: v_cndmask_b32_e32 v4, v9, v1, vcc
453 ; GISEL-NEXT: v_lshrrev_b64 v[8:9], v5, -1
454 ; GISEL-NEXT: v_lshlrev_b64 v[10:11], v10, -1
455 ; GISEL-NEXT: v_subrev_u32_e32 v13, 64, v5
456 ; GISEL-NEXT: v_or_b32_e32 v14, v8, v10
457 ; GISEL-NEXT: v_or_b32_e32 v15, v9, v11
458 ; GISEL-NEXT: v_lshrrev_b64 v[10:11], v13, -1
459 ; GISEL-NEXT: v_cmp_gt_u32_e32 vcc, 64, v5
460 ; GISEL-NEXT: v_cndmask_b32_e32 v10, v10, v14, vcc
461 ; GISEL-NEXT: v_cndmask_b32_e32 v11, v11, v15, vcc
462 ; GISEL-NEXT: v_cmp_eq_u32_e64 s[4:5], 0, v5
463 ; GISEL-NEXT: v_cndmask_b32_e32 v8, 0, v8, vcc
464 ; GISEL-NEXT: v_cndmask_b32_e32 v9, 0, v9, vcc
465 ; GISEL-NEXT: v_cndmask_b32_e64 v5, v10, -1, s[4:5]
466 ; GISEL-NEXT: v_cndmask_b32_e64 v10, v11, -1, s[4:5]
467 ; GISEL-NEXT: v_and_b32_e32 v2, v8, v2
468 ; GISEL-NEXT: v_and_b32_e32 v3, v9, v3
469 ; GISEL-NEXT: v_and_or_b32 v0, v5, v0, v2
470 ; GISEL-NEXT: v_and_or_b32 v1, v10, v1, v3
471 ; GISEL-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[0:1]
472 ; GISEL-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc
473 ; GISEL-NEXT: v_or_b32_e32 v3, v12, v0
474 ; GISEL-NEXT: v_mov_b32_e32 v0, v3
475 ; GISEL-NEXT: v_mov_b32_e32 v1, v4
476 ; GISEL-NEXT: v_mov_b32_e32 v2, v5
477 ; GISEL-NEXT: v_mov_b32_e32 v3, v6
478 ; GISEL-NEXT: .LBB1_7: ; %Flow1
479 ; GISEL-NEXT: s_or_b64 exec, exec, s[12:13]
480 ; GISEL-NEXT: .LBB1_8: ; %Flow2
481 ; GISEL-NEXT: s_andn2_saveexec_b64 s[4:5], s[10:11]
482 ; GISEL-NEXT: ; %bb.9: ; %itofp-sw-bb
483 ; GISEL-NEXT: v_lshlrev_b64 v[0:1], 1, v[0:1]
484 ; GISEL-NEXT: ; %bb.10: ; %itofp-sw-epilog
485 ; GISEL-NEXT: s_or_b64 exec, exec, s[4:5]
486 ; GISEL-NEXT: v_bfe_u32 v2, v0, 2, 1
487 ; GISEL-NEXT: v_or_b32_e32 v0, v0, v2
488 ; GISEL-NEXT: v_add_co_u32_e32 v0, vcc, 1, v0
489 ; GISEL-NEXT: v_addc_co_u32_e32 v1, vcc, 0, v1, vcc
490 ; GISEL-NEXT: v_and_b32_e32 v2, 0x4000000, v0
491 ; GISEL-NEXT: v_mov_b32_e32 v3, 0
492 ; GISEL-NEXT: v_lshrrev_b64 v[4:5], 2, v[0:1]
493 ; GISEL-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[2:3]
494 ; GISEL-NEXT: s_and_saveexec_b64 s[4:5], vcc
495 ; GISEL-NEXT: ; %bb.11: ; %itofp-if-then20
496 ; GISEL-NEXT: v_lshrrev_b64 v[4:5], 3, v[0:1]
497 ; GISEL-NEXT: v_mov_b32_e32 v6, v7
498 ; GISEL-NEXT: ; %bb.12: ; %Flow
499 ; GISEL-NEXT: s_or_b64 exec, exec, s[4:5]
500 ; GISEL-NEXT: .LBB1_13: ; %Flow4
501 ; GISEL-NEXT: s_or_b64 exec, exec, s[8:9]
502 ; GISEL-NEXT: v_lshl_add_u32 v0, v6, 23, 1.0
503 ; GISEL-NEXT: v_mov_b32_e32 v1, 0x7fffff
504 ; GISEL-NEXT: v_and_or_b32 v4, v4, v1, v0
505 ; GISEL-NEXT: .LBB1_14: ; %Flow5
506 ; GISEL-NEXT: s_or_b64 exec, exec, s[6:7]
507 ; GISEL-NEXT: v_mov_b32_e32 v0, v4
508 ; GISEL-NEXT: s_setpc_b64 s[30:31]
509 %cvt = uitofp i128 %x to float
513 define double @sitofp_i128_to_f64(i128 %x) {
514 ; SDAG-LABEL: sitofp_i128_to_f64:
515 ; SDAG: ; %bb.0: ; %itofp-entry
516 ; SDAG-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
517 ; SDAG-NEXT: v_mov_b32_e32 v5, v1
518 ; SDAG-NEXT: v_mov_b32_e32 v4, v0
519 ; SDAG-NEXT: v_or_b32_e32 v1, v5, v3
520 ; SDAG-NEXT: v_or_b32_e32 v0, v4, v2
521 ; SDAG-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[0:1]
522 ; SDAG-NEXT: v_mov_b32_e32 v0, 0
523 ; SDAG-NEXT: v_mov_b32_e32 v1, 0
524 ; SDAG-NEXT: s_and_saveexec_b64 s[6:7], vcc
525 ; SDAG-NEXT: s_cbranch_execz .LBB2_14
526 ; SDAG-NEXT: ; %bb.1: ; %itofp-if-end
527 ; SDAG-NEXT: v_sub_co_u32_e32 v0, vcc, 0, v4
528 ; SDAG-NEXT: v_subb_co_u32_e32 v1, vcc, 0, v5, vcc
529 ; SDAG-NEXT: v_subb_co_u32_e32 v6, vcc, 0, v2, vcc
530 ; SDAG-NEXT: v_subb_co_u32_e32 v7, vcc, 0, v3, vcc
531 ; SDAG-NEXT: v_cmp_gt_i64_e32 vcc, 0, v[2:3]
532 ; SDAG-NEXT: ; implicit-def: $vgpr10
533 ; SDAG-NEXT: v_cndmask_b32_e32 v6, v2, v6, vcc
534 ; SDAG-NEXT: v_cndmask_b32_e32 v4, v4, v0, vcc
535 ; SDAG-NEXT: v_cndmask_b32_e32 v7, v3, v7, vcc
536 ; SDAG-NEXT: v_ffbh_u32_e32 v0, v6
537 ; SDAG-NEXT: v_cndmask_b32_e32 v5, v5, v1, vcc
538 ; SDAG-NEXT: v_add_u32_e32 v0, 32, v0
539 ; SDAG-NEXT: v_ffbh_u32_e32 v1, v7
540 ; SDAG-NEXT: v_min_u32_e32 v0, v0, v1
541 ; SDAG-NEXT: v_ffbh_u32_e32 v1, v4
542 ; SDAG-NEXT: v_add_u32_e32 v1, 32, v1
543 ; SDAG-NEXT: v_ffbh_u32_e32 v2, v5
544 ; SDAG-NEXT: v_min_u32_e32 v1, v1, v2
545 ; SDAG-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[6:7]
546 ; SDAG-NEXT: v_add_u32_e32 v1, 64, v1
547 ; SDAG-NEXT: v_cndmask_b32_e32 v9, v1, v0, vcc
548 ; SDAG-NEXT: v_sub_u32_e32 v8, 0x80, v9
549 ; SDAG-NEXT: v_sub_u32_e32 v2, 0x7f, v9
550 ; SDAG-NEXT: v_cmp_gt_i32_e32 vcc, 54, v8
551 ; SDAG-NEXT: ; implicit-def: $vgpr0_vgpr1
552 ; SDAG-NEXT: s_and_saveexec_b64 s[4:5], vcc
553 ; SDAG-NEXT: s_xor_b64 s[4:5], exec, s[4:5]
554 ; SDAG-NEXT: ; %bb.2: ; %itofp-if-else
555 ; SDAG-NEXT: v_add_u32_e32 v6, 0xffffffb5, v9
556 ; SDAG-NEXT: v_lshlrev_b64 v[0:1], v6, v[4:5]
557 ; SDAG-NEXT: v_cmp_gt_u32_e32 vcc, 64, v6
558 ; SDAG-NEXT: v_cndmask_b32_e32 v10, 0, v1, vcc
559 ; SDAG-NEXT: v_cndmask_b32_e32 v0, 0, v0, vcc
560 ; SDAG-NEXT: ; implicit-def: $vgpr8
561 ; SDAG-NEXT: ; implicit-def: $vgpr6_vgpr7
562 ; SDAG-NEXT: ; implicit-def: $vgpr4_vgpr5
563 ; SDAG-NEXT: ; implicit-def: $vgpr9
564 ; SDAG-NEXT: ; %bb.3: ; %Flow3
565 ; SDAG-NEXT: s_andn2_saveexec_b64 s[8:9], s[4:5]
566 ; SDAG-NEXT: s_cbranch_execz .LBB2_13
567 ; SDAG-NEXT: ; %bb.4: ; %NodeBlock
568 ; SDAG-NEXT: v_cmp_lt_i32_e32 vcc, 54, v8
569 ; SDAG-NEXT: s_and_saveexec_b64 s[4:5], vcc
570 ; SDAG-NEXT: s_xor_b64 s[10:11], exec, s[4:5]
571 ; SDAG-NEXT: s_cbranch_execz .LBB2_8
572 ; SDAG-NEXT: ; %bb.5: ; %LeafBlock
573 ; SDAG-NEXT: v_cmp_ne_u32_e32 vcc, 55, v8
574 ; SDAG-NEXT: s_and_saveexec_b64 s[12:13], vcc
575 ; SDAG-NEXT: s_cbranch_execz .LBB2_7
576 ; SDAG-NEXT: ; %bb.6: ; %itofp-sw-default
577 ; SDAG-NEXT: v_sub_u32_e32 v12, 0x49, v9
578 ; SDAG-NEXT: v_sub_u32_e32 v10, 64, v12
579 ; SDAG-NEXT: v_lshrrev_b64 v[0:1], v12, v[4:5]
580 ; SDAG-NEXT: v_lshlrev_b64 v[10:11], v10, v[6:7]
581 ; SDAG-NEXT: v_sub_u32_e32 v13, 9, v9
582 ; SDAG-NEXT: v_or_b32_e32 v11, v1, v11
583 ; SDAG-NEXT: v_or_b32_e32 v10, v0, v10
584 ; SDAG-NEXT: v_lshrrev_b64 v[0:1], v13, v[6:7]
585 ; SDAG-NEXT: v_cmp_gt_u32_e32 vcc, 64, v12
586 ; SDAG-NEXT: v_add_u32_e32 v16, 55, v9
587 ; SDAG-NEXT: v_cndmask_b32_e32 v1, v1, v11, vcc
588 ; SDAG-NEXT: v_cmp_eq_u32_e64 s[4:5], 0, v12
589 ; SDAG-NEXT: v_cndmask_b32_e32 v0, v0, v10, vcc
590 ; SDAG-NEXT: v_lshrrev_b64 v[10:11], v12, v[6:7]
591 ; SDAG-NEXT: v_lshrrev_b64 v[12:13], v13, v[4:5]
592 ; SDAG-NEXT: v_lshlrev_b64 v[14:15], v16, v[6:7]
593 ; SDAG-NEXT: v_add_u32_e32 v9, -9, v9
594 ; SDAG-NEXT: v_or_b32_e32 v15, v15, v13
595 ; SDAG-NEXT: v_or_b32_e32 v14, v14, v12
596 ; SDAG-NEXT: v_lshlrev_b64 v[12:13], v9, v[4:5]
597 ; SDAG-NEXT: v_cndmask_b32_e32 v11, 0, v11, vcc
598 ; SDAG-NEXT: v_cndmask_b32_e32 v10, 0, v10, vcc
599 ; SDAG-NEXT: v_cmp_gt_u32_e32 vcc, 64, v16
600 ; SDAG-NEXT: v_cndmask_b32_e64 v1, v1, v5, s[4:5]
601 ; SDAG-NEXT: v_cndmask_b32_e64 v0, v0, v4, s[4:5]
602 ; SDAG-NEXT: v_cndmask_b32_e32 v9, v13, v15, vcc
603 ; SDAG-NEXT: v_cmp_eq_u32_e64 s[4:5], 0, v16
604 ; SDAG-NEXT: v_lshlrev_b64 v[4:5], v16, v[4:5]
605 ; SDAG-NEXT: v_cndmask_b32_e64 v7, v9, v7, s[4:5]
606 ; SDAG-NEXT: v_cndmask_b32_e32 v9, v12, v14, vcc
607 ; SDAG-NEXT: v_cndmask_b32_e64 v6, v9, v6, s[4:5]
608 ; SDAG-NEXT: v_cndmask_b32_e32 v5, 0, v5, vcc
609 ; SDAG-NEXT: v_cndmask_b32_e32 v4, 0, v4, vcc
610 ; SDAG-NEXT: v_or_b32_e32 v5, v5, v7
611 ; SDAG-NEXT: v_or_b32_e32 v4, v4, v6
612 ; SDAG-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[4:5]
613 ; SDAG-NEXT: v_mov_b32_e32 v6, v10
614 ; SDAG-NEXT: v_cndmask_b32_e64 v4, 0, 1, vcc
615 ; SDAG-NEXT: v_or_b32_e32 v0, v0, v4
616 ; SDAG-NEXT: v_mov_b32_e32 v5, v1
617 ; SDAG-NEXT: v_mov_b32_e32 v4, v0
618 ; SDAG-NEXT: v_mov_b32_e32 v7, v11
619 ; SDAG-NEXT: .LBB2_7: ; %Flow1
620 ; SDAG-NEXT: s_or_b64 exec, exec, s[12:13]
621 ; SDAG-NEXT: .LBB2_8: ; %Flow2
622 ; SDAG-NEXT: s_andn2_saveexec_b64 s[4:5], s[10:11]
623 ; SDAG-NEXT: ; %bb.9: ; %itofp-sw-bb
624 ; SDAG-NEXT: v_lshlrev_b64 v[6:7], 1, v[6:7]
625 ; SDAG-NEXT: v_lshrrev_b32_e32 v0, 31, v5
626 ; SDAG-NEXT: v_lshlrev_b64 v[4:5], 1, v[4:5]
627 ; SDAG-NEXT: v_or_b32_e32 v6, v6, v0
628 ; SDAG-NEXT: ; %bb.10: ; %itofp-sw-epilog
629 ; SDAG-NEXT: s_or_b64 exec, exec, s[4:5]
630 ; SDAG-NEXT: v_lshrrev_b32_e32 v0, 2, v4
631 ; SDAG-NEXT: v_and_or_b32 v0, v0, 1, v4
632 ; SDAG-NEXT: v_add_co_u32_e32 v4, vcc, 1, v0
633 ; SDAG-NEXT: v_addc_co_u32_e32 v5, vcc, 0, v5, vcc
634 ; SDAG-NEXT: v_addc_co_u32_e32 v6, vcc, 0, v6, vcc
635 ; SDAG-NEXT: v_lshrrev_b64 v[0:1], 2, v[4:5]
636 ; SDAG-NEXT: v_lshlrev_b32_e32 v7, 30, v6
637 ; SDAG-NEXT: v_or_b32_e32 v10, v1, v7
638 ; SDAG-NEXT: v_and_b32_e32 v1, 0x800000, v5
639 ; SDAG-NEXT: v_cmp_ne_u32_e32 vcc, 0, v1
640 ; SDAG-NEXT: s_and_saveexec_b64 s[4:5], vcc
641 ; SDAG-NEXT: ; %bb.11: ; %itofp-if-then20
642 ; SDAG-NEXT: v_lshrrev_b64 v[0:1], 3, v[4:5]
643 ; SDAG-NEXT: v_lshlrev_b32_e32 v2, 29, v6
644 ; SDAG-NEXT: v_or_b32_e32 v10, v1, v2
645 ; SDAG-NEXT: v_mov_b32_e32 v2, v8
646 ; SDAG-NEXT: ; %bb.12: ; %Flow
647 ; SDAG-NEXT: s_or_b64 exec, exec, s[4:5]
648 ; SDAG-NEXT: .LBB2_13: ; %Flow4
649 ; SDAG-NEXT: s_or_b64 exec, exec, s[8:9]
650 ; SDAG-NEXT: v_and_b32_e32 v1, 0x80000000, v3
651 ; SDAG-NEXT: v_mov_b32_e32 v3, 0x3ff00000
652 ; SDAG-NEXT: v_lshl_add_u32 v2, v2, 20, v3
653 ; SDAG-NEXT: v_and_b32_e32 v3, 0xfffff, v10
654 ; SDAG-NEXT: v_or3_b32 v1, v3, v1, v2
655 ; SDAG-NEXT: .LBB2_14: ; %Flow5
656 ; SDAG-NEXT: s_or_b64 exec, exec, s[6:7]
657 ; SDAG-NEXT: s_setpc_b64 s[30:31]
659 ; GISEL-LABEL: sitofp_i128_to_f64:
660 ; GISEL: ; %bb.0: ; %itofp-entry
661 ; GISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
662 ; GISEL-NEXT: v_mov_b32_e32 v4, v0
663 ; GISEL-NEXT: v_mov_b32_e32 v5, v1
664 ; GISEL-NEXT: s_mov_b64 s[4:5], 0
665 ; GISEL-NEXT: v_or_b32_e32 v0, v4, v2
666 ; GISEL-NEXT: v_or_b32_e32 v1, v5, v3
667 ; GISEL-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[0:1]
668 ; GISEL-NEXT: v_mov_b32_e32 v0, s4
669 ; GISEL-NEXT: v_mov_b32_e32 v1, s5
670 ; GISEL-NEXT: s_and_saveexec_b64 s[6:7], vcc
671 ; GISEL-NEXT: s_cbranch_execz .LBB2_14
672 ; GISEL-NEXT: ; %bb.1: ; %itofp-if-end
673 ; GISEL-NEXT: v_ashrrev_i32_e32 v6, 31, v3
674 ; GISEL-NEXT: v_xor_b32_e32 v0, v6, v4
675 ; GISEL-NEXT: v_xor_b32_e32 v1, v6, v5
676 ; GISEL-NEXT: v_sub_co_u32_e32 v0, vcc, v0, v6
677 ; GISEL-NEXT: v_xor_b32_e32 v2, v6, v2
678 ; GISEL-NEXT: v_subb_co_u32_e32 v1, vcc, v1, v6, vcc
679 ; GISEL-NEXT: v_xor_b32_e32 v3, v6, v3
680 ; GISEL-NEXT: v_subb_co_u32_e32 v2, vcc, v2, v6, vcc
681 ; GISEL-NEXT: v_ffbh_u32_e32 v5, v0
682 ; GISEL-NEXT: v_subb_co_u32_e32 v3, vcc, v3, v6, vcc
683 ; GISEL-NEXT: v_ffbh_u32_e32 v4, v1
684 ; GISEL-NEXT: v_add_u32_e32 v5, 32, v5
685 ; GISEL-NEXT: v_ffbh_u32_e32 v7, v2
686 ; GISEL-NEXT: v_min_u32_e32 v4, v4, v5
687 ; GISEL-NEXT: v_ffbh_u32_e32 v5, v3
688 ; GISEL-NEXT: v_add_u32_e32 v7, 32, v7
689 ; GISEL-NEXT: v_cmp_eq_u64_e32 vcc, 0, v[2:3]
690 ; GISEL-NEXT: v_add_u32_e32 v4, 64, v4
691 ; GISEL-NEXT: v_min_u32_e32 v5, v5, v7
692 ; GISEL-NEXT: v_cndmask_b32_e32 v9, v5, v4, vcc
693 ; GISEL-NEXT: v_sub_u32_e32 v8, 0x80, v9
694 ; GISEL-NEXT: v_sub_u32_e32 v7, 0x7f, v9
695 ; GISEL-NEXT: v_cmp_ge_i32_e32 vcc, 53, v8
696 ; GISEL-NEXT: ; implicit-def: $vgpr10
697 ; GISEL-NEXT: ; implicit-def: $vgpr4_vgpr5
698 ; GISEL-NEXT: s_and_saveexec_b64 s[4:5], vcc
699 ; GISEL-NEXT: s_xor_b64 s[4:5], exec, s[4:5]
700 ; GISEL-NEXT: ; %bb.2: ; %itofp-if-else
701 ; GISEL-NEXT: v_add_u32_e32 v2, 0xffffffb5, v9
702 ; GISEL-NEXT: v_lshlrev_b64 v[0:1], v2, v[0:1]
703 ; GISEL-NEXT: v_cmp_gt_u32_e32 vcc, 64, v2
704 ; GISEL-NEXT: v_cndmask_b32_e32 v4, 0, v0, vcc
705 ; GISEL-NEXT: v_cndmask_b32_e32 v10, 0, v1, vcc
706 ; GISEL-NEXT: ; implicit-def: $vgpr8
707 ; GISEL-NEXT: ; implicit-def: $vgpr0
708 ; GISEL-NEXT: ; implicit-def: $vgpr9
709 ; GISEL-NEXT: ; %bb.3: ; %Flow3
710 ; GISEL-NEXT: s_andn2_saveexec_b64 s[8:9], s[4:5]
711 ; GISEL-NEXT: s_cbranch_execz .LBB2_13
712 ; GISEL-NEXT: ; %bb.4: ; %NodeBlock
713 ; GISEL-NEXT: v_cmp_le_i32_e32 vcc, 55, v8
714 ; GISEL-NEXT: s_and_saveexec_b64 s[4:5], vcc
715 ; GISEL-NEXT: s_xor_b64 s[10:11], exec, s[4:5]
716 ; GISEL-NEXT: s_cbranch_execz .LBB2_8
717 ; GISEL-NEXT: ; %bb.5: ; %LeafBlock
718 ; GISEL-NEXT: v_cmp_ne_u32_e32 vcc, 55, v8
719 ; GISEL-NEXT: s_and_saveexec_b64 s[12:13], vcc
720 ; GISEL-NEXT: s_cbranch_execz .LBB2_7
721 ; GISEL-NEXT: ; %bb.6: ; %itofp-sw-default
722 ; GISEL-NEXT: v_sub_u32_e32 v14, 0x49, v9
723 ; GISEL-NEXT: v_sub_u32_e32 v10, 64, v14
724 ; GISEL-NEXT: v_lshrrev_b64 v[4:5], v14, v[0:1]
725 ; GISEL-NEXT: v_lshlrev_b64 v[10:11], v10, v[2:3]
726 ; GISEL-NEXT: v_subrev_u32_e32 v15, 64, v14
727 ; GISEL-NEXT: v_or_b32_e32 v10, v4, v10
728 ; GISEL-NEXT: v_or_b32_e32 v11, v5, v11
729 ; GISEL-NEXT: v_lshrrev_b64 v[4:5], v15, v[2:3]
730 ; GISEL-NEXT: v_lshrrev_b64 v[12:13], v14, v[2:3]
731 ; GISEL-NEXT: v_cmp_gt_u32_e32 vcc, 64, v14
732 ; GISEL-NEXT: v_cmp_eq_u32_e64 s[4:5], 0, v14
733 ; GISEL-NEXT: v_add_u32_e32 v14, 55, v9
734 ; GISEL-NEXT: v_cndmask_b32_e32 v4, v4, v10, vcc
735 ; GISEL-NEXT: v_cndmask_b32_e32 v5, v5, v11, vcc
736 ; GISEL-NEXT: v_sub_u32_e32 v11, 64, v14
737 ; GISEL-NEXT: v_cndmask_b32_e64 v13, v4, v0, s[4:5]
738 ; GISEL-NEXT: v_cndmask_b32_e64 v4, v5, v1, s[4:5]
739 ; GISEL-NEXT: v_cndmask_b32_e32 v5, 0, v12, vcc
740 ; GISEL-NEXT: v_lshrrev_b64 v[9:10], v14, -1
741 ; GISEL-NEXT: v_lshlrev_b64 v[11:12], v11, -1
742 ; GISEL-NEXT: v_subrev_u32_e32 v15, 64, v14
743 ; GISEL-NEXT: v_or_b32_e32 v16, v9, v11
744 ; GISEL-NEXT: v_or_b32_e32 v17, v10, v12
745 ; GISEL-NEXT: v_lshrrev_b64 v[11:12], v15, -1
746 ; GISEL-NEXT: v_cmp_gt_u32_e32 vcc, 64, v14
747 ; GISEL-NEXT: v_cndmask_b32_e32 v11, v11, v16, vcc
748 ; GISEL-NEXT: v_cndmask_b32_e32 v12, v12, v17, vcc
749 ; GISEL-NEXT: v_cmp_eq_u32_e64 s[4:5], 0, v14
750 ; GISEL-NEXT: v_cndmask_b32_e32 v9, 0, v9, vcc
751 ; GISEL-NEXT: v_cndmask_b32_e32 v10, 0, v10, vcc
752 ; GISEL-NEXT: v_cndmask_b32_e64 v11, v11, -1, s[4:5]
753 ; GISEL-NEXT: v_cndmask_b32_e64 v12, v12, -1, s[4:5]
754 ; GISEL-NEXT: v_and_b32_e32 v2, v9, v2
755 ; GISEL-NEXT: v_and_b32_e32 v3, v10, v3
756 ; GISEL-NEXT: v_and_or_b32 v0, v11, v0, v2
757 ; GISEL-NEXT: v_and_or_b32 v1, v12, v1, v3
758 ; GISEL-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[0:1]
759 ; GISEL-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc
760 ; GISEL-NEXT: v_or_b32_e32 v3, v13, v0
761 ; GISEL-NEXT: v_mov_b32_e32 v0, v3
762 ; GISEL-NEXT: v_mov_b32_e32 v1, v4
763 ; GISEL-NEXT: v_mov_b32_e32 v2, v5
764 ; GISEL-NEXT: v_mov_b32_e32 v3, v6
765 ; GISEL-NEXT: .LBB2_7: ; %Flow1
766 ; GISEL-NEXT: s_or_b64 exec, exec, s[12:13]
767 ; GISEL-NEXT: .LBB2_8: ; %Flow2
768 ; GISEL-NEXT: s_andn2_saveexec_b64 s[4:5], s[10:11]
769 ; GISEL-NEXT: ; %bb.9: ; %itofp-sw-bb
770 ; GISEL-NEXT: v_lshlrev_b64 v[9:10], 1, v[0:1]
771 ; GISEL-NEXT: v_lshlrev_b64 v[2:3], 1, v[2:3]
772 ; GISEL-NEXT: v_lshrrev_b32_e32 v0, 31, v1
773 ; GISEL-NEXT: v_or_b32_e32 v11, v2, v0
774 ; GISEL-NEXT: v_mov_b32_e32 v0, v9
775 ; GISEL-NEXT: v_mov_b32_e32 v1, v10
776 ; GISEL-NEXT: v_mov_b32_e32 v2, v11
777 ; GISEL-NEXT: v_mov_b32_e32 v3, v12
778 ; GISEL-NEXT: ; %bb.10: ; %itofp-sw-epilog
779 ; GISEL-NEXT: s_or_b64 exec, exec, s[4:5]
780 ; GISEL-NEXT: v_bfe_u32 v3, v0, 2, 1
781 ; GISEL-NEXT: v_or_b32_e32 v0, v0, v3
782 ; GISEL-NEXT: v_add_co_u32_e32 v0, vcc, 1, v0
783 ; GISEL-NEXT: v_addc_co_u32_e32 v1, vcc, 0, v1, vcc
784 ; GISEL-NEXT: v_addc_co_u32_e32 v2, vcc, 0, v2, vcc
785 ; GISEL-NEXT: v_lshrrev_b64 v[4:5], 2, v[0:1]
786 ; GISEL-NEXT: v_mov_b32_e32 v9, 0
787 ; GISEL-NEXT: v_and_b32_e32 v10, 0x800000, v1
788 ; GISEL-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[9:10]
789 ; GISEL-NEXT: v_lshl_or_b32 v10, v2, 30, v5
790 ; GISEL-NEXT: s_and_saveexec_b64 s[4:5], vcc
791 ; GISEL-NEXT: ; %bb.11: ; %itofp-if-then20
792 ; GISEL-NEXT: v_lshrrev_b64 v[4:5], 3, v[0:1]
793 ; GISEL-NEXT: v_mov_b32_e32 v7, v8
794 ; GISEL-NEXT: v_lshl_or_b32 v10, v2, 29, v5
795 ; GISEL-NEXT: ; %bb.12: ; %Flow
796 ; GISEL-NEXT: s_or_b64 exec, exec, s[4:5]
797 ; GISEL-NEXT: .LBB2_13: ; %Flow4
798 ; GISEL-NEXT: s_or_b64 exec, exec, s[8:9]
799 ; GISEL-NEXT: v_and_b32_e32 v0, 0x80000000, v6
800 ; GISEL-NEXT: v_mov_b32_e32 v1, 0x3ff00000
801 ; GISEL-NEXT: v_mov_b32_e32 v2, 0xfffff
802 ; GISEL-NEXT: v_lshl_add_u32 v1, v7, 20, v1
803 ; GISEL-NEXT: v_and_or_b32 v2, v10, v2, v0
804 ; GISEL-NEXT: v_and_or_b32 v0, v4, -1, 0
805 ; GISEL-NEXT: v_or3_b32 v1, v2, v1, 0
806 ; GISEL-NEXT: .LBB2_14: ; %Flow5
807 ; GISEL-NEXT: s_or_b64 exec, exec, s[6:7]
808 ; GISEL-NEXT: s_setpc_b64 s[30:31]
809 %cvt = sitofp i128 %x to double
813 define double @uitofp_i128_to_f64(i128 %x) {
814 ; SDAG-LABEL: uitofp_i128_to_f64:
815 ; SDAG: ; %bb.0: ; %itofp-entry
816 ; SDAG-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
817 ; SDAG-NEXT: v_or_b32_e32 v5, v1, v3
818 ; SDAG-NEXT: v_or_b32_e32 v4, v0, v2
819 ; SDAG-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[4:5]
820 ; SDAG-NEXT: v_mov_b32_e32 v4, 0
821 ; SDAG-NEXT: v_mov_b32_e32 v5, 0
822 ; SDAG-NEXT: s_and_saveexec_b64 s[6:7], vcc
823 ; SDAG-NEXT: s_cbranch_execz .LBB3_14
824 ; SDAG-NEXT: ; %bb.1: ; %itofp-if-end
825 ; SDAG-NEXT: v_ffbh_u32_e32 v4, v2
826 ; SDAG-NEXT: v_add_u32_e32 v4, 32, v4
827 ; SDAG-NEXT: v_ffbh_u32_e32 v5, v3
828 ; SDAG-NEXT: v_min_u32_e32 v4, v4, v5
829 ; SDAG-NEXT: v_ffbh_u32_e32 v5, v0
830 ; SDAG-NEXT: v_add_u32_e32 v5, 32, v5
831 ; SDAG-NEXT: v_ffbh_u32_e32 v6, v1
832 ; SDAG-NEXT: v_min_u32_e32 v5, v5, v6
833 ; SDAG-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[2:3]
834 ; SDAG-NEXT: v_add_u32_e32 v5, 64, v5
835 ; SDAG-NEXT: v_cndmask_b32_e32 v8, v5, v4, vcc
836 ; SDAG-NEXT: v_sub_u32_e32 v7, 0x80, v8
837 ; SDAG-NEXT: v_sub_u32_e32 v6, 0x7f, v8
838 ; SDAG-NEXT: v_cmp_gt_i32_e32 vcc, 54, v7
839 ; SDAG-NEXT: ; implicit-def: $vgpr9
840 ; SDAG-NEXT: ; implicit-def: $vgpr4_vgpr5
841 ; SDAG-NEXT: s_and_saveexec_b64 s[4:5], vcc
842 ; SDAG-NEXT: s_xor_b64 s[4:5], exec, s[4:5]
843 ; SDAG-NEXT: ; %bb.2: ; %itofp-if-else
844 ; SDAG-NEXT: v_add_u32_e32 v2, 0xffffffb5, v8
845 ; SDAG-NEXT: v_lshlrev_b64 v[0:1], v2, v[0:1]
846 ; SDAG-NEXT: v_cmp_gt_u32_e32 vcc, 64, v2
847 ; SDAG-NEXT: v_cndmask_b32_e32 v9, 0, v1, vcc
848 ; SDAG-NEXT: v_cndmask_b32_e32 v4, 0, v0, vcc
849 ; SDAG-NEXT: ; implicit-def: $vgpr7
850 ; SDAG-NEXT: ; implicit-def: $vgpr2_vgpr3
851 ; SDAG-NEXT: ; implicit-def: $vgpr0_vgpr1
852 ; SDAG-NEXT: ; implicit-def: $vgpr8
853 ; SDAG-NEXT: ; %bb.3: ; %Flow3
854 ; SDAG-NEXT: s_andn2_saveexec_b64 s[8:9], s[4:5]
855 ; SDAG-NEXT: s_cbranch_execz .LBB3_13
856 ; SDAG-NEXT: ; %bb.4: ; %NodeBlock
857 ; SDAG-NEXT: v_cmp_lt_i32_e32 vcc, 54, v7
858 ; SDAG-NEXT: s_and_saveexec_b64 s[4:5], vcc
859 ; SDAG-NEXT: s_xor_b64 s[10:11], exec, s[4:5]
860 ; SDAG-NEXT: s_cbranch_execz .LBB3_8
861 ; SDAG-NEXT: ; %bb.5: ; %LeafBlock
862 ; SDAG-NEXT: v_cmp_ne_u32_e32 vcc, 55, v7
863 ; SDAG-NEXT: s_and_saveexec_b64 s[12:13], vcc
864 ; SDAG-NEXT: s_cbranch_execz .LBB3_7
865 ; SDAG-NEXT: ; %bb.6: ; %itofp-sw-default
866 ; SDAG-NEXT: v_sub_u32_e32 v11, 0x49, v8
867 ; SDAG-NEXT: v_sub_u32_e32 v9, 64, v11
868 ; SDAG-NEXT: v_lshrrev_b64 v[4:5], v11, v[0:1]
869 ; SDAG-NEXT: v_lshlrev_b64 v[9:10], v9, v[2:3]
870 ; SDAG-NEXT: v_sub_u32_e32 v12, 9, v8
871 ; SDAG-NEXT: v_or_b32_e32 v10, v5, v10
872 ; SDAG-NEXT: v_or_b32_e32 v9, v4, v9
873 ; SDAG-NEXT: v_lshrrev_b64 v[4:5], v12, v[2:3]
874 ; SDAG-NEXT: v_cmp_gt_u32_e32 vcc, 64, v11
875 ; SDAG-NEXT: v_add_u32_e32 v15, 55, v8
876 ; SDAG-NEXT: v_cndmask_b32_e32 v5, v5, v10, vcc
877 ; SDAG-NEXT: v_cmp_eq_u32_e64 s[4:5], 0, v11
878 ; SDAG-NEXT: v_cndmask_b32_e32 v4, v4, v9, vcc
879 ; SDAG-NEXT: v_lshrrev_b64 v[9:10], v11, v[2:3]
880 ; SDAG-NEXT: v_lshrrev_b64 v[11:12], v12, v[0:1]
881 ; SDAG-NEXT: v_lshlrev_b64 v[13:14], v15, v[2:3]
882 ; SDAG-NEXT: v_add_u32_e32 v8, -9, v8
883 ; SDAG-NEXT: v_or_b32_e32 v14, v14, v12
884 ; SDAG-NEXT: v_or_b32_e32 v13, v13, v11
885 ; SDAG-NEXT: v_lshlrev_b64 v[11:12], v8, v[0:1]
886 ; SDAG-NEXT: v_cndmask_b32_e32 v10, 0, v10, vcc
887 ; SDAG-NEXT: v_cndmask_b32_e32 v9, 0, v9, vcc
888 ; SDAG-NEXT: v_cmp_gt_u32_e32 vcc, 64, v15
889 ; SDAG-NEXT: v_cndmask_b32_e64 v5, v5, v1, s[4:5]
890 ; SDAG-NEXT: v_cndmask_b32_e64 v4, v4, v0, s[4:5]
891 ; SDAG-NEXT: v_cndmask_b32_e32 v8, v12, v14, vcc
892 ; SDAG-NEXT: v_cmp_eq_u32_e64 s[4:5], 0, v15
893 ; SDAG-NEXT: v_lshlrev_b64 v[0:1], v15, v[0:1]
894 ; SDAG-NEXT: v_cndmask_b32_e64 v3, v8, v3, s[4:5]
895 ; SDAG-NEXT: v_cndmask_b32_e32 v8, v11, v13, vcc
896 ; SDAG-NEXT: v_cndmask_b32_e64 v2, v8, v2, s[4:5]
897 ; SDAG-NEXT: v_cndmask_b32_e32 v1, 0, v1, vcc
898 ; SDAG-NEXT: v_cndmask_b32_e32 v0, 0, v0, vcc
899 ; SDAG-NEXT: v_or_b32_e32 v1, v1, v3
900 ; SDAG-NEXT: v_or_b32_e32 v0, v0, v2
901 ; SDAG-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[0:1]
902 ; SDAG-NEXT: v_mov_b32_e32 v2, v9
903 ; SDAG-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc
904 ; SDAG-NEXT: v_or_b32_e32 v4, v4, v0
905 ; SDAG-NEXT: v_mov_b32_e32 v0, v4
906 ; SDAG-NEXT: v_mov_b32_e32 v1, v5
907 ; SDAG-NEXT: v_mov_b32_e32 v3, v10
908 ; SDAG-NEXT: .LBB3_7: ; %Flow1
909 ; SDAG-NEXT: s_or_b64 exec, exec, s[12:13]
910 ; SDAG-NEXT: .LBB3_8: ; %Flow2
911 ; SDAG-NEXT: s_andn2_saveexec_b64 s[4:5], s[10:11]
912 ; SDAG-NEXT: ; %bb.9: ; %itofp-sw-bb
913 ; SDAG-NEXT: v_lshlrev_b64 v[2:3], 1, v[2:3]
914 ; SDAG-NEXT: v_lshrrev_b32_e32 v3, 31, v1
915 ; SDAG-NEXT: v_lshlrev_b64 v[0:1], 1, v[0:1]
916 ; SDAG-NEXT: v_or_b32_e32 v2, v2, v3
917 ; SDAG-NEXT: ; %bb.10: ; %itofp-sw-epilog
918 ; SDAG-NEXT: s_or_b64 exec, exec, s[4:5]
919 ; SDAG-NEXT: v_lshrrev_b32_e32 v3, 2, v0
920 ; SDAG-NEXT: v_and_or_b32 v0, v3, 1, v0
921 ; SDAG-NEXT: v_add_co_u32_e32 v0, vcc, 1, v0
922 ; SDAG-NEXT: v_addc_co_u32_e32 v1, vcc, 0, v1, vcc
923 ; SDAG-NEXT: v_addc_co_u32_e32 v2, vcc, 0, v2, vcc
924 ; SDAG-NEXT: v_lshrrev_b64 v[4:5], 2, v[0:1]
925 ; SDAG-NEXT: v_and_b32_e32 v3, 0x800000, v1
926 ; SDAG-NEXT: v_cmp_ne_u32_e32 vcc, 0, v3
927 ; SDAG-NEXT: v_alignbit_b32 v9, v2, v1, 2
928 ; SDAG-NEXT: s_and_saveexec_b64 s[4:5], vcc
929 ; SDAG-NEXT: ; %bb.11: ; %itofp-if-then20
930 ; SDAG-NEXT: v_lshrrev_b64 v[4:5], 3, v[0:1]
931 ; SDAG-NEXT: v_alignbit_b32 v9, v2, v1, 3
932 ; SDAG-NEXT: v_mov_b32_e32 v6, v7
933 ; SDAG-NEXT: ; %bb.12: ; %Flow
934 ; SDAG-NEXT: s_or_b64 exec, exec, s[4:5]
935 ; SDAG-NEXT: .LBB3_13: ; %Flow4
936 ; SDAG-NEXT: s_or_b64 exec, exec, s[8:9]
937 ; SDAG-NEXT: v_and_b32_e32 v0, 0xfffff, v9
938 ; SDAG-NEXT: v_lshl_or_b32 v0, v6, 20, v0
939 ; SDAG-NEXT: v_add_u32_e32 v5, 0x3ff00000, v0
940 ; SDAG-NEXT: .LBB3_14: ; %Flow5
941 ; SDAG-NEXT: s_or_b64 exec, exec, s[6:7]
942 ; SDAG-NEXT: v_mov_b32_e32 v0, v4
943 ; SDAG-NEXT: v_mov_b32_e32 v1, v5
944 ; SDAG-NEXT: s_setpc_b64 s[30:31]
946 ; GISEL-LABEL: uitofp_i128_to_f64:
947 ; GISEL: ; %bb.0: ; %itofp-entry
948 ; GISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
949 ; GISEL-NEXT: s_mov_b64 s[4:5], 0
950 ; GISEL-NEXT: v_or_b32_e32 v4, v0, v2
951 ; GISEL-NEXT: v_or_b32_e32 v5, v1, v3
952 ; GISEL-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[4:5]
953 ; GISEL-NEXT: v_mov_b32_e32 v4, s4
954 ; GISEL-NEXT: v_mov_b32_e32 v5, s5
955 ; GISEL-NEXT: s_and_saveexec_b64 s[6:7], vcc
956 ; GISEL-NEXT: s_cbranch_execz .LBB3_14
957 ; GISEL-NEXT: ; %bb.1: ; %itofp-if-end
958 ; GISEL-NEXT: v_ffbh_u32_e32 v5, v0
959 ; GISEL-NEXT: v_ffbh_u32_e32 v4, v1
960 ; GISEL-NEXT: v_add_u32_e32 v5, 32, v5
961 ; GISEL-NEXT: v_ffbh_u32_e32 v6, v2
962 ; GISEL-NEXT: v_min_u32_e32 v4, v4, v5
963 ; GISEL-NEXT: v_ffbh_u32_e32 v5, v3
964 ; GISEL-NEXT: v_add_u32_e32 v6, 32, v6
965 ; GISEL-NEXT: v_cmp_eq_u64_e32 vcc, 0, v[2:3]
966 ; GISEL-NEXT: v_add_u32_e32 v4, 64, v4
967 ; GISEL-NEXT: v_min_u32_e32 v5, v5, v6
968 ; GISEL-NEXT: v_cndmask_b32_e32 v8, v5, v4, vcc
969 ; GISEL-NEXT: v_sub_u32_e32 v7, 0x80, v8
970 ; GISEL-NEXT: v_sub_u32_e32 v6, 0x7f, v8
971 ; GISEL-NEXT: v_cmp_ge_i32_e32 vcc, 53, v7
972 ; GISEL-NEXT: ; implicit-def: $vgpr9
973 ; GISEL-NEXT: ; implicit-def: $vgpr4_vgpr5
974 ; GISEL-NEXT: s_and_saveexec_b64 s[4:5], vcc
975 ; GISEL-NEXT: s_xor_b64 s[4:5], exec, s[4:5]
976 ; GISEL-NEXT: ; %bb.2: ; %itofp-if-else
977 ; GISEL-NEXT: v_add_u32_e32 v2, 0xffffffb5, v8
978 ; GISEL-NEXT: v_lshlrev_b64 v[0:1], v2, v[0:1]
979 ; GISEL-NEXT: v_cmp_gt_u32_e32 vcc, 64, v2
980 ; GISEL-NEXT: v_cndmask_b32_e32 v4, 0, v0, vcc
981 ; GISEL-NEXT: v_cndmask_b32_e32 v9, 0, v1, vcc
982 ; GISEL-NEXT: ; implicit-def: $vgpr7
983 ; GISEL-NEXT: ; implicit-def: $vgpr0
984 ; GISEL-NEXT: ; implicit-def: $vgpr8
985 ; GISEL-NEXT: ; %bb.3: ; %Flow3
986 ; GISEL-NEXT: s_andn2_saveexec_b64 s[8:9], s[4:5]
987 ; GISEL-NEXT: s_cbranch_execz .LBB3_13
988 ; GISEL-NEXT: ; %bb.4: ; %NodeBlock
989 ; GISEL-NEXT: v_cmp_le_i32_e32 vcc, 55, v7
990 ; GISEL-NEXT: s_and_saveexec_b64 s[4:5], vcc
991 ; GISEL-NEXT: s_xor_b64 s[10:11], exec, s[4:5]
992 ; GISEL-NEXT: s_cbranch_execz .LBB3_8
993 ; GISEL-NEXT: ; %bb.5: ; %LeafBlock
994 ; GISEL-NEXT: v_cmp_ne_u32_e32 vcc, 55, v7
995 ; GISEL-NEXT: s_and_saveexec_b64 s[12:13], vcc
996 ; GISEL-NEXT: s_cbranch_execz .LBB3_7
997 ; GISEL-NEXT: ; %bb.6: ; %itofp-sw-default
998 ; GISEL-NEXT: v_sub_u32_e32 v13, 0x49, v8
999 ; GISEL-NEXT: v_sub_u32_e32 v9, 64, v13
1000 ; GISEL-NEXT: v_lshrrev_b64 v[4:5], v13, v[0:1]
1001 ; GISEL-NEXT: v_lshlrev_b64 v[9:10], v9, v[2:3]
1002 ; GISEL-NEXT: v_subrev_u32_e32 v14, 64, v13
1003 ; GISEL-NEXT: v_lshrrev_b64 v[11:12], v13, v[2:3]
1004 ; GISEL-NEXT: v_or_b32_e32 v9, v4, v9
1005 ; GISEL-NEXT: v_or_b32_e32 v10, v5, v10
1006 ; GISEL-NEXT: v_lshrrev_b64 v[4:5], v14, v[2:3]
1007 ; GISEL-NEXT: v_cmp_gt_u32_e32 vcc, 64, v13
1008 ; GISEL-NEXT: v_add_u32_e32 v8, 55, v8
1009 ; GISEL-NEXT: v_cndmask_b32_e32 v4, v4, v9, vcc
1010 ; GISEL-NEXT: v_cndmask_b32_e32 v5, v5, v10, vcc
1011 ; GISEL-NEXT: v_cmp_eq_u32_e64 s[4:5], 0, v13
1012 ; GISEL-NEXT: v_cndmask_b32_e32 v10, 0, v11, vcc
1013 ; GISEL-NEXT: v_cndmask_b32_e32 v11, 0, v12, vcc
1014 ; GISEL-NEXT: v_sub_u32_e32 v12, 64, v8
1015 ; GISEL-NEXT: v_cndmask_b32_e64 v14, v4, v0, s[4:5]
1016 ; GISEL-NEXT: v_cndmask_b32_e64 v9, v5, v1, s[4:5]
1017 ; GISEL-NEXT: v_lshrrev_b64 v[4:5], v8, -1
1018 ; GISEL-NEXT: v_lshlrev_b64 v[12:13], v12, -1
1019 ; GISEL-NEXT: v_subrev_u32_e32 v15, 64, v8
1020 ; GISEL-NEXT: v_or_b32_e32 v16, v4, v12
1021 ; GISEL-NEXT: v_or_b32_e32 v17, v5, v13
1022 ; GISEL-NEXT: v_lshrrev_b64 v[12:13], v15, -1
1023 ; GISEL-NEXT: v_cmp_gt_u32_e32 vcc, 64, v8
1024 ; GISEL-NEXT: v_cndmask_b32_e32 v12, v12, v16, vcc
1025 ; GISEL-NEXT: v_cndmask_b32_e32 v13, v13, v17, vcc
1026 ; GISEL-NEXT: v_cmp_eq_u32_e64 s[4:5], 0, v8
1027 ; GISEL-NEXT: v_cndmask_b32_e32 v4, 0, v4, vcc
1028 ; GISEL-NEXT: v_cndmask_b32_e32 v5, 0, v5, vcc
1029 ; GISEL-NEXT: v_cndmask_b32_e64 v8, v12, -1, s[4:5]
1030 ; GISEL-NEXT: v_cndmask_b32_e64 v12, v13, -1, s[4:5]
1031 ; GISEL-NEXT: v_and_b32_e32 v2, v4, v2
1032 ; GISEL-NEXT: v_and_b32_e32 v3, v5, v3
1033 ; GISEL-NEXT: v_and_or_b32 v0, v8, v0, v2
1034 ; GISEL-NEXT: v_and_or_b32 v1, v12, v1, v3
1035 ; GISEL-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[0:1]
1036 ; GISEL-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc
1037 ; GISEL-NEXT: v_or_b32_e32 v8, v14, v0
1038 ; GISEL-NEXT: v_mov_b32_e32 v0, v8
1039 ; GISEL-NEXT: v_mov_b32_e32 v1, v9
1040 ; GISEL-NEXT: v_mov_b32_e32 v2, v10
1041 ; GISEL-NEXT: v_mov_b32_e32 v3, v11
1042 ; GISEL-NEXT: .LBB3_7: ; %Flow1
1043 ; GISEL-NEXT: s_or_b64 exec, exec, s[12:13]
1044 ; GISEL-NEXT: .LBB3_8: ; %Flow2
1045 ; GISEL-NEXT: s_andn2_saveexec_b64 s[4:5], s[10:11]
1046 ; GISEL-NEXT: ; %bb.9: ; %itofp-sw-bb
1047 ; GISEL-NEXT: v_lshlrev_b64 v[8:9], 1, v[0:1]
1048 ; GISEL-NEXT: v_lshlrev_b64 v[10:11], 1, v[2:3]
1049 ; GISEL-NEXT: v_lshrrev_b32_e32 v0, 31, v1
1050 ; GISEL-NEXT: v_or_b32_e32 v10, v10, v0
1051 ; GISEL-NEXT: v_mov_b32_e32 v0, v8
1052 ; GISEL-NEXT: v_mov_b32_e32 v1, v9
1053 ; GISEL-NEXT: v_mov_b32_e32 v2, v10
1054 ; GISEL-NEXT: v_mov_b32_e32 v3, v11
1055 ; GISEL-NEXT: ; %bb.10: ; %itofp-sw-epilog
1056 ; GISEL-NEXT: s_or_b64 exec, exec, s[4:5]
1057 ; GISEL-NEXT: v_bfe_u32 v4, v0, 2, 1
1058 ; GISEL-NEXT: v_or_b32_e32 v0, v0, v4
1059 ; GISEL-NEXT: v_add_co_u32_e32 v0, vcc, 1, v0
1060 ; GISEL-NEXT: v_addc_co_u32_e32 v1, vcc, 0, v1, vcc
1061 ; GISEL-NEXT: v_addc_co_u32_e32 v2, vcc, 0, v2, vcc
1062 ; GISEL-NEXT: v_addc_co_u32_e32 v3, vcc, 0, v3, vcc
1063 ; GISEL-NEXT: v_mov_b32_e32 v8, 0
1064 ; GISEL-NEXT: v_and_b32_e32 v9, 0x800000, v1
1065 ; GISEL-NEXT: v_lshrrev_b64 v[4:5], 2, v[0:1]
1066 ; GISEL-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[8:9]
1067 ; GISEL-NEXT: v_lshlrev_b64 v[8:9], 30, v[2:3]
1068 ; GISEL-NEXT: v_lshrrev_b32_e32 v5, 2, v1
1069 ; GISEL-NEXT: v_or_b32_e32 v9, v5, v8
1070 ; GISEL-NEXT: s_and_saveexec_b64 s[4:5], vcc
1071 ; GISEL-NEXT: ; %bb.11: ; %itofp-if-then20
1072 ; GISEL-NEXT: v_lshlrev_b64 v[2:3], 29, v[2:3]
1073 ; GISEL-NEXT: v_lshrrev_b64 v[4:5], 3, v[0:1]
1074 ; GISEL-NEXT: v_lshrrev_b32_e32 v0, 3, v1
1075 ; GISEL-NEXT: v_or_b32_e32 v9, v0, v2
1076 ; GISEL-NEXT: v_mov_b32_e32 v6, v7
1077 ; GISEL-NEXT: ; %bb.12: ; %Flow
1078 ; GISEL-NEXT: s_or_b64 exec, exec, s[4:5]
1079 ; GISEL-NEXT: .LBB3_13: ; %Flow4
1080 ; GISEL-NEXT: s_or_b64 exec, exec, s[8:9]
1081 ; GISEL-NEXT: v_mov_b32_e32 v0, 0x3ff00000
1082 ; GISEL-NEXT: v_lshl_add_u32 v0, v6, 20, v0
1083 ; GISEL-NEXT: v_and_b32_e32 v1, 0xfffff, v9
1084 ; GISEL-NEXT: v_and_or_b32 v4, v4, -1, 0
1085 ; GISEL-NEXT: v_or3_b32 v5, v1, v0, 0
1086 ; GISEL-NEXT: .LBB3_14: ; %Flow5
1087 ; GISEL-NEXT: s_or_b64 exec, exec, s[6:7]
1088 ; GISEL-NEXT: v_mov_b32_e32 v0, v4
1089 ; GISEL-NEXT: v_mov_b32_e32 v1, v5
1090 ; GISEL-NEXT: s_setpc_b64 s[30:31]
1091 %cvt = uitofp i128 %x to double
1095 define half @sitofp_i128_to_f16(i128 %x) {
1096 ; SDAG-LABEL: sitofp_i128_to_f16:
1097 ; SDAG: ; %bb.0: ; %itofp-entry
1098 ; SDAG-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1099 ; SDAG-NEXT: v_or_b32_e32 v5, v1, v3
1100 ; SDAG-NEXT: v_or_b32_e32 v4, v0, v2
1101 ; SDAG-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[4:5]
1102 ; SDAG-NEXT: v_mov_b32_e32 v4, 0
1103 ; SDAG-NEXT: s_and_saveexec_b64 s[6:7], vcc
1104 ; SDAG-NEXT: s_cbranch_execz .LBB4_14
1105 ; SDAG-NEXT: ; %bb.1: ; %itofp-if-end
1106 ; SDAG-NEXT: v_sub_co_u32_e32 v4, vcc, 0, v0
1107 ; SDAG-NEXT: v_subb_co_u32_e32 v5, vcc, 0, v1, vcc
1108 ; SDAG-NEXT: v_subb_co_u32_e32 v6, vcc, 0, v2, vcc
1109 ; SDAG-NEXT: v_subb_co_u32_e32 v7, vcc, 0, v3, vcc
1110 ; SDAG-NEXT: v_cmp_gt_i64_e32 vcc, 0, v[2:3]
1111 ; SDAG-NEXT: ; implicit-def: $vgpr8
1112 ; SDAG-NEXT: v_cndmask_b32_e32 v0, v0, v4, vcc
1113 ; SDAG-NEXT: v_cndmask_b32_e32 v4, v2, v6, vcc
1114 ; SDAG-NEXT: v_cndmask_b32_e32 v1, v1, v5, vcc
1115 ; SDAG-NEXT: v_cndmask_b32_e32 v5, v3, v7, vcc
1116 ; SDAG-NEXT: v_ffbh_u32_e32 v2, v4
1117 ; SDAG-NEXT: v_add_u32_e32 v2, 32, v2
1118 ; SDAG-NEXT: v_ffbh_u32_e32 v6, v5
1119 ; SDAG-NEXT: v_min_u32_e32 v2, v2, v6
1120 ; SDAG-NEXT: v_ffbh_u32_e32 v6, v0
1121 ; SDAG-NEXT: v_add_u32_e32 v6, 32, v6
1122 ; SDAG-NEXT: v_ffbh_u32_e32 v7, v1
1123 ; SDAG-NEXT: v_min_u32_e32 v6, v6, v7
1124 ; SDAG-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[4:5]
1125 ; SDAG-NEXT: v_add_u32_e32 v6, 64, v6
1126 ; SDAG-NEXT: v_cndmask_b32_e32 v7, v6, v2, vcc
1127 ; SDAG-NEXT: v_sub_u32_e32 v6, 0x80, v7
1128 ; SDAG-NEXT: v_sub_u32_e32 v2, 0x7f, v7
1129 ; SDAG-NEXT: v_cmp_gt_i32_e32 vcc, 25, v6
1130 ; SDAG-NEXT: s_and_saveexec_b64 s[4:5], vcc
1131 ; SDAG-NEXT: s_xor_b64 s[4:5], exec, s[4:5]
1132 ; SDAG-NEXT: ; %bb.2: ; %itofp-if-else
1133 ; SDAG-NEXT: v_add_u32_e32 v4, 0xffffff98, v7
1134 ; SDAG-NEXT: v_lshlrev_b64 v[0:1], v4, v[0:1]
1135 ; SDAG-NEXT: v_cmp_gt_u32_e32 vcc, 64, v4
1136 ; SDAG-NEXT: v_cndmask_b32_e32 v8, 0, v0, vcc
1137 ; SDAG-NEXT: ; implicit-def: $vgpr6
1138 ; SDAG-NEXT: ; implicit-def: $vgpr0_vgpr1
1139 ; SDAG-NEXT: ; implicit-def: $vgpr7
1140 ; SDAG-NEXT: ; implicit-def: $vgpr4_vgpr5
1141 ; SDAG-NEXT: ; %bb.3: ; %Flow3
1142 ; SDAG-NEXT: s_andn2_saveexec_b64 s[8:9], s[4:5]
1143 ; SDAG-NEXT: s_cbranch_execz .LBB4_13
1144 ; SDAG-NEXT: ; %bb.4: ; %NodeBlock
1145 ; SDAG-NEXT: v_cmp_lt_i32_e32 vcc, 25, v6
1146 ; SDAG-NEXT: s_and_saveexec_b64 s[4:5], vcc
1147 ; SDAG-NEXT: s_xor_b64 s[10:11], exec, s[4:5]
1148 ; SDAG-NEXT: s_cbranch_execz .LBB4_8
1149 ; SDAG-NEXT: ; %bb.5: ; %LeafBlock
1150 ; SDAG-NEXT: v_cmp_ne_u32_e32 vcc, 26, v6
1151 ; SDAG-NEXT: s_and_saveexec_b64 s[12:13], vcc
1152 ; SDAG-NEXT: s_cbranch_execz .LBB4_7
1153 ; SDAG-NEXT: ; %bb.6: ; %itofp-sw-default
1154 ; SDAG-NEXT: v_sub_u32_e32 v12, 0x66, v7
1155 ; SDAG-NEXT: v_sub_u32_e32 v10, 64, v12
1156 ; SDAG-NEXT: v_lshrrev_b64 v[8:9], v12, v[0:1]
1157 ; SDAG-NEXT: v_lshlrev_b64 v[10:11], v10, v[4:5]
1158 ; SDAG-NEXT: v_sub_u32_e32 v13, 38, v7
1159 ; SDAG-NEXT: v_or_b32_e32 v11, v9, v11
1160 ; SDAG-NEXT: v_or_b32_e32 v10, v8, v10
1161 ; SDAG-NEXT: v_lshrrev_b64 v[8:9], v13, v[4:5]
1162 ; SDAG-NEXT: v_cmp_gt_u32_e32 vcc, 64, v12
1163 ; SDAG-NEXT: v_add_u32_e32 v14, 26, v7
1164 ; SDAG-NEXT: v_cndmask_b32_e32 v9, v9, v11, vcc
1165 ; SDAG-NEXT: v_cmp_eq_u32_e64 s[4:5], 0, v12
1166 ; SDAG-NEXT: v_cndmask_b32_e32 v8, v8, v10, vcc
1167 ; SDAG-NEXT: v_lshrrev_b64 v[10:11], v13, v[0:1]
1168 ; SDAG-NEXT: v_lshlrev_b64 v[12:13], v14, v[4:5]
1169 ; SDAG-NEXT: v_subrev_u32_e32 v7, 38, v7
1170 ; SDAG-NEXT: v_cndmask_b32_e64 v15, v8, v0, s[4:5]
1171 ; SDAG-NEXT: v_lshlrev_b64 v[7:8], v7, v[0:1]
1172 ; SDAG-NEXT: v_cndmask_b32_e64 v9, v9, v1, s[4:5]
1173 ; SDAG-NEXT: v_or_b32_e32 v11, v13, v11
1174 ; SDAG-NEXT: v_or_b32_e32 v10, v12, v10
1175 ; SDAG-NEXT: v_cmp_gt_u32_e32 vcc, 64, v14
1176 ; SDAG-NEXT: v_lshlrev_b64 v[0:1], v14, v[0:1]
1177 ; SDAG-NEXT: v_cndmask_b32_e32 v8, v8, v11, vcc
1178 ; SDAG-NEXT: v_cmp_eq_u32_e64 s[4:5], 0, v14
1179 ; SDAG-NEXT: v_cndmask_b32_e32 v7, v7, v10, vcc
1180 ; SDAG-NEXT: v_cndmask_b32_e64 v5, v8, v5, s[4:5]
1181 ; SDAG-NEXT: v_cndmask_b32_e64 v4, v7, v4, s[4:5]
1182 ; SDAG-NEXT: v_cndmask_b32_e32 v1, 0, v1, vcc
1183 ; SDAG-NEXT: v_cndmask_b32_e32 v0, 0, v0, vcc
1184 ; SDAG-NEXT: v_or_b32_e32 v1, v1, v5
1185 ; SDAG-NEXT: v_or_b32_e32 v0, v0, v4
1186 ; SDAG-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[0:1]
1187 ; SDAG-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc
1188 ; SDAG-NEXT: v_or_b32_e32 v8, v15, v0
1189 ; SDAG-NEXT: v_mov_b32_e32 v0, v8
1190 ; SDAG-NEXT: v_mov_b32_e32 v1, v9
1191 ; SDAG-NEXT: .LBB4_7: ; %Flow1
1192 ; SDAG-NEXT: s_or_b64 exec, exec, s[12:13]
1193 ; SDAG-NEXT: .LBB4_8: ; %Flow2
1194 ; SDAG-NEXT: s_andn2_saveexec_b64 s[4:5], s[10:11]
1195 ; SDAG-NEXT: ; %bb.9: ; %itofp-sw-bb
1196 ; SDAG-NEXT: v_lshlrev_b64 v[0:1], 1, v[0:1]
1197 ; SDAG-NEXT: ; %bb.10: ; %itofp-sw-epilog
1198 ; SDAG-NEXT: s_or_b64 exec, exec, s[4:5]
1199 ; SDAG-NEXT: v_lshrrev_b32_e32 v4, 2, v0
1200 ; SDAG-NEXT: v_and_or_b32 v0, v4, 1, v0
1201 ; SDAG-NEXT: v_add_co_u32_e32 v0, vcc, 1, v0
1202 ; SDAG-NEXT: v_addc_co_u32_e32 v1, vcc, 0, v1, vcc
1203 ; SDAG-NEXT: v_and_b32_e32 v4, 0x4000000, v0
1204 ; SDAG-NEXT: v_cmp_ne_u32_e32 vcc, 0, v4
1205 ; SDAG-NEXT: v_alignbit_b32 v8, v1, v0, 2
1206 ; SDAG-NEXT: s_and_saveexec_b64 s[4:5], vcc
1207 ; SDAG-NEXT: ; %bb.11: ; %itofp-if-then20
1208 ; SDAG-NEXT: v_alignbit_b32 v8, v1, v0, 3
1209 ; SDAG-NEXT: v_mov_b32_e32 v2, v6
1210 ; SDAG-NEXT: ; %bb.12: ; %Flow
1211 ; SDAG-NEXT: s_or_b64 exec, exec, s[4:5]
1212 ; SDAG-NEXT: .LBB4_13: ; %Flow4
1213 ; SDAG-NEXT: s_or_b64 exec, exec, s[8:9]
1214 ; SDAG-NEXT: v_and_b32_e32 v0, 0x80000000, v3
1215 ; SDAG-NEXT: v_lshl_add_u32 v1, v2, 23, 1.0
1216 ; SDAG-NEXT: v_and_b32_e32 v2, 0x7fffff, v8
1217 ; SDAG-NEXT: v_or3_b32 v0, v2, v0, v1
1218 ; SDAG-NEXT: v_cvt_f16_f32_e32 v4, v0
1219 ; SDAG-NEXT: .LBB4_14: ; %Flow5
1220 ; SDAG-NEXT: s_or_b64 exec, exec, s[6:7]
1221 ; SDAG-NEXT: v_mov_b32_e32 v0, v4
1222 ; SDAG-NEXT: s_setpc_b64 s[30:31]
1224 ; GISEL-LABEL: sitofp_i128_to_f16:
1225 ; GISEL: ; %bb.0: ; %itofp-entry
1226 ; GISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1227 ; GISEL-NEXT: v_or_b32_e32 v4, v0, v2
1228 ; GISEL-NEXT: v_or_b32_e32 v5, v1, v3
1229 ; GISEL-NEXT: s_mov_b32 s4, 0
1230 ; GISEL-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[4:5]
1231 ; GISEL-NEXT: v_mov_b32_e32 v4, s4
1232 ; GISEL-NEXT: s_and_saveexec_b64 s[6:7], vcc
1233 ; GISEL-NEXT: s_cbranch_execz .LBB4_14
1234 ; GISEL-NEXT: ; %bb.1: ; %itofp-if-end
1235 ; GISEL-NEXT: v_ashrrev_i32_e32 v6, 31, v3
1236 ; GISEL-NEXT: v_xor_b32_e32 v0, v6, v0
1237 ; GISEL-NEXT: v_xor_b32_e32 v1, v6, v1
1238 ; GISEL-NEXT: v_sub_co_u32_e32 v0, vcc, v0, v6
1239 ; GISEL-NEXT: v_xor_b32_e32 v2, v6, v2
1240 ; GISEL-NEXT: v_subb_co_u32_e32 v1, vcc, v1, v6, vcc
1241 ; GISEL-NEXT: v_xor_b32_e32 v3, v6, v3
1242 ; GISEL-NEXT: v_subb_co_u32_e32 v2, vcc, v2, v6, vcc
1243 ; GISEL-NEXT: v_ffbh_u32_e32 v5, v0
1244 ; GISEL-NEXT: v_subb_co_u32_e32 v3, vcc, v3, v6, vcc
1245 ; GISEL-NEXT: v_ffbh_u32_e32 v4, v1
1246 ; GISEL-NEXT: v_add_u32_e32 v5, 32, v5
1247 ; GISEL-NEXT: v_ffbh_u32_e32 v7, v2
1248 ; GISEL-NEXT: v_min_u32_e32 v4, v4, v5
1249 ; GISEL-NEXT: v_ffbh_u32_e32 v5, v3
1250 ; GISEL-NEXT: v_add_u32_e32 v7, 32, v7
1251 ; GISEL-NEXT: v_cmp_eq_u64_e32 vcc, 0, v[2:3]
1252 ; GISEL-NEXT: v_add_u32_e32 v4, 64, v4
1253 ; GISEL-NEXT: v_min_u32_e32 v5, v5, v7
1254 ; GISEL-NEXT: v_cndmask_b32_e32 v5, v5, v4, vcc
1255 ; GISEL-NEXT: v_sub_u32_e32 v8, 0x80, v5
1256 ; GISEL-NEXT: v_sub_u32_e32 v7, 0x7f, v5
1257 ; GISEL-NEXT: v_cmp_ge_i32_e32 vcc, 24, v8
1258 ; GISEL-NEXT: ; implicit-def: $vgpr4
1259 ; GISEL-NEXT: s_and_saveexec_b64 s[4:5], vcc
1260 ; GISEL-NEXT: s_xor_b64 s[4:5], exec, s[4:5]
1261 ; GISEL-NEXT: ; %bb.2: ; %itofp-if-else
1262 ; GISEL-NEXT: v_add_u32_e32 v2, 0xffffff98, v5
1263 ; GISEL-NEXT: v_lshlrev_b64 v[0:1], v2, v[0:1]
1264 ; GISEL-NEXT: v_cmp_gt_u32_e32 vcc, 64, v2
1265 ; GISEL-NEXT: v_cndmask_b32_e32 v4, 0, v0, vcc
1266 ; GISEL-NEXT: ; implicit-def: $vgpr8
1267 ; GISEL-NEXT: ; implicit-def: $vgpr0
1268 ; GISEL-NEXT: ; implicit-def: $vgpr5
1269 ; GISEL-NEXT: ; implicit-def: $vgpr2
1270 ; GISEL-NEXT: ; %bb.3: ; %Flow3
1271 ; GISEL-NEXT: s_andn2_saveexec_b64 s[8:9], s[4:5]
1272 ; GISEL-NEXT: s_cbranch_execz .LBB4_13
1273 ; GISEL-NEXT: ; %bb.4: ; %NodeBlock
1274 ; GISEL-NEXT: v_cmp_le_i32_e32 vcc, 26, v8
1275 ; GISEL-NEXT: s_and_saveexec_b64 s[4:5], vcc
1276 ; GISEL-NEXT: s_xor_b64 s[10:11], exec, s[4:5]
1277 ; GISEL-NEXT: s_cbranch_execz .LBB4_8
1278 ; GISEL-NEXT: ; %bb.5: ; %LeafBlock
1279 ; GISEL-NEXT: v_cmp_ne_u32_e32 vcc, 26, v8
1280 ; GISEL-NEXT: s_and_saveexec_b64 s[12:13], vcc
1281 ; GISEL-NEXT: s_cbranch_execz .LBB4_7
1282 ; GISEL-NEXT: ; %bb.6: ; %itofp-sw-default
1283 ; GISEL-NEXT: v_sub_u32_e32 v4, 0x66, v5
1284 ; GISEL-NEXT: v_sub_u32_e32 v11, 64, v4
1285 ; GISEL-NEXT: v_lshrrev_b64 v[9:10], v4, v[0:1]
1286 ; GISEL-NEXT: v_lshlrev_b64 v[11:12], v11, v[2:3]
1287 ; GISEL-NEXT: v_subrev_u32_e32 v13, 64, v4
1288 ; GISEL-NEXT: v_or_b32_e32 v11, v9, v11
1289 ; GISEL-NEXT: v_or_b32_e32 v12, v10, v12
1290 ; GISEL-NEXT: v_lshrrev_b64 v[9:10], v13, v[2:3]
1291 ; GISEL-NEXT: v_cmp_gt_u32_e32 vcc, 64, v4
1292 ; GISEL-NEXT: v_add_u32_e32 v5, 26, v5
1293 ; GISEL-NEXT: v_cndmask_b32_e32 v9, v9, v11, vcc
1294 ; GISEL-NEXT: v_cndmask_b32_e32 v10, v10, v12, vcc
1295 ; GISEL-NEXT: v_cmp_eq_u32_e32 vcc, 0, v4
1296 ; GISEL-NEXT: v_sub_u32_e32 v11, 64, v5
1297 ; GISEL-NEXT: v_cndmask_b32_e32 v13, v9, v0, vcc
1298 ; GISEL-NEXT: v_cndmask_b32_e32 v4, v10, v1, vcc
1299 ; GISEL-NEXT: v_lshrrev_b64 v[9:10], v5, -1
1300 ; GISEL-NEXT: v_lshlrev_b64 v[11:12], v11, -1
1301 ; GISEL-NEXT: v_subrev_u32_e32 v14, 64, v5
1302 ; GISEL-NEXT: v_or_b32_e32 v15, v9, v11
1303 ; GISEL-NEXT: v_or_b32_e32 v16, v10, v12
1304 ; GISEL-NEXT: v_lshrrev_b64 v[11:12], v14, -1
1305 ; GISEL-NEXT: v_cmp_gt_u32_e32 vcc, 64, v5
1306 ; GISEL-NEXT: v_cndmask_b32_e32 v11, v11, v15, vcc
1307 ; GISEL-NEXT: v_cndmask_b32_e32 v12, v12, v16, vcc
1308 ; GISEL-NEXT: v_cmp_eq_u32_e64 s[4:5], 0, v5
1309 ; GISEL-NEXT: v_cndmask_b32_e32 v9, 0, v9, vcc
1310 ; GISEL-NEXT: v_cndmask_b32_e32 v10, 0, v10, vcc
1311 ; GISEL-NEXT: v_cndmask_b32_e64 v5, v11, -1, s[4:5]
1312 ; GISEL-NEXT: v_cndmask_b32_e64 v11, v12, -1, s[4:5]
1313 ; GISEL-NEXT: v_and_b32_e32 v2, v9, v2
1314 ; GISEL-NEXT: v_and_b32_e32 v3, v10, v3
1315 ; GISEL-NEXT: v_and_or_b32 v0, v5, v0, v2
1316 ; GISEL-NEXT: v_and_or_b32 v1, v11, v1, v3
1317 ; GISEL-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[0:1]
1318 ; GISEL-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc
1319 ; GISEL-NEXT: v_or_b32_e32 v3, v13, v0
1320 ; GISEL-NEXT: v_mov_b32_e32 v0, v3
1321 ; GISEL-NEXT: v_mov_b32_e32 v1, v4
1322 ; GISEL-NEXT: v_mov_b32_e32 v2, v5
1323 ; GISEL-NEXT: v_mov_b32_e32 v3, v6
1324 ; GISEL-NEXT: .LBB4_7: ; %Flow1
1325 ; GISEL-NEXT: s_or_b64 exec, exec, s[12:13]
1326 ; GISEL-NEXT: .LBB4_8: ; %Flow2
1327 ; GISEL-NEXT: s_andn2_saveexec_b64 s[4:5], s[10:11]
1328 ; GISEL-NEXT: ; %bb.9: ; %itofp-sw-bb
1329 ; GISEL-NEXT: v_lshlrev_b64 v[0:1], 1, v[0:1]
1330 ; GISEL-NEXT: ; %bb.10: ; %itofp-sw-epilog
1331 ; GISEL-NEXT: s_or_b64 exec, exec, s[4:5]
1332 ; GISEL-NEXT: v_bfe_u32 v2, v0, 2, 1
1333 ; GISEL-NEXT: v_or_b32_e32 v0, v0, v2
1334 ; GISEL-NEXT: v_add_co_u32_e32 v0, vcc, 1, v0
1335 ; GISEL-NEXT: v_addc_co_u32_e32 v1, vcc, 0, v1, vcc
1336 ; GISEL-NEXT: v_and_b32_e32 v2, 0x4000000, v0
1337 ; GISEL-NEXT: v_mov_b32_e32 v3, 0
1338 ; GISEL-NEXT: v_lshrrev_b64 v[4:5], 2, v[0:1]
1339 ; GISEL-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[2:3]
1340 ; GISEL-NEXT: s_and_saveexec_b64 s[4:5], vcc
1341 ; GISEL-NEXT: ; %bb.11: ; %itofp-if-then20
1342 ; GISEL-NEXT: v_lshrrev_b64 v[4:5], 3, v[0:1]
1343 ; GISEL-NEXT: v_mov_b32_e32 v7, v8
1344 ; GISEL-NEXT: ; %bb.12: ; %Flow
1345 ; GISEL-NEXT: s_or_b64 exec, exec, s[4:5]
1346 ; GISEL-NEXT: .LBB4_13: ; %Flow4
1347 ; GISEL-NEXT: s_or_b64 exec, exec, s[8:9]
1348 ; GISEL-NEXT: v_and_b32_e32 v0, 0x80000000, v6
1349 ; GISEL-NEXT: v_lshl_add_u32 v1, v7, 23, 1.0
1350 ; GISEL-NEXT: v_and_b32_e32 v2, 0x7fffff, v4
1351 ; GISEL-NEXT: v_or3_b32 v0, v2, v0, v1
1352 ; GISEL-NEXT: v_cvt_f16_f32_e32 v4, v0
1353 ; GISEL-NEXT: .LBB4_14: ; %Flow5
1354 ; GISEL-NEXT: s_or_b64 exec, exec, s[6:7]
1355 ; GISEL-NEXT: v_mov_b32_e32 v0, v4
1356 ; GISEL-NEXT: s_setpc_b64 s[30:31]
1357 %cvt = sitofp i128 %x to half
1361 define half @uitofp_i128_to_f16(i128 %x) {
1362 ; SDAG-LABEL: uitofp_i128_to_f16:
1363 ; SDAG: ; %bb.0: ; %itofp-entry
1364 ; SDAG-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1365 ; SDAG-NEXT: v_or_b32_e32 v5, v1, v3
1366 ; SDAG-NEXT: v_or_b32_e32 v4, v0, v2
1367 ; SDAG-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[4:5]
1368 ; SDAG-NEXT: v_mov_b32_e32 v4, 0
1369 ; SDAG-NEXT: s_and_saveexec_b64 s[6:7], vcc
1370 ; SDAG-NEXT: s_cbranch_execz .LBB5_14
1371 ; SDAG-NEXT: ; %bb.1: ; %itofp-if-end
1372 ; SDAG-NEXT: v_ffbh_u32_e32 v4, v2
1373 ; SDAG-NEXT: v_add_u32_e32 v4, 32, v4
1374 ; SDAG-NEXT: v_ffbh_u32_e32 v5, v3
1375 ; SDAG-NEXT: v_min_u32_e32 v4, v4, v5
1376 ; SDAG-NEXT: v_ffbh_u32_e32 v5, v0
1377 ; SDAG-NEXT: v_add_u32_e32 v5, 32, v5
1378 ; SDAG-NEXT: v_ffbh_u32_e32 v6, v1
1379 ; SDAG-NEXT: v_min_u32_e32 v5, v5, v6
1380 ; SDAG-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[2:3]
1381 ; SDAG-NEXT: v_add_u32_e32 v5, 64, v5
1382 ; SDAG-NEXT: v_cndmask_b32_e32 v6, v5, v4, vcc
1383 ; SDAG-NEXT: v_sub_u32_e32 v5, 0x80, v6
1384 ; SDAG-NEXT: v_sub_u32_e32 v4, 0x7f, v6
1385 ; SDAG-NEXT: v_cmp_gt_i32_e32 vcc, 25, v5
1386 ; SDAG-NEXT: ; implicit-def: $vgpr7
1387 ; SDAG-NEXT: s_and_saveexec_b64 s[4:5], vcc
1388 ; SDAG-NEXT: s_xor_b64 s[4:5], exec, s[4:5]
1389 ; SDAG-NEXT: ; %bb.2: ; %itofp-if-else
1390 ; SDAG-NEXT: v_add_u32_e32 v2, 0xffffff98, v6
1391 ; SDAG-NEXT: v_lshlrev_b64 v[0:1], v2, v[0:1]
1392 ; SDAG-NEXT: v_cmp_gt_u32_e32 vcc, 64, v2
1393 ; SDAG-NEXT: v_cndmask_b32_e32 v7, 0, v0, vcc
1394 ; SDAG-NEXT: ; implicit-def: $vgpr5
1395 ; SDAG-NEXT: ; implicit-def: $vgpr0_vgpr1
1396 ; SDAG-NEXT: ; implicit-def: $vgpr6
1397 ; SDAG-NEXT: ; implicit-def: $vgpr2_vgpr3
1398 ; SDAG-NEXT: ; %bb.3: ; %Flow3
1399 ; SDAG-NEXT: s_andn2_saveexec_b64 s[8:9], s[4:5]
1400 ; SDAG-NEXT: s_cbranch_execz .LBB5_13
1401 ; SDAG-NEXT: ; %bb.4: ; %NodeBlock
1402 ; SDAG-NEXT: v_cmp_lt_i32_e32 vcc, 25, v5
1403 ; SDAG-NEXT: s_and_saveexec_b64 s[4:5], vcc
1404 ; SDAG-NEXT: s_xor_b64 s[10:11], exec, s[4:5]
1405 ; SDAG-NEXT: s_cbranch_execz .LBB5_8
1406 ; SDAG-NEXT: ; %bb.5: ; %LeafBlock
1407 ; SDAG-NEXT: v_cmp_ne_u32_e32 vcc, 26, v5
1408 ; SDAG-NEXT: s_and_saveexec_b64 s[12:13], vcc
1409 ; SDAG-NEXT: s_cbranch_execz .LBB5_7
1410 ; SDAG-NEXT: ; %bb.6: ; %itofp-sw-default
1411 ; SDAG-NEXT: v_sub_u32_e32 v11, 0x66, v6
1412 ; SDAG-NEXT: v_sub_u32_e32 v9, 64, v11
1413 ; SDAG-NEXT: v_lshrrev_b64 v[7:8], v11, v[0:1]
1414 ; SDAG-NEXT: v_lshlrev_b64 v[9:10], v9, v[2:3]
1415 ; SDAG-NEXT: v_sub_u32_e32 v12, 38, v6
1416 ; SDAG-NEXT: v_or_b32_e32 v10, v8, v10
1417 ; SDAG-NEXT: v_or_b32_e32 v9, v7, v9
1418 ; SDAG-NEXT: v_lshrrev_b64 v[7:8], v12, v[2:3]
1419 ; SDAG-NEXT: v_cmp_gt_u32_e32 vcc, 64, v11
1420 ; SDAG-NEXT: v_add_u32_e32 v13, 26, v6
1421 ; SDAG-NEXT: v_cndmask_b32_e32 v8, v8, v10, vcc
1422 ; SDAG-NEXT: v_cmp_eq_u32_e64 s[4:5], 0, v11
1423 ; SDAG-NEXT: v_cndmask_b32_e32 v7, v7, v9, vcc
1424 ; SDAG-NEXT: v_lshrrev_b64 v[9:10], v12, v[0:1]
1425 ; SDAG-NEXT: v_lshlrev_b64 v[11:12], v13, v[2:3]
1426 ; SDAG-NEXT: v_subrev_u32_e32 v6, 38, v6
1427 ; SDAG-NEXT: v_cndmask_b32_e64 v14, v7, v0, s[4:5]
1428 ; SDAG-NEXT: v_lshlrev_b64 v[6:7], v6, v[0:1]
1429 ; SDAG-NEXT: v_cndmask_b32_e64 v8, v8, v1, s[4:5]
1430 ; SDAG-NEXT: v_or_b32_e32 v10, v12, v10
1431 ; SDAG-NEXT: v_or_b32_e32 v9, v11, v9
1432 ; SDAG-NEXT: v_cmp_gt_u32_e32 vcc, 64, v13
1433 ; SDAG-NEXT: v_lshlrev_b64 v[0:1], v13, v[0:1]
1434 ; SDAG-NEXT: v_cndmask_b32_e32 v7, v7, v10, vcc
1435 ; SDAG-NEXT: v_cmp_eq_u32_e64 s[4:5], 0, v13
1436 ; SDAG-NEXT: v_cndmask_b32_e32 v6, v6, v9, vcc
1437 ; SDAG-NEXT: v_cndmask_b32_e64 v3, v7, v3, s[4:5]
1438 ; SDAG-NEXT: v_cndmask_b32_e64 v2, v6, v2, s[4:5]
1439 ; SDAG-NEXT: v_cndmask_b32_e32 v1, 0, v1, vcc
1440 ; SDAG-NEXT: v_cndmask_b32_e32 v0, 0, v0, vcc
1441 ; SDAG-NEXT: v_or_b32_e32 v1, v1, v3
1442 ; SDAG-NEXT: v_or_b32_e32 v0, v0, v2
1443 ; SDAG-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[0:1]
1444 ; SDAG-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc
1445 ; SDAG-NEXT: v_or_b32_e32 v7, v14, v0
1446 ; SDAG-NEXT: v_mov_b32_e32 v0, v7
1447 ; SDAG-NEXT: v_mov_b32_e32 v1, v8
1448 ; SDAG-NEXT: .LBB5_7: ; %Flow1
1449 ; SDAG-NEXT: s_or_b64 exec, exec, s[12:13]
1450 ; SDAG-NEXT: .LBB5_8: ; %Flow2
1451 ; SDAG-NEXT: s_andn2_saveexec_b64 s[4:5], s[10:11]
1452 ; SDAG-NEXT: ; %bb.9: ; %itofp-sw-bb
1453 ; SDAG-NEXT: v_lshlrev_b64 v[0:1], 1, v[0:1]
1454 ; SDAG-NEXT: ; %bb.10: ; %itofp-sw-epilog
1455 ; SDAG-NEXT: s_or_b64 exec, exec, s[4:5]
1456 ; SDAG-NEXT: v_lshrrev_b32_e32 v2, 2, v0
1457 ; SDAG-NEXT: v_and_or_b32 v0, v2, 1, v0
1458 ; SDAG-NEXT: v_add_co_u32_e32 v0, vcc, 1, v0
1459 ; SDAG-NEXT: v_addc_co_u32_e32 v1, vcc, 0, v1, vcc
1460 ; SDAG-NEXT: v_and_b32_e32 v2, 0x4000000, v0
1461 ; SDAG-NEXT: v_cmp_ne_u32_e32 vcc, 0, v2
1462 ; SDAG-NEXT: v_alignbit_b32 v7, v1, v0, 2
1463 ; SDAG-NEXT: s_and_saveexec_b64 s[4:5], vcc
1464 ; SDAG-NEXT: ; %bb.11: ; %itofp-if-then20
1465 ; SDAG-NEXT: v_alignbit_b32 v7, v1, v0, 3
1466 ; SDAG-NEXT: v_mov_b32_e32 v4, v5
1467 ; SDAG-NEXT: ; %bb.12: ; %Flow
1468 ; SDAG-NEXT: s_or_b64 exec, exec, s[4:5]
1469 ; SDAG-NEXT: .LBB5_13: ; %Flow4
1470 ; SDAG-NEXT: s_or_b64 exec, exec, s[8:9]
1471 ; SDAG-NEXT: v_and_b32_e32 v0, 0x7fffff, v7
1472 ; SDAG-NEXT: v_lshl_or_b32 v0, v4, 23, v0
1473 ; SDAG-NEXT: v_add_u32_e32 v0, 1.0, v0
1474 ; SDAG-NEXT: v_cvt_f16_f32_e32 v4, v0
1475 ; SDAG-NEXT: .LBB5_14: ; %Flow5
1476 ; SDAG-NEXT: s_or_b64 exec, exec, s[6:7]
1477 ; SDAG-NEXT: v_mov_b32_e32 v0, v4
1478 ; SDAG-NEXT: s_setpc_b64 s[30:31]
1480 ; GISEL-LABEL: uitofp_i128_to_f16:
1481 ; GISEL: ; %bb.0: ; %itofp-entry
1482 ; GISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1483 ; GISEL-NEXT: v_or_b32_e32 v4, v0, v2
1484 ; GISEL-NEXT: v_or_b32_e32 v5, v1, v3
1485 ; GISEL-NEXT: s_mov_b32 s4, 0
1486 ; GISEL-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[4:5]
1487 ; GISEL-NEXT: v_mov_b32_e32 v4, s4
1488 ; GISEL-NEXT: s_and_saveexec_b64 s[6:7], vcc
1489 ; GISEL-NEXT: s_cbranch_execz .LBB5_14
1490 ; GISEL-NEXT: ; %bb.1: ; %itofp-if-end
1491 ; GISEL-NEXT: v_ffbh_u32_e32 v5, v0
1492 ; GISEL-NEXT: v_ffbh_u32_e32 v4, v1
1493 ; GISEL-NEXT: v_add_u32_e32 v5, 32, v5
1494 ; GISEL-NEXT: v_ffbh_u32_e32 v6, v2
1495 ; GISEL-NEXT: v_min_u32_e32 v4, v4, v5
1496 ; GISEL-NEXT: v_ffbh_u32_e32 v5, v3
1497 ; GISEL-NEXT: v_add_u32_e32 v6, 32, v6
1498 ; GISEL-NEXT: v_cmp_eq_u64_e32 vcc, 0, v[2:3]
1499 ; GISEL-NEXT: v_add_u32_e32 v4, 64, v4
1500 ; GISEL-NEXT: v_min_u32_e32 v5, v5, v6
1501 ; GISEL-NEXT: v_cndmask_b32_e32 v5, v5, v4, vcc
1502 ; GISEL-NEXT: v_sub_u32_e32 v7, 0x80, v5
1503 ; GISEL-NEXT: v_sub_u32_e32 v6, 0x7f, v5
1504 ; GISEL-NEXT: v_cmp_ge_i32_e32 vcc, 24, v7
1505 ; GISEL-NEXT: ; implicit-def: $vgpr4
1506 ; GISEL-NEXT: s_and_saveexec_b64 s[4:5], vcc
1507 ; GISEL-NEXT: s_xor_b64 s[4:5], exec, s[4:5]
1508 ; GISEL-NEXT: ; %bb.2: ; %itofp-if-else
1509 ; GISEL-NEXT: v_add_u32_e32 v2, 0xffffff98, v5
1510 ; GISEL-NEXT: v_lshlrev_b64 v[0:1], v2, v[0:1]
1511 ; GISEL-NEXT: v_cmp_gt_u32_e32 vcc, 64, v2
1512 ; GISEL-NEXT: v_cndmask_b32_e32 v4, 0, v0, vcc
1513 ; GISEL-NEXT: ; implicit-def: $vgpr7
1514 ; GISEL-NEXT: ; implicit-def: $vgpr0
1515 ; GISEL-NEXT: ; implicit-def: $vgpr5
1516 ; GISEL-NEXT: ; implicit-def: $vgpr2
1517 ; GISEL-NEXT: ; %bb.3: ; %Flow3
1518 ; GISEL-NEXT: s_andn2_saveexec_b64 s[8:9], s[4:5]
1519 ; GISEL-NEXT: s_cbranch_execz .LBB5_13
1520 ; GISEL-NEXT: ; %bb.4: ; %NodeBlock
1521 ; GISEL-NEXT: v_cmp_le_i32_e32 vcc, 26, v7
1522 ; GISEL-NEXT: s_and_saveexec_b64 s[4:5], vcc
1523 ; GISEL-NEXT: s_xor_b64 s[10:11], exec, s[4:5]
1524 ; GISEL-NEXT: s_cbranch_execz .LBB5_8
1525 ; GISEL-NEXT: ; %bb.5: ; %LeafBlock
1526 ; GISEL-NEXT: v_cmp_ne_u32_e32 vcc, 26, v7
1527 ; GISEL-NEXT: s_and_saveexec_b64 s[12:13], vcc
1528 ; GISEL-NEXT: s_cbranch_execz .LBB5_7
1529 ; GISEL-NEXT: ; %bb.6: ; %itofp-sw-default
1530 ; GISEL-NEXT: v_sub_u32_e32 v4, 0x66, v5
1531 ; GISEL-NEXT: v_sub_u32_e32 v10, 64, v4
1532 ; GISEL-NEXT: v_lshrrev_b64 v[8:9], v4, v[0:1]
1533 ; GISEL-NEXT: v_lshlrev_b64 v[10:11], v10, v[2:3]
1534 ; GISEL-NEXT: v_subrev_u32_e32 v12, 64, v4
1535 ; GISEL-NEXT: v_or_b32_e32 v10, v8, v10
1536 ; GISEL-NEXT: v_or_b32_e32 v11, v9, v11
1537 ; GISEL-NEXT: v_lshrrev_b64 v[8:9], v12, v[2:3]
1538 ; GISEL-NEXT: v_cmp_gt_u32_e32 vcc, 64, v4
1539 ; GISEL-NEXT: v_add_u32_e32 v5, 26, v5
1540 ; GISEL-NEXT: v_cndmask_b32_e32 v8, v8, v10, vcc
1541 ; GISEL-NEXT: v_cndmask_b32_e32 v9, v9, v11, vcc
1542 ; GISEL-NEXT: v_cmp_eq_u32_e32 vcc, 0, v4
1543 ; GISEL-NEXT: v_sub_u32_e32 v10, 64, v5
1544 ; GISEL-NEXT: v_cndmask_b32_e32 v12, v8, v0, vcc
1545 ; GISEL-NEXT: v_cndmask_b32_e32 v4, v9, v1, vcc
1546 ; GISEL-NEXT: v_lshrrev_b64 v[8:9], v5, -1
1547 ; GISEL-NEXT: v_lshlrev_b64 v[10:11], v10, -1
1548 ; GISEL-NEXT: v_subrev_u32_e32 v13, 64, v5
1549 ; GISEL-NEXT: v_or_b32_e32 v14, v8, v10
1550 ; GISEL-NEXT: v_or_b32_e32 v15, v9, v11
1551 ; GISEL-NEXT: v_lshrrev_b64 v[10:11], v13, -1
1552 ; GISEL-NEXT: v_cmp_gt_u32_e32 vcc, 64, v5
1553 ; GISEL-NEXT: v_cndmask_b32_e32 v10, v10, v14, vcc
1554 ; GISEL-NEXT: v_cndmask_b32_e32 v11, v11, v15, vcc
1555 ; GISEL-NEXT: v_cmp_eq_u32_e64 s[4:5], 0, v5
1556 ; GISEL-NEXT: v_cndmask_b32_e32 v8, 0, v8, vcc
1557 ; GISEL-NEXT: v_cndmask_b32_e32 v9, 0, v9, vcc
1558 ; GISEL-NEXT: v_cndmask_b32_e64 v5, v10, -1, s[4:5]
1559 ; GISEL-NEXT: v_cndmask_b32_e64 v10, v11, -1, s[4:5]
1560 ; GISEL-NEXT: v_and_b32_e32 v2, v8, v2
1561 ; GISEL-NEXT: v_and_b32_e32 v3, v9, v3
1562 ; GISEL-NEXT: v_and_or_b32 v0, v5, v0, v2
1563 ; GISEL-NEXT: v_and_or_b32 v1, v10, v1, v3
1564 ; GISEL-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[0:1]
1565 ; GISEL-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc
1566 ; GISEL-NEXT: v_or_b32_e32 v3, v12, v0
1567 ; GISEL-NEXT: v_mov_b32_e32 v0, v3
1568 ; GISEL-NEXT: v_mov_b32_e32 v1, v4
1569 ; GISEL-NEXT: v_mov_b32_e32 v2, v5
1570 ; GISEL-NEXT: v_mov_b32_e32 v3, v6
1571 ; GISEL-NEXT: .LBB5_7: ; %Flow1
1572 ; GISEL-NEXT: s_or_b64 exec, exec, s[12:13]
1573 ; GISEL-NEXT: .LBB5_8: ; %Flow2
1574 ; GISEL-NEXT: s_andn2_saveexec_b64 s[4:5], s[10:11]
1575 ; GISEL-NEXT: ; %bb.9: ; %itofp-sw-bb
1576 ; GISEL-NEXT: v_lshlrev_b64 v[0:1], 1, v[0:1]
1577 ; GISEL-NEXT: ; %bb.10: ; %itofp-sw-epilog
1578 ; GISEL-NEXT: s_or_b64 exec, exec, s[4:5]
1579 ; GISEL-NEXT: v_bfe_u32 v2, v0, 2, 1
1580 ; GISEL-NEXT: v_or_b32_e32 v0, v0, v2
1581 ; GISEL-NEXT: v_add_co_u32_e32 v0, vcc, 1, v0
1582 ; GISEL-NEXT: v_addc_co_u32_e32 v1, vcc, 0, v1, vcc
1583 ; GISEL-NEXT: v_and_b32_e32 v2, 0x4000000, v0
1584 ; GISEL-NEXT: v_mov_b32_e32 v3, 0
1585 ; GISEL-NEXT: v_lshrrev_b64 v[4:5], 2, v[0:1]
1586 ; GISEL-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[2:3]
1587 ; GISEL-NEXT: s_and_saveexec_b64 s[4:5], vcc
1588 ; GISEL-NEXT: ; %bb.11: ; %itofp-if-then20
1589 ; GISEL-NEXT: v_lshrrev_b64 v[4:5], 3, v[0:1]
1590 ; GISEL-NEXT: v_mov_b32_e32 v6, v7
1591 ; GISEL-NEXT: ; %bb.12: ; %Flow
1592 ; GISEL-NEXT: s_or_b64 exec, exec, s[4:5]
1593 ; GISEL-NEXT: .LBB5_13: ; %Flow4
1594 ; GISEL-NEXT: s_or_b64 exec, exec, s[8:9]
1595 ; GISEL-NEXT: v_lshl_add_u32 v0, v6, 23, 1.0
1596 ; GISEL-NEXT: v_mov_b32_e32 v1, 0x7fffff
1597 ; GISEL-NEXT: v_and_or_b32 v0, v4, v1, v0
1598 ; GISEL-NEXT: v_cvt_f16_f32_e32 v4, v0
1599 ; GISEL-NEXT: .LBB5_14: ; %Flow5
1600 ; GISEL-NEXT: s_or_b64 exec, exec, s[6:7]
1601 ; GISEL-NEXT: v_mov_b32_e32 v0, v4
1602 ; GISEL-NEXT: s_setpc_b64 s[30:31]
1603 %cvt = uitofp i128 %x to half
1607 ;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line: