[MachineScheduler] Fix physreg dependencies of ExitSU (#123541)
[llvm-project.git] / llvm / test / CodeGen / AMDGPU / fptoi.i128.ll
blob3e6b812c12d7f63240fcc4f4e6cf0e940dda0868
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 i128 @fptosi_f64_to_i128(double %x) {
6 ; SDAG-LABEL: fptosi_f64_to_i128:
7 ; SDAG:       ; %bb.0: ; %fp-to-i-entry
8 ; SDAG-NEXT:    s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
9 ; SDAG-NEXT:    v_mov_b32_e32 v5, v1
10 ; SDAG-NEXT:    v_bfe_u32 v6, v5, 20, 11
11 ; SDAG-NEXT:    v_mov_b32_e32 v7, 0
12 ; SDAG-NEXT:    s_mov_b64 s[4:5], 0x3fe
13 ; SDAG-NEXT:    v_mov_b32_e32 v4, v0
14 ; SDAG-NEXT:    v_cmp_lt_u64_e32 vcc, s[4:5], v[6:7]
15 ; SDAG-NEXT:    v_mov_b32_e32 v0, 0
16 ; SDAG-NEXT:    v_mov_b32_e32 v2, 0
17 ; SDAG-NEXT:    v_mov_b32_e32 v1, 0
18 ; SDAG-NEXT:    v_mov_b32_e32 v3, 0
19 ; SDAG-NEXT:    s_and_saveexec_b64 s[8:9], vcc
20 ; SDAG-NEXT:    s_cbranch_execz .LBB0_10
21 ; SDAG-NEXT:  ; %bb.1: ; %fp-to-i-if-end
22 ; SDAG-NEXT:    v_add_co_u32_e32 v0, vcc, 0xfffffb81, v6
23 ; SDAG-NEXT:    v_addc_co_u32_e32 v1, vcc, -1, v7, vcc
24 ; SDAG-NEXT:    v_addc_co_u32_e32 v2, vcc, -1, v7, vcc
25 ; SDAG-NEXT:    s_movk_i32 s6, 0xff7f
26 ; SDAG-NEXT:    v_addc_co_u32_e32 v3, vcc, -1, v7, vcc
27 ; SDAG-NEXT:    s_mov_b32 s7, -1
28 ; SDAG-NEXT:    v_cmp_eq_u64_e64 s[4:5], -1, v[2:3]
29 ; SDAG-NEXT:    v_cmp_lt_u64_e64 s[6:7], s[6:7], v[0:1]
30 ; SDAG-NEXT:    v_cmp_lt_i64_e32 vcc, -1, v[4:5]
31 ; SDAG-NEXT:    s_and_b64 s[4:5], s[4:5], s[6:7]
32 ; SDAG-NEXT:    ; implicit-def: $vgpr0_vgpr1
33 ; SDAG-NEXT:    ; implicit-def: $vgpr2_vgpr3
34 ; SDAG-NEXT:    s_and_saveexec_b64 s[6:7], s[4:5]
35 ; SDAG-NEXT:    s_xor_b64 s[10:11], exec, s[6:7]
36 ; SDAG-NEXT:    s_cbranch_execz .LBB0_7
37 ; SDAG-NEXT:  ; %bb.2: ; %fp-to-i-if-end9
38 ; SDAG-NEXT:    v_cndmask_b32_e64 v0, 0, 1, vcc
39 ; SDAG-NEXT:    v_add_co_u32_e64 v9, s[4:5], -1, v0
40 ; SDAG-NEXT:    s_mov_b64 s[4:5], 0x432
41 ; SDAG-NEXT:    v_and_b32_e32 v0, 0xfffff, v5
42 ; SDAG-NEXT:    v_cmp_lt_u64_e64 s[4:5], s[4:5], v[6:7]
43 ; SDAG-NEXT:    v_cndmask_b32_e64 v8, -1, 0, vcc
44 ; SDAG-NEXT:    v_cndmask_b32_e64 v10, -1, 1, vcc
45 ; SDAG-NEXT:    v_or_b32_e32 v5, 0x100000, v0
46 ; SDAG-NEXT:    ; implicit-def: $vgpr0_vgpr1
47 ; SDAG-NEXT:    ; implicit-def: $vgpr2_vgpr3
48 ; SDAG-NEXT:    s_and_saveexec_b64 s[6:7], s[4:5]
49 ; SDAG-NEXT:    s_xor_b64 s[12:13], exec, s[6:7]
50 ; SDAG-NEXT:    s_cbranch_execz .LBB0_4
51 ; SDAG-NEXT:  ; %bb.3: ; %fp-to-i-if-else
52 ; SDAG-NEXT:    v_sub_u32_e32 v0, 0x473, v6
53 ; SDAG-NEXT:    v_add_u32_e32 v2, 0xfffffb8d, v6
54 ; SDAG-NEXT:    v_add_u32_e32 v7, 0xfffffbcd, v6
55 ; SDAG-NEXT:    v_lshrrev_b64 v[0:1], v0, v[4:5]
56 ; SDAG-NEXT:    v_lshlrev_b64 v[2:3], v2, v[4:5]
57 ; SDAG-NEXT:    v_cmp_gt_u32_e64 s[4:5], 64, v7
58 ; SDAG-NEXT:    v_cndmask_b32_e64 v1, v3, v1, s[4:5]
59 ; SDAG-NEXT:    v_cmp_ne_u32_e64 s[6:7], 0, v7
60 ; SDAG-NEXT:    v_cndmask_b32_e64 v6, 0, v1, s[6:7]
61 ; SDAG-NEXT:    v_cndmask_b32_e64 v2, v2, v0, s[4:5]
62 ; SDAG-NEXT:    v_lshlrev_b64 v[0:1], v7, v[4:5]
63 ; SDAG-NEXT:    v_cndmask_b32_e64 v2, 0, v2, s[6:7]
64 ; SDAG-NEXT:    v_cndmask_b32_e64 v12, 0, v0, s[4:5]
65 ; SDAG-NEXT:    v_cndmask_b32_e64 v11, 0, v1, s[4:5]
66 ; SDAG-NEXT:    v_mad_u64_u32 v[0:1], s[4:5], v12, v10, 0
67 ; SDAG-NEXT:    v_mov_b32_e32 v3, 0
68 ; SDAG-NEXT:    v_mul_lo_u32 v13, v8, v2
69 ; SDAG-NEXT:    v_mad_u64_u32 v[4:5], s[4:5], v10, v2, 0
70 ; SDAG-NEXT:    v_mov_b32_e32 v2, v1
71 ; SDAG-NEXT:    v_mul_lo_u32 v14, v10, v6
72 ; SDAG-NEXT:    v_mad_u64_u32 v[6:7], s[4:5], v11, v10, v[2:3]
73 ; SDAG-NEXT:    ; implicit-def: $vgpr10
74 ; SDAG-NEXT:    v_add3_u32 v5, v5, v14, v13
75 ; SDAG-NEXT:    v_mov_b32_e32 v2, v6
76 ; SDAG-NEXT:    v_mad_u64_u32 v[1:2], s[4:5], v12, v8, v[2:3]
77 ; SDAG-NEXT:    v_mad_u64_u32 v[4:5], s[4:5], v9, v12, v[4:5]
78 ; SDAG-NEXT:    v_add_co_u32_e64 v2, s[4:5], v7, v2
79 ; SDAG-NEXT:    v_addc_co_u32_e64 v3, s[4:5], 0, 0, s[4:5]
80 ; SDAG-NEXT:    v_mul_lo_u32 v6, v9, v11
81 ; SDAG-NEXT:    v_mul_lo_u32 v9, v9, v12
82 ; SDAG-NEXT:    v_mad_u64_u32 v[2:3], s[4:5], v11, v8, v[2:3]
83 ; SDAG-NEXT:    ; implicit-def: $vgpr8
84 ; SDAG-NEXT:    v_add3_u32 v5, v9, v5, v6
85 ; SDAG-NEXT:    v_add_co_u32_e64 v2, s[4:5], v2, v4
86 ; SDAG-NEXT:    v_addc_co_u32_e64 v3, s[4:5], v3, v5, s[4:5]
87 ; SDAG-NEXT:    ; implicit-def: $vgpr6_vgpr7
88 ; SDAG-NEXT:    ; implicit-def: $vgpr4_vgpr5
89 ; SDAG-NEXT:    ; implicit-def: $vgpr9
90 ; SDAG-NEXT:  .LBB0_4: ; %Flow
91 ; SDAG-NEXT:    s_andn2_saveexec_b64 s[12:13], s[12:13]
92 ; SDAG-NEXT:    s_cbranch_execz .LBB0_6
93 ; SDAG-NEXT:  ; %bb.5: ; %fp-to-i-if-then12
94 ; SDAG-NEXT:    v_sub_u32_e32 v2, 0x433, v6
95 ; SDAG-NEXT:    v_lshrrev_b64 v[0:1], v2, v[4:5]
96 ; SDAG-NEXT:    v_cmp_gt_u32_e64 s[4:5], 64, v2
97 ; SDAG-NEXT:    v_cmp_eq_u32_e64 s[6:7], 0, v2
98 ; SDAG-NEXT:    v_cndmask_b32_e64 v0, 0, v0, s[4:5]
99 ; SDAG-NEXT:    v_cndmask_b32_e64 v1, 0, v1, s[4:5]
100 ; SDAG-NEXT:    v_cndmask_b32_e64 v6, v0, v4, s[6:7]
101 ; SDAG-NEXT:    v_cndmask_b32_e64 v5, v1, v5, s[6:7]
102 ; SDAG-NEXT:    v_mad_u64_u32 v[0:1], s[4:5], v6, v10, 0
103 ; SDAG-NEXT:    v_mov_b32_e32 v2, 0
104 ; SDAG-NEXT:    v_mad_u64_u32 v[3:4], s[4:5], v5, v10, v[1:2]
105 ; SDAG-NEXT:    v_mov_b32_e32 v1, v3
106 ; SDAG-NEXT:    v_mad_u64_u32 v[1:2], s[4:5], v6, v8, v[1:2]
107 ; SDAG-NEXT:    v_add_co_u32_e64 v2, s[4:5], v4, v2
108 ; SDAG-NEXT:    v_addc_co_u32_e64 v3, s[4:5], 0, 0, s[4:5]
109 ; SDAG-NEXT:    v_mad_u64_u32 v[2:3], s[4:5], v5, v8, v[2:3]
110 ; SDAG-NEXT:    v_mad_u64_u32 v[2:3], s[4:5], v9, v6, v[2:3]
111 ; SDAG-NEXT:    v_mad_u64_u32 v[3:4], s[4:5], v9, v6, v[3:4]
112 ; SDAG-NEXT:    v_mad_i32_i24 v3, v9, v5, v3
113 ; SDAG-NEXT:  .LBB0_6: ; %Flow1
114 ; SDAG-NEXT:    s_or_b64 exec, exec, s[12:13]
115 ; SDAG-NEXT:  .LBB0_7: ; %Flow2
116 ; SDAG-NEXT:    s_andn2_saveexec_b64 s[4:5], s[10:11]
117 ; SDAG-NEXT:  ; %bb.8: ; %fp-to-i-if-then5
118 ; SDAG-NEXT:    v_bfrev_b32_e32 v0, 1
119 ; SDAG-NEXT:    v_bfrev_b32_e32 v1, -2
120 ; SDAG-NEXT:    v_cndmask_b32_e64 v2, 0, -1, vcc
121 ; SDAG-NEXT:    v_cndmask_b32_e32 v3, v0, v1, vcc
122 ; SDAG-NEXT:    v_mov_b32_e32 v0, v2
123 ; SDAG-NEXT:    v_mov_b32_e32 v1, v2
124 ; SDAG-NEXT:  ; %bb.9: ; %Flow3
125 ; SDAG-NEXT:    s_or_b64 exec, exec, s[4:5]
126 ; SDAG-NEXT:  .LBB0_10: ; %fp-to-i-cleanup
127 ; SDAG-NEXT:    s_or_b64 exec, exec, s[8:9]
128 ; SDAG-NEXT:    s_setpc_b64 s[30:31]
130 ; GISEL-LABEL: fptosi_f64_to_i128:
131 ; GISEL:       ; %bb.0: ; %fp-to-i-entry
132 ; GISEL-NEXT:    s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
133 ; GISEL-NEXT:    v_mov_b32_e32 v5, v1
134 ; GISEL-NEXT:    v_mov_b32_e32 v4, v0
135 ; GISEL-NEXT:    v_lshrrev_b32_e32 v2, 20, v5
136 ; GISEL-NEXT:    v_mov_b32_e32 v0, 0x3ff
137 ; GISEL-NEXT:    s_mov_b64 s[4:5], 0
138 ; GISEL-NEXT:    v_mov_b32_e32 v7, 0
139 ; GISEL-NEXT:    v_mov_b32_e32 v1, 0
140 ; GISEL-NEXT:    v_and_b32_e32 v6, 0x7ff, v2
141 ; GISEL-NEXT:    v_cmp_ge_u64_e32 vcc, v[6:7], v[0:1]
142 ; GISEL-NEXT:    s_mov_b64 s[6:7], s[4:5]
143 ; GISEL-NEXT:    v_mov_b32_e32 v0, s4
144 ; GISEL-NEXT:    v_mov_b32_e32 v1, s5
145 ; GISEL-NEXT:    v_mov_b32_e32 v2, s6
146 ; GISEL-NEXT:    v_mov_b32_e32 v3, s7
147 ; GISEL-NEXT:    s_and_saveexec_b64 s[12:13], vcc
148 ; GISEL-NEXT:    s_cbranch_execz .LBB0_10
149 ; GISEL-NEXT:  ; %bb.1: ; %fp-to-i-if-end
150 ; GISEL-NEXT:    v_add_co_u32_e32 v0, vcc, 0xfffffb81, v6
151 ; GISEL-NEXT:    v_mov_b32_e32 v2, 0xffffff80
152 ; GISEL-NEXT:    v_addc_co_u32_e64 v1, s[6:7], 0, -1, vcc
153 ; GISEL-NEXT:    v_mov_b32_e32 v3, -1
154 ; GISEL-NEXT:    v_addc_co_u32_e64 v8, s[6:7], 0, -1, s[6:7]
155 ; GISEL-NEXT:    v_cmp_ge_u64_e32 vcc, v[0:1], v[2:3]
156 ; GISEL-NEXT:    v_addc_co_u32_e64 v9, s[6:7], 0, -1, s[6:7]
157 ; GISEL-NEXT:    v_cndmask_b32_e64 v0, 0, 1, vcc
158 ; GISEL-NEXT:    v_cmp_le_u64_e32 vcc, -1, v[8:9]
159 ; GISEL-NEXT:    v_cmp_lt_i64_e64 s[4:5], -1, v[4:5]
160 ; GISEL-NEXT:    v_cndmask_b32_e64 v1, 0, 1, vcc
161 ; GISEL-NEXT:    v_cmp_eq_u64_e32 vcc, -1, v[8:9]
162 ; GISEL-NEXT:    v_cndmask_b32_e32 v0, v1, v0, vcc
163 ; GISEL-NEXT:    v_and_b32_e32 v0, 1, v0
164 ; GISEL-NEXT:    v_cmp_ne_u32_e32 vcc, 0, v0
165 ; GISEL-NEXT:    ; implicit-def: $vgpr0_vgpr1_vgpr2_vgpr3
166 ; GISEL-NEXT:    s_and_saveexec_b64 s[6:7], vcc
167 ; GISEL-NEXT:    s_xor_b64 s[14:15], exec, s[6:7]
168 ; GISEL-NEXT:    s_cbranch_execz .LBB0_7
169 ; GISEL-NEXT:  ; %bb.2: ; %fp-to-i-if-end9
170 ; GISEL-NEXT:    s_xor_b64 s[6:7], s[4:5], -1
171 ; GISEL-NEXT:    v_cndmask_b32_e64 v0, 0, -1, s[6:7]
172 ; GISEL-NEXT:    v_and_b32_e32 v0, 1, v0
173 ; GISEL-NEXT:    v_cndmask_b32_e64 v1, 0, 1, s[6:7]
174 ; GISEL-NEXT:    v_lshlrev_b16_e32 v2, 1, v0
175 ; GISEL-NEXT:    v_or_b32_e32 v1, v1, v2
176 ; GISEL-NEXT:    v_lshlrev_b16_e32 v3, 2, v0
177 ; GISEL-NEXT:    v_or_b32_e32 v2, v0, v2
178 ; GISEL-NEXT:    v_or_b32_e32 v1, v1, v3
179 ; GISEL-NEXT:    v_lshlrev_b16_e32 v8, 3, v0
180 ; GISEL-NEXT:    v_or_b32_e32 v2, v2, v3
181 ; GISEL-NEXT:    v_or_b32_e32 v1, v1, v8
182 ; GISEL-NEXT:    v_lshlrev_b16_e32 v9, 4, v0
183 ; GISEL-NEXT:    v_or_b32_e32 v2, v2, v8
184 ; GISEL-NEXT:    v_or_b32_e32 v1, v1, v9
185 ; GISEL-NEXT:    v_lshlrev_b16_e32 v10, 5, v0
186 ; GISEL-NEXT:    v_or_b32_e32 v2, v2, v9
187 ; GISEL-NEXT:    v_or_b32_e32 v1, v1, v10
188 ; GISEL-NEXT:    v_lshlrev_b16_e32 v11, 6, v0
189 ; GISEL-NEXT:    v_or_b32_e32 v2, v2, v10
190 ; GISEL-NEXT:    v_or_b32_e32 v1, v1, v11
191 ; GISEL-NEXT:    v_lshlrev_b16_e32 v12, 7, v0
192 ; GISEL-NEXT:    v_or_b32_e32 v2, v2, v11
193 ; GISEL-NEXT:    v_or_b32_e32 v1, v1, v12
194 ; GISEL-NEXT:    v_lshlrev_b16_e32 v13, 8, v0
195 ; GISEL-NEXT:    v_or_b32_e32 v2, v2, v12
196 ; GISEL-NEXT:    v_or_b32_e32 v1, v1, v13
197 ; GISEL-NEXT:    v_lshlrev_b16_e32 v14, 9, v0
198 ; GISEL-NEXT:    v_or_b32_e32 v2, v2, v13
199 ; GISEL-NEXT:    v_or_b32_e32 v1, v1, v14
200 ; GISEL-NEXT:    v_lshlrev_b16_e32 v15, 10, v0
201 ; GISEL-NEXT:    v_or_b32_e32 v2, v2, v14
202 ; GISEL-NEXT:    v_or_b32_e32 v1, v1, v15
203 ; GISEL-NEXT:    v_lshlrev_b16_e32 v16, 11, v0
204 ; GISEL-NEXT:    v_or_b32_e32 v2, v2, v15
205 ; GISEL-NEXT:    v_or_b32_e32 v1, v1, v16
206 ; GISEL-NEXT:    v_lshlrev_b16_e32 v17, 12, v0
207 ; GISEL-NEXT:    v_or_b32_e32 v2, v2, v16
208 ; GISEL-NEXT:    v_or_b32_e32 v1, v1, v17
209 ; GISEL-NEXT:    v_lshlrev_b16_e32 v18, 13, v0
210 ; GISEL-NEXT:    v_or_b32_e32 v2, v2, v17
211 ; GISEL-NEXT:    v_or_b32_e32 v1, v1, v18
212 ; GISEL-NEXT:    v_lshlrev_b16_e32 v19, 14, v0
213 ; GISEL-NEXT:    v_or_b32_e32 v2, v2, v18
214 ; GISEL-NEXT:    v_or_b32_e32 v1, v1, v19
215 ; GISEL-NEXT:    v_lshlrev_b16_e32 v0, 15, v0
216 ; GISEL-NEXT:    v_or_b32_e32 v2, v2, v19
217 ; GISEL-NEXT:    v_or_b32_e32 v1, v1, v0
218 ; GISEL-NEXT:    v_or_b32_e32 v0, v2, v0
219 ; GISEL-NEXT:    v_and_b32_e32 v0, 0xffff, v0
220 ; GISEL-NEXT:    v_and_b32_e32 v1, 0xffff, v1
221 ; GISEL-NEXT:    v_lshlrev_b32_e32 v2, 16, v0
222 ; GISEL-NEXT:    v_lshl_or_b32 v10, v0, 16, v0
223 ; GISEL-NEXT:    v_or3_b32 v8, v1, v2, 1
224 ; GISEL-NEXT:    v_or3_b32 v9, v0, v2, 0
225 ; GISEL-NEXT:    v_mov_b32_e32 v0, 0x433
226 ; GISEL-NEXT:    v_mov_b32_e32 v1, 0
227 ; GISEL-NEXT:    v_and_b32_e32 v2, 0xfffff, v5
228 ; GISEL-NEXT:    v_cmp_ge_u64_e32 vcc, v[6:7], v[0:1]
229 ; GISEL-NEXT:    v_or_b32_e32 v5, 0x100000, v2
230 ; GISEL-NEXT:    ; implicit-def: $vgpr0_vgpr1_vgpr2_vgpr3
231 ; GISEL-NEXT:    s_and_saveexec_b64 s[6:7], vcc
232 ; GISEL-NEXT:    s_xor_b64 s[16:17], exec, s[6:7]
233 ; GISEL-NEXT:    s_cbranch_execz .LBB0_4
234 ; GISEL-NEXT:  ; %bb.3: ; %fp-to-i-if-else
235 ; GISEL-NEXT:    v_add_u32_e32 v7, 0xfffffbcd, v6
236 ; GISEL-NEXT:    v_lshlrev_b64 v[0:1], v7, v[4:5]
237 ; GISEL-NEXT:    v_cmp_gt_u32_e32 vcc, 64, v7
238 ; GISEL-NEXT:    v_cndmask_b32_e32 v11, 0, v0, vcc
239 ; GISEL-NEXT:    v_cndmask_b32_e32 v12, 0, v1, vcc
240 ; GISEL-NEXT:    v_mad_u64_u32 v[0:1], s[6:7], v11, v10, 0
241 ; GISEL-NEXT:    v_add_u32_e32 v6, 0xfffffb8d, v6
242 ; GISEL-NEXT:    v_sub_u32_e32 v2, 64, v7
243 ; GISEL-NEXT:    v_lshrrev_b64 v[2:3], v2, v[4:5]
244 ; GISEL-NEXT:    v_lshlrev_b64 v[4:5], v6, v[4:5]
245 ; GISEL-NEXT:    v_cmp_eq_u32_e64 s[6:7], 0, v7
246 ; GISEL-NEXT:    v_mad_u64_u32 v[6:7], s[8:9], v12, v9, v[0:1]
247 ; GISEL-NEXT:    v_cndmask_b32_e32 v2, v4, v2, vcc
248 ; GISEL-NEXT:    v_cndmask_b32_e64 v13, v2, 0, s[6:7]
249 ; GISEL-NEXT:    v_mad_u64_u32 v[6:7], s[8:9], v13, v8, v[6:7]
250 ; GISEL-NEXT:    v_mad_u64_u32 v[0:1], s[8:9], v11, v8, 0
251 ; GISEL-NEXT:    v_mov_b32_e32 v2, v6
252 ; GISEL-NEXT:    v_mul_lo_u32 v6, v11, v10
253 ; GISEL-NEXT:    v_mad_u64_u32 v[1:2], s[8:9], v11, v9, v[1:2]
254 ; GISEL-NEXT:    v_mul_lo_u32 v4, v12, v10
255 ; GISEL-NEXT:    v_cndmask_b32_e32 v3, v5, v3, vcc
256 ; GISEL-NEXT:    v_mad_u64_u32 v[1:2], s[10:11], v12, v8, v[1:2]
257 ; GISEL-NEXT:    v_addc_co_u32_e64 v6, s[10:11], v7, v6, s[10:11]
258 ; GISEL-NEXT:    v_addc_co_u32_e64 v4, s[8:9], v6, v4, s[8:9]
259 ; GISEL-NEXT:    v_mad_u64_u32 v[6:7], s[8:9], v13, v9, v[4:5]
260 ; GISEL-NEXT:    v_cndmask_b32_e64 v3, v3, 0, s[6:7]
261 ; GISEL-NEXT:    ; implicit-def: $vgpr10
262 ; GISEL-NEXT:    ; implicit-def: $vgpr9
263 ; GISEL-NEXT:    v_mad_u64_u32 v[3:4], s[6:7], v3, v8, v[6:7]
264 ; GISEL-NEXT:    ; implicit-def: $vgpr6
265 ; GISEL-NEXT:    ; implicit-def: $vgpr4_vgpr5
266 ; GISEL-NEXT:    ; implicit-def: $vgpr8
267 ; GISEL-NEXT:  .LBB0_4: ; %Flow
268 ; GISEL-NEXT:    s_andn2_saveexec_b64 s[8:9], s[16:17]
269 ; GISEL-NEXT:    s_cbranch_execz .LBB0_6
270 ; GISEL-NEXT:  ; %bb.5: ; %fp-to-i-if-then12
271 ; GISEL-NEXT:    v_sub_co_u32_e32 v2, vcc, 0x433, v6
272 ; GISEL-NEXT:    v_lshrrev_b64 v[0:1], v2, v[4:5]
273 ; GISEL-NEXT:    v_cmp_gt_u32_e32 vcc, 64, v2
274 ; GISEL-NEXT:    v_cndmask_b32_e32 v0, 0, v0, vcc
275 ; GISEL-NEXT:    v_cndmask_b32_e32 v1, 0, v1, vcc
276 ; GISEL-NEXT:    v_cmp_eq_u32_e32 vcc, 0, v2
277 ; GISEL-NEXT:    v_cndmask_b32_e32 v4, v0, v4, vcc
278 ; GISEL-NEXT:    v_mad_u64_u32 v[2:3], s[6:7], v4, v10, 0
279 ; GISEL-NEXT:    v_cndmask_b32_e32 v5, v1, v5, vcc
280 ; GISEL-NEXT:    v_mad_u64_u32 v[0:1], s[6:7], v4, v8, 0
281 ; GISEL-NEXT:    v_mad_u64_u32 v[2:3], s[6:7], v5, v9, v[2:3]
282 ; GISEL-NEXT:    v_mul_lo_u32 v6, v5, v10
283 ; GISEL-NEXT:    v_mad_u64_u32 v[1:2], vcc, v4, v9, v[1:2]
284 ; GISEL-NEXT:    v_mul_lo_u32 v4, v4, v10
285 ; GISEL-NEXT:    v_mad_u64_u32 v[1:2], s[6:7], v5, v8, v[1:2]
286 ; GISEL-NEXT:    v_addc_co_u32_e64 v3, s[6:7], v3, v4, s[6:7]
287 ; GISEL-NEXT:    v_addc_co_u32_e32 v3, vcc, v3, v6, vcc
288 ; GISEL-NEXT:  .LBB0_6: ; %Flow1
289 ; GISEL-NEXT:    s_or_b64 exec, exec, s[8:9]
290 ; GISEL-NEXT:  .LBB0_7: ; %Flow2
291 ; GISEL-NEXT:    s_andn2_saveexec_b64 s[6:7], s[14:15]
292 ; GISEL-NEXT:    s_cbranch_execz .LBB0_9
293 ; GISEL-NEXT:  ; %bb.8: ; %fp-to-i-if-then5
294 ; GISEL-NEXT:    v_cndmask_b32_e64 v1, 0, -1, s[4:5]
295 ; GISEL-NEXT:    v_and_b32_e32 v1, 1, v1
296 ; GISEL-NEXT:    v_cndmask_b32_e64 v0, 0, 1, s[4:5]
297 ; GISEL-NEXT:    v_lshlrev_b32_e32 v2, 1, v1
298 ; GISEL-NEXT:    v_or_b32_e32 v0, v0, v2
299 ; GISEL-NEXT:    v_lshlrev_b32_e32 v3, 2, v1
300 ; GISEL-NEXT:    v_lshlrev_b32_e32 v4, 3, v1
301 ; GISEL-NEXT:    v_or_b32_e32 v2, v1, v2
302 ; GISEL-NEXT:    v_or3_b32 v0, v0, v3, v4
303 ; GISEL-NEXT:    v_lshlrev_b32_e32 v5, 4, v1
304 ; GISEL-NEXT:    v_lshlrev_b32_e32 v6, 5, v1
305 ; GISEL-NEXT:    v_or3_b32 v2, v2, v3, v4
306 ; GISEL-NEXT:    v_or3_b32 v0, v0, v5, v6
307 ; GISEL-NEXT:    v_lshlrev_b32_e32 v7, 6, v1
308 ; GISEL-NEXT:    v_lshlrev_b32_e32 v8, 7, v1
309 ; GISEL-NEXT:    v_or3_b32 v2, v2, v5, v6
310 ; GISEL-NEXT:    v_or3_b32 v0, v0, v7, v8
311 ; GISEL-NEXT:    v_lshlrev_b32_e32 v9, 8, v1
312 ; GISEL-NEXT:    v_lshlrev_b32_e32 v10, 9, v1
313 ; GISEL-NEXT:    v_or3_b32 v2, v2, v7, v8
314 ; GISEL-NEXT:    v_or3_b32 v0, v0, v9, v10
315 ; GISEL-NEXT:    v_lshlrev_b32_e32 v11, 10, v1
316 ; GISEL-NEXT:    v_lshlrev_b32_e32 v12, 11, v1
317 ; GISEL-NEXT:    v_or3_b32 v2, v2, v9, v10
318 ; GISEL-NEXT:    v_or3_b32 v0, v0, v11, v12
319 ; GISEL-NEXT:    v_lshlrev_b32_e32 v13, 12, v1
320 ; GISEL-NEXT:    v_lshlrev_b32_e32 v14, 13, v1
321 ; GISEL-NEXT:    v_or3_b32 v2, v2, v11, v12
322 ; GISEL-NEXT:    v_or3_b32 v0, v0, v13, v14
323 ; GISEL-NEXT:    v_lshlrev_b32_e32 v15, 14, v1
324 ; GISEL-NEXT:    v_lshlrev_b32_e32 v16, 15, v1
325 ; GISEL-NEXT:    v_or3_b32 v2, v2, v13, v14
326 ; GISEL-NEXT:    v_or3_b32 v0, v0, v15, v16
327 ; GISEL-NEXT:    v_lshlrev_b32_e32 v17, 16, v1
328 ; GISEL-NEXT:    v_lshlrev_b32_e32 v18, 17, v1
329 ; GISEL-NEXT:    v_or3_b32 v2, v2, v15, v16
330 ; GISEL-NEXT:    v_or3_b32 v0, v0, v17, v18
331 ; GISEL-NEXT:    v_lshlrev_b32_e32 v19, 18, v1
332 ; GISEL-NEXT:    v_lshlrev_b32_e32 v3, 19, v1
333 ; GISEL-NEXT:    v_or3_b32 v2, v2, v17, v18
334 ; GISEL-NEXT:    v_or3_b32 v0, v0, v19, v3
335 ; GISEL-NEXT:    v_lshlrev_b32_e32 v4, 20, v1
336 ; GISEL-NEXT:    v_lshlrev_b32_e32 v5, 21, v1
337 ; GISEL-NEXT:    v_or3_b32 v2, v2, v19, v3
338 ; GISEL-NEXT:    v_or3_b32 v0, v0, v4, v5
339 ; GISEL-NEXT:    v_lshlrev_b32_e32 v6, 22, v1
340 ; GISEL-NEXT:    v_lshlrev_b32_e32 v7, 23, v1
341 ; GISEL-NEXT:    v_or3_b32 v2, v2, v4, v5
342 ; GISEL-NEXT:    v_or3_b32 v0, v0, v6, v7
343 ; GISEL-NEXT:    v_lshlrev_b32_e32 v8, 24, v1
344 ; GISEL-NEXT:    v_lshlrev_b32_e32 v9, 25, v1
345 ; GISEL-NEXT:    v_or3_b32 v2, v2, v6, v7
346 ; GISEL-NEXT:    v_or3_b32 v0, v0, v8, v9
347 ; GISEL-NEXT:    v_lshlrev_b32_e32 v10, 26, v1
348 ; GISEL-NEXT:    v_lshlrev_b32_e32 v11, 27, v1
349 ; GISEL-NEXT:    v_or3_b32 v2, v2, v8, v9
350 ; GISEL-NEXT:    v_or3_b32 v0, v0, v10, v11
351 ; GISEL-NEXT:    v_lshlrev_b32_e32 v12, 28, v1
352 ; GISEL-NEXT:    v_lshlrev_b32_e32 v13, 29, v1
353 ; GISEL-NEXT:    v_or3_b32 v2, v2, v10, v11
354 ; GISEL-NEXT:    v_or3_b32 v0, v0, v12, v13
355 ; GISEL-NEXT:    v_lshlrev_b32_e32 v14, 30, v1
356 ; GISEL-NEXT:    v_lshlrev_b32_e32 v1, 31, v1
357 ; GISEL-NEXT:    v_or3_b32 v2, v2, v12, v13
358 ; GISEL-NEXT:    v_or3_b32 v0, v0, v14, v1
359 ; GISEL-NEXT:    v_or3_b32 v1, v2, v14, v1
360 ; GISEL-NEXT:    v_add_u32_e32 v3, 0x80000000, v1
361 ; GISEL-NEXT:    v_mov_b32_e32 v2, v1
362 ; GISEL-NEXT:  .LBB0_9: ; %Flow3
363 ; GISEL-NEXT:    s_or_b64 exec, exec, s[6:7]
364 ; GISEL-NEXT:  .LBB0_10: ; %fp-to-i-cleanup
365 ; GISEL-NEXT:    s_or_b64 exec, exec, s[12:13]
366 ; GISEL-NEXT:    s_setpc_b64 s[30:31]
367   %cvt = fptosi double %x to i128
368   ret i128 %cvt
371 define i128 @fptoui_f64_to_i128(double %x) {
372 ; SDAG-LABEL: fptoui_f64_to_i128:
373 ; SDAG:       ; %bb.0: ; %fp-to-i-entry
374 ; SDAG-NEXT:    s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
375 ; SDAG-NEXT:    v_mov_b32_e32 v5, v1
376 ; SDAG-NEXT:    v_bfe_u32 v6, v5, 20, 11
377 ; SDAG-NEXT:    v_mov_b32_e32 v7, 0
378 ; SDAG-NEXT:    s_mov_b64 s[4:5], 0x3fe
379 ; SDAG-NEXT:    v_mov_b32_e32 v4, v0
380 ; SDAG-NEXT:    v_cmp_lt_u64_e32 vcc, s[4:5], v[6:7]
381 ; SDAG-NEXT:    v_mov_b32_e32 v0, 0
382 ; SDAG-NEXT:    v_mov_b32_e32 v2, 0
383 ; SDAG-NEXT:    v_mov_b32_e32 v1, 0
384 ; SDAG-NEXT:    v_mov_b32_e32 v3, 0
385 ; SDAG-NEXT:    s_and_saveexec_b64 s[8:9], vcc
386 ; SDAG-NEXT:    s_cbranch_execz .LBB1_10
387 ; SDAG-NEXT:  ; %bb.1: ; %fp-to-i-if-end
388 ; SDAG-NEXT:    v_add_co_u32_e32 v0, vcc, 0xfffffb81, v6
389 ; SDAG-NEXT:    v_addc_co_u32_e32 v1, vcc, -1, v7, vcc
390 ; SDAG-NEXT:    v_addc_co_u32_e32 v2, vcc, -1, v7, vcc
391 ; SDAG-NEXT:    s_movk_i32 s6, 0xff7f
392 ; SDAG-NEXT:    v_addc_co_u32_e32 v3, vcc, -1, v7, vcc
393 ; SDAG-NEXT:    s_mov_b32 s7, -1
394 ; SDAG-NEXT:    v_cmp_eq_u64_e64 s[4:5], -1, v[2:3]
395 ; SDAG-NEXT:    v_cmp_lt_u64_e64 s[6:7], s[6:7], v[0:1]
396 ; SDAG-NEXT:    v_cmp_lt_i64_e32 vcc, -1, v[4:5]
397 ; SDAG-NEXT:    s_and_b64 s[4:5], s[4:5], s[6:7]
398 ; SDAG-NEXT:    ; implicit-def: $vgpr0_vgpr1
399 ; SDAG-NEXT:    ; implicit-def: $vgpr2_vgpr3
400 ; SDAG-NEXT:    s_and_saveexec_b64 s[6:7], s[4:5]
401 ; SDAG-NEXT:    s_xor_b64 s[10:11], exec, s[6:7]
402 ; SDAG-NEXT:    s_cbranch_execz .LBB1_7
403 ; SDAG-NEXT:  ; %bb.2: ; %fp-to-i-if-end9
404 ; SDAG-NEXT:    v_cndmask_b32_e64 v0, 0, 1, vcc
405 ; SDAG-NEXT:    v_add_co_u32_e64 v9, s[4:5], -1, v0
406 ; SDAG-NEXT:    s_mov_b64 s[4:5], 0x432
407 ; SDAG-NEXT:    v_and_b32_e32 v0, 0xfffff, v5
408 ; SDAG-NEXT:    v_cmp_lt_u64_e64 s[4:5], s[4:5], v[6:7]
409 ; SDAG-NEXT:    v_cndmask_b32_e64 v8, -1, 0, vcc
410 ; SDAG-NEXT:    v_cndmask_b32_e64 v10, -1, 1, vcc
411 ; SDAG-NEXT:    v_or_b32_e32 v5, 0x100000, v0
412 ; SDAG-NEXT:    ; implicit-def: $vgpr0_vgpr1
413 ; SDAG-NEXT:    ; implicit-def: $vgpr2_vgpr3
414 ; SDAG-NEXT:    s_and_saveexec_b64 s[6:7], s[4:5]
415 ; SDAG-NEXT:    s_xor_b64 s[12:13], exec, s[6:7]
416 ; SDAG-NEXT:    s_cbranch_execz .LBB1_4
417 ; SDAG-NEXT:  ; %bb.3: ; %fp-to-i-if-else
418 ; SDAG-NEXT:    v_sub_u32_e32 v0, 0x473, v6
419 ; SDAG-NEXT:    v_add_u32_e32 v2, 0xfffffb8d, v6
420 ; SDAG-NEXT:    v_add_u32_e32 v7, 0xfffffbcd, v6
421 ; SDAG-NEXT:    v_lshrrev_b64 v[0:1], v0, v[4:5]
422 ; SDAG-NEXT:    v_lshlrev_b64 v[2:3], v2, v[4:5]
423 ; SDAG-NEXT:    v_cmp_gt_u32_e64 s[4:5], 64, v7
424 ; SDAG-NEXT:    v_cndmask_b32_e64 v1, v3, v1, s[4:5]
425 ; SDAG-NEXT:    v_cmp_ne_u32_e64 s[6:7], 0, v7
426 ; SDAG-NEXT:    v_cndmask_b32_e64 v6, 0, v1, s[6:7]
427 ; SDAG-NEXT:    v_cndmask_b32_e64 v2, v2, v0, s[4:5]
428 ; SDAG-NEXT:    v_lshlrev_b64 v[0:1], v7, v[4:5]
429 ; SDAG-NEXT:    v_cndmask_b32_e64 v2, 0, v2, s[6:7]
430 ; SDAG-NEXT:    v_cndmask_b32_e64 v12, 0, v0, s[4:5]
431 ; SDAG-NEXT:    v_cndmask_b32_e64 v11, 0, v1, s[4:5]
432 ; SDAG-NEXT:    v_mad_u64_u32 v[0:1], s[4:5], v12, v10, 0
433 ; SDAG-NEXT:    v_mov_b32_e32 v3, 0
434 ; SDAG-NEXT:    v_mul_lo_u32 v13, v8, v2
435 ; SDAG-NEXT:    v_mad_u64_u32 v[4:5], s[4:5], v10, v2, 0
436 ; SDAG-NEXT:    v_mov_b32_e32 v2, v1
437 ; SDAG-NEXT:    v_mul_lo_u32 v14, v10, v6
438 ; SDAG-NEXT:    v_mad_u64_u32 v[6:7], s[4:5], v11, v10, v[2:3]
439 ; SDAG-NEXT:    ; implicit-def: $vgpr10
440 ; SDAG-NEXT:    v_add3_u32 v5, v5, v14, v13
441 ; SDAG-NEXT:    v_mov_b32_e32 v2, v6
442 ; SDAG-NEXT:    v_mad_u64_u32 v[1:2], s[4:5], v12, v8, v[2:3]
443 ; SDAG-NEXT:    v_mad_u64_u32 v[4:5], s[4:5], v9, v12, v[4:5]
444 ; SDAG-NEXT:    v_add_co_u32_e64 v2, s[4:5], v7, v2
445 ; SDAG-NEXT:    v_addc_co_u32_e64 v3, s[4:5], 0, 0, s[4:5]
446 ; SDAG-NEXT:    v_mul_lo_u32 v6, v9, v11
447 ; SDAG-NEXT:    v_mul_lo_u32 v9, v9, v12
448 ; SDAG-NEXT:    v_mad_u64_u32 v[2:3], s[4:5], v11, v8, v[2:3]
449 ; SDAG-NEXT:    ; implicit-def: $vgpr8
450 ; SDAG-NEXT:    v_add3_u32 v5, v9, v5, v6
451 ; SDAG-NEXT:    v_add_co_u32_e64 v2, s[4:5], v2, v4
452 ; SDAG-NEXT:    v_addc_co_u32_e64 v3, s[4:5], v3, v5, s[4:5]
453 ; SDAG-NEXT:    ; implicit-def: $vgpr6_vgpr7
454 ; SDAG-NEXT:    ; implicit-def: $vgpr4_vgpr5
455 ; SDAG-NEXT:    ; implicit-def: $vgpr9
456 ; SDAG-NEXT:  .LBB1_4: ; %Flow
457 ; SDAG-NEXT:    s_andn2_saveexec_b64 s[12:13], s[12:13]
458 ; SDAG-NEXT:    s_cbranch_execz .LBB1_6
459 ; SDAG-NEXT:  ; %bb.5: ; %fp-to-i-if-then12
460 ; SDAG-NEXT:    v_sub_u32_e32 v2, 0x433, v6
461 ; SDAG-NEXT:    v_lshrrev_b64 v[0:1], v2, v[4:5]
462 ; SDAG-NEXT:    v_cmp_gt_u32_e64 s[4:5], 64, v2
463 ; SDAG-NEXT:    v_cmp_eq_u32_e64 s[6:7], 0, v2
464 ; SDAG-NEXT:    v_cndmask_b32_e64 v0, 0, v0, s[4:5]
465 ; SDAG-NEXT:    v_cndmask_b32_e64 v1, 0, v1, s[4:5]
466 ; SDAG-NEXT:    v_cndmask_b32_e64 v6, v0, v4, s[6:7]
467 ; SDAG-NEXT:    v_cndmask_b32_e64 v5, v1, v5, s[6:7]
468 ; SDAG-NEXT:    v_mad_u64_u32 v[0:1], s[4:5], v6, v10, 0
469 ; SDAG-NEXT:    v_mov_b32_e32 v2, 0
470 ; SDAG-NEXT:    v_mad_u64_u32 v[3:4], s[4:5], v5, v10, v[1:2]
471 ; SDAG-NEXT:    v_mov_b32_e32 v1, v3
472 ; SDAG-NEXT:    v_mad_u64_u32 v[1:2], s[4:5], v6, v8, v[1:2]
473 ; SDAG-NEXT:    v_add_co_u32_e64 v2, s[4:5], v4, v2
474 ; SDAG-NEXT:    v_addc_co_u32_e64 v3, s[4:5], 0, 0, s[4:5]
475 ; SDAG-NEXT:    v_mad_u64_u32 v[2:3], s[4:5], v5, v8, v[2:3]
476 ; SDAG-NEXT:    v_mad_u64_u32 v[2:3], s[4:5], v9, v6, v[2:3]
477 ; SDAG-NEXT:    v_mad_u64_u32 v[3:4], s[4:5], v9, v6, v[3:4]
478 ; SDAG-NEXT:    v_mad_i32_i24 v3, v9, v5, v3
479 ; SDAG-NEXT:  .LBB1_6: ; %Flow1
480 ; SDAG-NEXT:    s_or_b64 exec, exec, s[12:13]
481 ; SDAG-NEXT:  .LBB1_7: ; %Flow2
482 ; SDAG-NEXT:    s_andn2_saveexec_b64 s[4:5], s[10:11]
483 ; SDAG-NEXT:  ; %bb.8: ; %fp-to-i-if-then5
484 ; SDAG-NEXT:    v_bfrev_b32_e32 v0, 1
485 ; SDAG-NEXT:    v_bfrev_b32_e32 v1, -2
486 ; SDAG-NEXT:    v_cndmask_b32_e64 v2, 0, -1, vcc
487 ; SDAG-NEXT:    v_cndmask_b32_e32 v3, v0, v1, vcc
488 ; SDAG-NEXT:    v_mov_b32_e32 v0, v2
489 ; SDAG-NEXT:    v_mov_b32_e32 v1, v2
490 ; SDAG-NEXT:  ; %bb.9: ; %Flow3
491 ; SDAG-NEXT:    s_or_b64 exec, exec, s[4:5]
492 ; SDAG-NEXT:  .LBB1_10: ; %fp-to-i-cleanup
493 ; SDAG-NEXT:    s_or_b64 exec, exec, s[8:9]
494 ; SDAG-NEXT:    s_setpc_b64 s[30:31]
496 ; GISEL-LABEL: fptoui_f64_to_i128:
497 ; GISEL:       ; %bb.0: ; %fp-to-i-entry
498 ; GISEL-NEXT:    s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
499 ; GISEL-NEXT:    v_mov_b32_e32 v5, v1
500 ; GISEL-NEXT:    v_mov_b32_e32 v4, v0
501 ; GISEL-NEXT:    v_lshrrev_b32_e32 v2, 20, v5
502 ; GISEL-NEXT:    v_mov_b32_e32 v0, 0x3ff
503 ; GISEL-NEXT:    s_mov_b64 s[4:5], 0
504 ; GISEL-NEXT:    v_mov_b32_e32 v7, 0
505 ; GISEL-NEXT:    v_mov_b32_e32 v1, 0
506 ; GISEL-NEXT:    v_and_b32_e32 v6, 0x7ff, v2
507 ; GISEL-NEXT:    v_cmp_ge_u64_e32 vcc, v[6:7], v[0:1]
508 ; GISEL-NEXT:    s_mov_b64 s[6:7], s[4:5]
509 ; GISEL-NEXT:    v_mov_b32_e32 v0, s4
510 ; GISEL-NEXT:    v_mov_b32_e32 v1, s5
511 ; GISEL-NEXT:    v_mov_b32_e32 v2, s6
512 ; GISEL-NEXT:    v_mov_b32_e32 v3, s7
513 ; GISEL-NEXT:    s_and_saveexec_b64 s[12:13], vcc
514 ; GISEL-NEXT:    s_cbranch_execz .LBB1_10
515 ; GISEL-NEXT:  ; %bb.1: ; %fp-to-i-if-end
516 ; GISEL-NEXT:    v_add_co_u32_e32 v0, vcc, 0xfffffb81, v6
517 ; GISEL-NEXT:    v_mov_b32_e32 v2, 0xffffff80
518 ; GISEL-NEXT:    v_addc_co_u32_e64 v1, s[6:7], 0, -1, vcc
519 ; GISEL-NEXT:    v_mov_b32_e32 v3, -1
520 ; GISEL-NEXT:    v_addc_co_u32_e64 v8, s[6:7], 0, -1, s[6:7]
521 ; GISEL-NEXT:    v_cmp_ge_u64_e32 vcc, v[0:1], v[2:3]
522 ; GISEL-NEXT:    v_addc_co_u32_e64 v9, s[6:7], 0, -1, s[6:7]
523 ; GISEL-NEXT:    v_cndmask_b32_e64 v0, 0, 1, vcc
524 ; GISEL-NEXT:    v_cmp_le_u64_e32 vcc, -1, v[8:9]
525 ; GISEL-NEXT:    v_cmp_lt_i64_e64 s[4:5], -1, v[4:5]
526 ; GISEL-NEXT:    v_cndmask_b32_e64 v1, 0, 1, vcc
527 ; GISEL-NEXT:    v_cmp_eq_u64_e32 vcc, -1, v[8:9]
528 ; GISEL-NEXT:    v_cndmask_b32_e32 v0, v1, v0, vcc
529 ; GISEL-NEXT:    v_and_b32_e32 v0, 1, v0
530 ; GISEL-NEXT:    v_cmp_ne_u32_e32 vcc, 0, v0
531 ; GISEL-NEXT:    ; implicit-def: $vgpr0_vgpr1_vgpr2_vgpr3
532 ; GISEL-NEXT:    s_and_saveexec_b64 s[6:7], vcc
533 ; GISEL-NEXT:    s_xor_b64 s[14:15], exec, s[6:7]
534 ; GISEL-NEXT:    s_cbranch_execz .LBB1_7
535 ; GISEL-NEXT:  ; %bb.2: ; %fp-to-i-if-end9
536 ; GISEL-NEXT:    s_xor_b64 s[6:7], s[4:5], -1
537 ; GISEL-NEXT:    v_cndmask_b32_e64 v0, 0, -1, s[6:7]
538 ; GISEL-NEXT:    v_and_b32_e32 v0, 1, v0
539 ; GISEL-NEXT:    v_cndmask_b32_e64 v1, 0, 1, s[6:7]
540 ; GISEL-NEXT:    v_lshlrev_b16_e32 v2, 1, v0
541 ; GISEL-NEXT:    v_or_b32_e32 v1, v1, v2
542 ; GISEL-NEXT:    v_lshlrev_b16_e32 v3, 2, v0
543 ; GISEL-NEXT:    v_or_b32_e32 v2, v0, v2
544 ; GISEL-NEXT:    v_or_b32_e32 v1, v1, v3
545 ; GISEL-NEXT:    v_lshlrev_b16_e32 v8, 3, v0
546 ; GISEL-NEXT:    v_or_b32_e32 v2, v2, v3
547 ; GISEL-NEXT:    v_or_b32_e32 v1, v1, v8
548 ; GISEL-NEXT:    v_lshlrev_b16_e32 v9, 4, v0
549 ; GISEL-NEXT:    v_or_b32_e32 v2, v2, v8
550 ; GISEL-NEXT:    v_or_b32_e32 v1, v1, v9
551 ; GISEL-NEXT:    v_lshlrev_b16_e32 v10, 5, v0
552 ; GISEL-NEXT:    v_or_b32_e32 v2, v2, v9
553 ; GISEL-NEXT:    v_or_b32_e32 v1, v1, v10
554 ; GISEL-NEXT:    v_lshlrev_b16_e32 v11, 6, v0
555 ; GISEL-NEXT:    v_or_b32_e32 v2, v2, v10
556 ; GISEL-NEXT:    v_or_b32_e32 v1, v1, v11
557 ; GISEL-NEXT:    v_lshlrev_b16_e32 v12, 7, v0
558 ; GISEL-NEXT:    v_or_b32_e32 v2, v2, v11
559 ; GISEL-NEXT:    v_or_b32_e32 v1, v1, v12
560 ; GISEL-NEXT:    v_lshlrev_b16_e32 v13, 8, v0
561 ; GISEL-NEXT:    v_or_b32_e32 v2, v2, v12
562 ; GISEL-NEXT:    v_or_b32_e32 v1, v1, v13
563 ; GISEL-NEXT:    v_lshlrev_b16_e32 v14, 9, v0
564 ; GISEL-NEXT:    v_or_b32_e32 v2, v2, v13
565 ; GISEL-NEXT:    v_or_b32_e32 v1, v1, v14
566 ; GISEL-NEXT:    v_lshlrev_b16_e32 v15, 10, v0
567 ; GISEL-NEXT:    v_or_b32_e32 v2, v2, v14
568 ; GISEL-NEXT:    v_or_b32_e32 v1, v1, v15
569 ; GISEL-NEXT:    v_lshlrev_b16_e32 v16, 11, v0
570 ; GISEL-NEXT:    v_or_b32_e32 v2, v2, v15
571 ; GISEL-NEXT:    v_or_b32_e32 v1, v1, v16
572 ; GISEL-NEXT:    v_lshlrev_b16_e32 v17, 12, v0
573 ; GISEL-NEXT:    v_or_b32_e32 v2, v2, v16
574 ; GISEL-NEXT:    v_or_b32_e32 v1, v1, v17
575 ; GISEL-NEXT:    v_lshlrev_b16_e32 v18, 13, v0
576 ; GISEL-NEXT:    v_or_b32_e32 v2, v2, v17
577 ; GISEL-NEXT:    v_or_b32_e32 v1, v1, v18
578 ; GISEL-NEXT:    v_lshlrev_b16_e32 v19, 14, v0
579 ; GISEL-NEXT:    v_or_b32_e32 v2, v2, v18
580 ; GISEL-NEXT:    v_or_b32_e32 v1, v1, v19
581 ; GISEL-NEXT:    v_lshlrev_b16_e32 v0, 15, v0
582 ; GISEL-NEXT:    v_or_b32_e32 v2, v2, v19
583 ; GISEL-NEXT:    v_or_b32_e32 v1, v1, v0
584 ; GISEL-NEXT:    v_or_b32_e32 v0, v2, v0
585 ; GISEL-NEXT:    v_and_b32_e32 v0, 0xffff, v0
586 ; GISEL-NEXT:    v_and_b32_e32 v1, 0xffff, v1
587 ; GISEL-NEXT:    v_lshlrev_b32_e32 v2, 16, v0
588 ; GISEL-NEXT:    v_lshl_or_b32 v10, v0, 16, v0
589 ; GISEL-NEXT:    v_or3_b32 v8, v1, v2, 1
590 ; GISEL-NEXT:    v_or3_b32 v9, v0, v2, 0
591 ; GISEL-NEXT:    v_mov_b32_e32 v0, 0x433
592 ; GISEL-NEXT:    v_mov_b32_e32 v1, 0
593 ; GISEL-NEXT:    v_and_b32_e32 v2, 0xfffff, v5
594 ; GISEL-NEXT:    v_cmp_ge_u64_e32 vcc, v[6:7], v[0:1]
595 ; GISEL-NEXT:    v_or_b32_e32 v5, 0x100000, v2
596 ; GISEL-NEXT:    ; implicit-def: $vgpr0_vgpr1_vgpr2_vgpr3
597 ; GISEL-NEXT:    s_and_saveexec_b64 s[6:7], vcc
598 ; GISEL-NEXT:    s_xor_b64 s[16:17], exec, s[6:7]
599 ; GISEL-NEXT:    s_cbranch_execz .LBB1_4
600 ; GISEL-NEXT:  ; %bb.3: ; %fp-to-i-if-else
601 ; GISEL-NEXT:    v_add_u32_e32 v7, 0xfffffbcd, v6
602 ; GISEL-NEXT:    v_lshlrev_b64 v[0:1], v7, v[4:5]
603 ; GISEL-NEXT:    v_cmp_gt_u32_e32 vcc, 64, v7
604 ; GISEL-NEXT:    v_cndmask_b32_e32 v11, 0, v0, vcc
605 ; GISEL-NEXT:    v_cndmask_b32_e32 v12, 0, v1, vcc
606 ; GISEL-NEXT:    v_mad_u64_u32 v[0:1], s[6:7], v11, v10, 0
607 ; GISEL-NEXT:    v_add_u32_e32 v6, 0xfffffb8d, v6
608 ; GISEL-NEXT:    v_sub_u32_e32 v2, 64, v7
609 ; GISEL-NEXT:    v_lshrrev_b64 v[2:3], v2, v[4:5]
610 ; GISEL-NEXT:    v_lshlrev_b64 v[4:5], v6, v[4:5]
611 ; GISEL-NEXT:    v_cmp_eq_u32_e64 s[6:7], 0, v7
612 ; GISEL-NEXT:    v_mad_u64_u32 v[6:7], s[8:9], v12, v9, v[0:1]
613 ; GISEL-NEXT:    v_cndmask_b32_e32 v2, v4, v2, vcc
614 ; GISEL-NEXT:    v_cndmask_b32_e64 v13, v2, 0, s[6:7]
615 ; GISEL-NEXT:    v_mad_u64_u32 v[6:7], s[8:9], v13, v8, v[6:7]
616 ; GISEL-NEXT:    v_mad_u64_u32 v[0:1], s[8:9], v11, v8, 0
617 ; GISEL-NEXT:    v_mov_b32_e32 v2, v6
618 ; GISEL-NEXT:    v_mul_lo_u32 v6, v11, v10
619 ; GISEL-NEXT:    v_mad_u64_u32 v[1:2], s[8:9], v11, v9, v[1:2]
620 ; GISEL-NEXT:    v_mul_lo_u32 v4, v12, v10
621 ; GISEL-NEXT:    v_cndmask_b32_e32 v3, v5, v3, vcc
622 ; GISEL-NEXT:    v_mad_u64_u32 v[1:2], s[10:11], v12, v8, v[1:2]
623 ; GISEL-NEXT:    v_addc_co_u32_e64 v6, s[10:11], v7, v6, s[10:11]
624 ; GISEL-NEXT:    v_addc_co_u32_e64 v4, s[8:9], v6, v4, s[8:9]
625 ; GISEL-NEXT:    v_mad_u64_u32 v[6:7], s[8:9], v13, v9, v[4:5]
626 ; GISEL-NEXT:    v_cndmask_b32_e64 v3, v3, 0, s[6:7]
627 ; GISEL-NEXT:    ; implicit-def: $vgpr10
628 ; GISEL-NEXT:    ; implicit-def: $vgpr9
629 ; GISEL-NEXT:    v_mad_u64_u32 v[3:4], s[6:7], v3, v8, v[6:7]
630 ; GISEL-NEXT:    ; implicit-def: $vgpr6
631 ; GISEL-NEXT:    ; implicit-def: $vgpr4_vgpr5
632 ; GISEL-NEXT:    ; implicit-def: $vgpr8
633 ; GISEL-NEXT:  .LBB1_4: ; %Flow
634 ; GISEL-NEXT:    s_andn2_saveexec_b64 s[8:9], s[16:17]
635 ; GISEL-NEXT:    s_cbranch_execz .LBB1_6
636 ; GISEL-NEXT:  ; %bb.5: ; %fp-to-i-if-then12
637 ; GISEL-NEXT:    v_sub_co_u32_e32 v2, vcc, 0x433, v6
638 ; GISEL-NEXT:    v_lshrrev_b64 v[0:1], v2, v[4:5]
639 ; GISEL-NEXT:    v_cmp_gt_u32_e32 vcc, 64, v2
640 ; GISEL-NEXT:    v_cndmask_b32_e32 v0, 0, v0, vcc
641 ; GISEL-NEXT:    v_cndmask_b32_e32 v1, 0, v1, vcc
642 ; GISEL-NEXT:    v_cmp_eq_u32_e32 vcc, 0, v2
643 ; GISEL-NEXT:    v_cndmask_b32_e32 v4, v0, v4, vcc
644 ; GISEL-NEXT:    v_mad_u64_u32 v[2:3], s[6:7], v4, v10, 0
645 ; GISEL-NEXT:    v_cndmask_b32_e32 v5, v1, v5, vcc
646 ; GISEL-NEXT:    v_mad_u64_u32 v[0:1], s[6:7], v4, v8, 0
647 ; GISEL-NEXT:    v_mad_u64_u32 v[2:3], s[6:7], v5, v9, v[2:3]
648 ; GISEL-NEXT:    v_mul_lo_u32 v6, v5, v10
649 ; GISEL-NEXT:    v_mad_u64_u32 v[1:2], vcc, v4, v9, v[1:2]
650 ; GISEL-NEXT:    v_mul_lo_u32 v4, v4, v10
651 ; GISEL-NEXT:    v_mad_u64_u32 v[1:2], s[6:7], v5, v8, v[1:2]
652 ; GISEL-NEXT:    v_addc_co_u32_e64 v3, s[6:7], v3, v4, s[6:7]
653 ; GISEL-NEXT:    v_addc_co_u32_e32 v3, vcc, v3, v6, vcc
654 ; GISEL-NEXT:  .LBB1_6: ; %Flow1
655 ; GISEL-NEXT:    s_or_b64 exec, exec, s[8:9]
656 ; GISEL-NEXT:  .LBB1_7: ; %Flow2
657 ; GISEL-NEXT:    s_andn2_saveexec_b64 s[6:7], s[14:15]
658 ; GISEL-NEXT:    s_cbranch_execz .LBB1_9
659 ; GISEL-NEXT:  ; %bb.8: ; %fp-to-i-if-then5
660 ; GISEL-NEXT:    v_cndmask_b32_e64 v1, 0, -1, s[4:5]
661 ; GISEL-NEXT:    v_and_b32_e32 v1, 1, v1
662 ; GISEL-NEXT:    v_cndmask_b32_e64 v0, 0, 1, s[4:5]
663 ; GISEL-NEXT:    v_lshlrev_b32_e32 v2, 1, v1
664 ; GISEL-NEXT:    v_or_b32_e32 v0, v0, v2
665 ; GISEL-NEXT:    v_lshlrev_b32_e32 v3, 2, v1
666 ; GISEL-NEXT:    v_lshlrev_b32_e32 v4, 3, v1
667 ; GISEL-NEXT:    v_or_b32_e32 v2, v1, v2
668 ; GISEL-NEXT:    v_or3_b32 v0, v0, v3, v4
669 ; GISEL-NEXT:    v_lshlrev_b32_e32 v5, 4, v1
670 ; GISEL-NEXT:    v_lshlrev_b32_e32 v6, 5, v1
671 ; GISEL-NEXT:    v_or3_b32 v2, v2, v3, v4
672 ; GISEL-NEXT:    v_or3_b32 v0, v0, v5, v6
673 ; GISEL-NEXT:    v_lshlrev_b32_e32 v7, 6, v1
674 ; GISEL-NEXT:    v_lshlrev_b32_e32 v8, 7, v1
675 ; GISEL-NEXT:    v_or3_b32 v2, v2, v5, v6
676 ; GISEL-NEXT:    v_or3_b32 v0, v0, v7, v8
677 ; GISEL-NEXT:    v_lshlrev_b32_e32 v9, 8, v1
678 ; GISEL-NEXT:    v_lshlrev_b32_e32 v10, 9, v1
679 ; GISEL-NEXT:    v_or3_b32 v2, v2, v7, v8
680 ; GISEL-NEXT:    v_or3_b32 v0, v0, v9, v10
681 ; GISEL-NEXT:    v_lshlrev_b32_e32 v11, 10, v1
682 ; GISEL-NEXT:    v_lshlrev_b32_e32 v12, 11, v1
683 ; GISEL-NEXT:    v_or3_b32 v2, v2, v9, v10
684 ; GISEL-NEXT:    v_or3_b32 v0, v0, v11, v12
685 ; GISEL-NEXT:    v_lshlrev_b32_e32 v13, 12, v1
686 ; GISEL-NEXT:    v_lshlrev_b32_e32 v14, 13, v1
687 ; GISEL-NEXT:    v_or3_b32 v2, v2, v11, v12
688 ; GISEL-NEXT:    v_or3_b32 v0, v0, v13, v14
689 ; GISEL-NEXT:    v_lshlrev_b32_e32 v15, 14, v1
690 ; GISEL-NEXT:    v_lshlrev_b32_e32 v16, 15, v1
691 ; GISEL-NEXT:    v_or3_b32 v2, v2, v13, v14
692 ; GISEL-NEXT:    v_or3_b32 v0, v0, v15, v16
693 ; GISEL-NEXT:    v_lshlrev_b32_e32 v17, 16, v1
694 ; GISEL-NEXT:    v_lshlrev_b32_e32 v18, 17, v1
695 ; GISEL-NEXT:    v_or3_b32 v2, v2, v15, v16
696 ; GISEL-NEXT:    v_or3_b32 v0, v0, v17, v18
697 ; GISEL-NEXT:    v_lshlrev_b32_e32 v19, 18, v1
698 ; GISEL-NEXT:    v_lshlrev_b32_e32 v3, 19, v1
699 ; GISEL-NEXT:    v_or3_b32 v2, v2, v17, v18
700 ; GISEL-NEXT:    v_or3_b32 v0, v0, v19, v3
701 ; GISEL-NEXT:    v_lshlrev_b32_e32 v4, 20, v1
702 ; GISEL-NEXT:    v_lshlrev_b32_e32 v5, 21, v1
703 ; GISEL-NEXT:    v_or3_b32 v2, v2, v19, v3
704 ; GISEL-NEXT:    v_or3_b32 v0, v0, v4, v5
705 ; GISEL-NEXT:    v_lshlrev_b32_e32 v6, 22, v1
706 ; GISEL-NEXT:    v_lshlrev_b32_e32 v7, 23, v1
707 ; GISEL-NEXT:    v_or3_b32 v2, v2, v4, v5
708 ; GISEL-NEXT:    v_or3_b32 v0, v0, v6, v7
709 ; GISEL-NEXT:    v_lshlrev_b32_e32 v8, 24, v1
710 ; GISEL-NEXT:    v_lshlrev_b32_e32 v9, 25, v1
711 ; GISEL-NEXT:    v_or3_b32 v2, v2, v6, v7
712 ; GISEL-NEXT:    v_or3_b32 v0, v0, v8, v9
713 ; GISEL-NEXT:    v_lshlrev_b32_e32 v10, 26, v1
714 ; GISEL-NEXT:    v_lshlrev_b32_e32 v11, 27, v1
715 ; GISEL-NEXT:    v_or3_b32 v2, v2, v8, v9
716 ; GISEL-NEXT:    v_or3_b32 v0, v0, v10, v11
717 ; GISEL-NEXT:    v_lshlrev_b32_e32 v12, 28, v1
718 ; GISEL-NEXT:    v_lshlrev_b32_e32 v13, 29, v1
719 ; GISEL-NEXT:    v_or3_b32 v2, v2, v10, v11
720 ; GISEL-NEXT:    v_or3_b32 v0, v0, v12, v13
721 ; GISEL-NEXT:    v_lshlrev_b32_e32 v14, 30, v1
722 ; GISEL-NEXT:    v_lshlrev_b32_e32 v1, 31, v1
723 ; GISEL-NEXT:    v_or3_b32 v2, v2, v12, v13
724 ; GISEL-NEXT:    v_or3_b32 v0, v0, v14, v1
725 ; GISEL-NEXT:    v_or3_b32 v1, v2, v14, v1
726 ; GISEL-NEXT:    v_add_u32_e32 v3, 0x80000000, v1
727 ; GISEL-NEXT:    v_mov_b32_e32 v2, v1
728 ; GISEL-NEXT:  .LBB1_9: ; %Flow3
729 ; GISEL-NEXT:    s_or_b64 exec, exec, s[6:7]
730 ; GISEL-NEXT:  .LBB1_10: ; %fp-to-i-cleanup
731 ; GISEL-NEXT:    s_or_b64 exec, exec, s[12:13]
732 ; GISEL-NEXT:    s_setpc_b64 s[30:31]
733   %cvt = fptoui double %x to i128
734   ret i128 %cvt
737 define i128 @fptosi_f32_to_i128(float %x) {
738 ; SDAG-LABEL: fptosi_f32_to_i128:
739 ; SDAG:       ; %bb.0: ; %fp-to-i-entry
740 ; SDAG-NEXT:    s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
741 ; SDAG-NEXT:    v_mov_b32_e32 v4, v0
742 ; SDAG-NEXT:    v_bfe_u32 v6, v4, 23, 8
743 ; SDAG-NEXT:    s_movk_i32 s4, 0x7e
744 ; SDAG-NEXT:    v_mov_b32_e32 v0, 0
745 ; SDAG-NEXT:    v_mov_b32_e32 v2, 0
746 ; SDAG-NEXT:    v_mov_b32_e32 v7, 0
747 ; SDAG-NEXT:    v_mov_b32_e32 v1, 0
748 ; SDAG-NEXT:    v_mov_b32_e32 v3, 0
749 ; SDAG-NEXT:    v_cmp_lt_u32_e32 vcc, s4, v6
750 ; SDAG-NEXT:    s_and_saveexec_b64 s[8:9], vcc
751 ; SDAG-NEXT:    s_cbranch_execz .LBB2_10
752 ; SDAG-NEXT:  ; %bb.1: ; %fp-to-i-if-end
753 ; SDAG-NEXT:    v_add_co_u32_e32 v0, vcc, 0xffffff01, v6
754 ; SDAG-NEXT:    v_addc_co_u32_e32 v1, vcc, -1, v7, vcc
755 ; SDAG-NEXT:    v_addc_co_u32_e32 v2, vcc, -1, v7, vcc
756 ; SDAG-NEXT:    s_movk_i32 s6, 0xff7f
757 ; SDAG-NEXT:    v_addc_co_u32_e32 v3, vcc, -1, v7, vcc
758 ; SDAG-NEXT:    s_mov_b32 s7, -1
759 ; SDAG-NEXT:    v_cmp_eq_u64_e64 s[4:5], -1, v[2:3]
760 ; SDAG-NEXT:    v_cmp_lt_u64_e64 s[6:7], s[6:7], v[0:1]
761 ; SDAG-NEXT:    v_cmp_lt_i32_e32 vcc, -1, v4
762 ; SDAG-NEXT:    s_and_b64 s[4:5], s[4:5], s[6:7]
763 ; SDAG-NEXT:    ; implicit-def: $vgpr0_vgpr1
764 ; SDAG-NEXT:    ; implicit-def: $vgpr2_vgpr3
765 ; SDAG-NEXT:    s_and_saveexec_b64 s[6:7], s[4:5]
766 ; SDAG-NEXT:    s_xor_b64 s[10:11], exec, s[6:7]
767 ; SDAG-NEXT:    s_cbranch_execz .LBB2_7
768 ; SDAG-NEXT:  ; %bb.2: ; %fp-to-i-if-end9
769 ; SDAG-NEXT:    v_cndmask_b32_e64 v0, 0, 1, vcc
770 ; SDAG-NEXT:    v_add_co_u32_e64 v9, s[4:5], -1, v0
771 ; SDAG-NEXT:    s_mov_b64 s[4:5], 0x95
772 ; SDAG-NEXT:    v_and_b32_e32 v0, 0x7fffff, v4
773 ; SDAG-NEXT:    v_cmp_lt_u64_e64 s[4:5], s[4:5], v[6:7]
774 ; SDAG-NEXT:    v_mov_b32_e32 v5, 0
775 ; SDAG-NEXT:    v_cndmask_b32_e64 v8, -1, 0, vcc
776 ; SDAG-NEXT:    v_cndmask_b32_e64 v10, -1, 1, vcc
777 ; SDAG-NEXT:    v_or_b32_e32 v4, 0x800000, v0
778 ; SDAG-NEXT:    ; implicit-def: $vgpr0_vgpr1
779 ; SDAG-NEXT:    ; implicit-def: $vgpr2_vgpr3
780 ; SDAG-NEXT:    s_and_saveexec_b64 s[6:7], s[4:5]
781 ; SDAG-NEXT:    s_xor_b64 s[12:13], exec, s[6:7]
782 ; SDAG-NEXT:    s_cbranch_execz .LBB2_4
783 ; SDAG-NEXT:  ; %bb.3: ; %fp-to-i-if-else
784 ; SDAG-NEXT:    v_sub_u32_e32 v0, 0xd6, v6
785 ; SDAG-NEXT:    v_add_u32_e32 v2, 0xffffff2a, v6
786 ; SDAG-NEXT:    v_add_u32_e32 v7, 0xffffff6a, v6
787 ; SDAG-NEXT:    v_lshrrev_b64 v[0:1], v0, v[4:5]
788 ; SDAG-NEXT:    v_lshlrev_b64 v[2:3], v2, v[4:5]
789 ; SDAG-NEXT:    v_cmp_gt_u32_e64 s[4:5], 64, v7
790 ; SDAG-NEXT:    v_cndmask_b32_e64 v1, v3, v1, s[4:5]
791 ; SDAG-NEXT:    v_cmp_ne_u32_e64 s[6:7], 0, v7
792 ; SDAG-NEXT:    v_cndmask_b32_e64 v3, 0, v1, s[6:7]
793 ; SDAG-NEXT:    v_cndmask_b32_e64 v2, v2, v0, s[4:5]
794 ; SDAG-NEXT:    v_lshlrev_b64 v[0:1], v7, v[4:5]
795 ; SDAG-NEXT:    v_cndmask_b32_e64 v2, 0, v2, s[6:7]
796 ; SDAG-NEXT:    v_cndmask_b32_e64 v12, 0, v0, s[4:5]
797 ; SDAG-NEXT:    v_cndmask_b32_e64 v11, 0, v1, s[4:5]
798 ; SDAG-NEXT:    v_mad_u64_u32 v[0:1], s[4:5], v12, v10, 0
799 ; SDAG-NEXT:    v_mul_lo_u32 v13, v8, v2
800 ; SDAG-NEXT:    v_mul_lo_u32 v14, v10, v3
801 ; SDAG-NEXT:    v_mov_b32_e32 v4, v1
802 ; SDAG-NEXT:    v_mad_u64_u32 v[6:7], s[4:5], v11, v10, v[4:5]
803 ; SDAG-NEXT:    v_mad_u64_u32 v[2:3], s[4:5], v10, v2, 0
804 ; SDAG-NEXT:    v_mov_b32_e32 v4, v6
805 ; SDAG-NEXT:    v_mad_u64_u32 v[4:5], s[4:5], v12, v8, v[4:5]
806 ; SDAG-NEXT:    v_add3_u32 v3, v3, v14, v13
807 ; SDAG-NEXT:    v_mad_u64_u32 v[1:2], s[4:5], v9, v12, v[2:3]
808 ; SDAG-NEXT:    v_add_co_u32_e64 v5, s[4:5], v7, v5
809 ; SDAG-NEXT:    v_addc_co_u32_e64 v6, s[4:5], 0, 0, s[4:5]
810 ; SDAG-NEXT:    v_mul_lo_u32 v3, v9, v11
811 ; SDAG-NEXT:    v_mul_lo_u32 v9, v9, v12
812 ; SDAG-NEXT:    v_mad_u64_u32 v[5:6], s[4:5], v11, v8, v[5:6]
813 ; SDAG-NEXT:    ; implicit-def: $vgpr10
814 ; SDAG-NEXT:    ; implicit-def: $vgpr8
815 ; SDAG-NEXT:    v_add3_u32 v3, v9, v2, v3
816 ; SDAG-NEXT:    v_add_co_u32_e64 v2, s[4:5], v5, v1
817 ; SDAG-NEXT:    v_addc_co_u32_e64 v3, s[4:5], v6, v3, s[4:5]
818 ; SDAG-NEXT:    v_mov_b32_e32 v1, v4
819 ; SDAG-NEXT:    ; implicit-def: $vgpr6_vgpr7
820 ; SDAG-NEXT:    ; implicit-def: $vgpr4_vgpr5
821 ; SDAG-NEXT:    ; implicit-def: $vgpr9
822 ; SDAG-NEXT:  .LBB2_4: ; %Flow
823 ; SDAG-NEXT:    s_andn2_saveexec_b64 s[6:7], s[12:13]
824 ; SDAG-NEXT:    s_cbranch_execz .LBB2_6
825 ; SDAG-NEXT:  ; %bb.5: ; %fp-to-i-if-then12
826 ; SDAG-NEXT:    v_sub_u32_e32 v2, 0x96, v6
827 ; SDAG-NEXT:    v_lshrrev_b64 v[0:1], v2, v[4:5]
828 ; SDAG-NEXT:    v_cmp_gt_u32_e64 s[4:5], 64, v2
829 ; SDAG-NEXT:    v_cndmask_b32_e64 v0, 0, v0, s[4:5]
830 ; SDAG-NEXT:    v_cmp_eq_u32_e64 s[4:5], 0, v2
831 ; SDAG-NEXT:    v_cndmask_b32_e64 v3, v0, v4, s[4:5]
832 ; SDAG-NEXT:    v_mad_u64_u32 v[0:1], s[4:5], v3, v10, 0
833 ; SDAG-NEXT:    v_mov_b32_e32 v2, 0
834 ; SDAG-NEXT:    v_mad_u64_u32 v[4:5], s[4:5], v3, v8, v[1:2]
835 ; SDAG-NEXT:    v_mov_b32_e32 v1, v5
836 ; SDAG-NEXT:    v_mad_i64_i32 v[2:3], s[4:5], v9, v3, v[1:2]
837 ; SDAG-NEXT:    v_mov_b32_e32 v1, v4
838 ; SDAG-NEXT:  .LBB2_6: ; %Flow1
839 ; SDAG-NEXT:    s_or_b64 exec, exec, s[6:7]
840 ; SDAG-NEXT:  .LBB2_7: ; %Flow2
841 ; SDAG-NEXT:    s_andn2_saveexec_b64 s[4:5], s[10:11]
842 ; SDAG-NEXT:  ; %bb.8: ; %fp-to-i-if-then5
843 ; SDAG-NEXT:    v_bfrev_b32_e32 v0, 1
844 ; SDAG-NEXT:    v_bfrev_b32_e32 v1, -2
845 ; SDAG-NEXT:    v_cndmask_b32_e64 v2, 0, -1, vcc
846 ; SDAG-NEXT:    v_cndmask_b32_e32 v3, v0, v1, vcc
847 ; SDAG-NEXT:    v_mov_b32_e32 v0, v2
848 ; SDAG-NEXT:    v_mov_b32_e32 v1, v2
849 ; SDAG-NEXT:  ; %bb.9: ; %Flow3
850 ; SDAG-NEXT:    s_or_b64 exec, exec, s[4:5]
851 ; SDAG-NEXT:  .LBB2_10: ; %fp-to-i-cleanup
852 ; SDAG-NEXT:    s_or_b64 exec, exec, s[8:9]
853 ; SDAG-NEXT:    s_setpc_b64 s[30:31]
855 ; GISEL-LABEL: fptosi_f32_to_i128:
856 ; GISEL:       ; %bb.0: ; %fp-to-i-entry
857 ; GISEL-NEXT:    s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
858 ; GISEL-NEXT:    v_mov_b32_e32 v4, v0
859 ; GISEL-NEXT:    v_mov_b32_e32 v5, 0
860 ; GISEL-NEXT:    v_lshrrev_b64 v[0:1], 23, v[4:5]
861 ; GISEL-NEXT:    s_mov_b64 s[4:5], 0
862 ; GISEL-NEXT:    v_bfe_u32 v6, v0, 0, 8
863 ; GISEL-NEXT:    v_mov_b32_e32 v0, 0x7f
864 ; GISEL-NEXT:    v_mov_b32_e32 v1, 0
865 ; GISEL-NEXT:    v_mov_b32_e32 v7, v5
866 ; GISEL-NEXT:    v_cmp_ge_u64_e32 vcc, v[6:7], v[0:1]
867 ; GISEL-NEXT:    s_mov_b64 s[6:7], s[4:5]
868 ; GISEL-NEXT:    v_mov_b32_e32 v0, s4
869 ; GISEL-NEXT:    v_mov_b32_e32 v1, s5
870 ; GISEL-NEXT:    v_mov_b32_e32 v2, s6
871 ; GISEL-NEXT:    v_mov_b32_e32 v3, s7
872 ; GISEL-NEXT:    s_and_saveexec_b64 s[12:13], vcc
873 ; GISEL-NEXT:    s_cbranch_execz .LBB2_10
874 ; GISEL-NEXT:  ; %bb.1: ; %fp-to-i-if-end
875 ; GISEL-NEXT:    v_add_co_u32_e32 v0, vcc, 0xffffff01, v6
876 ; GISEL-NEXT:    v_mov_b32_e32 v2, 0xffffff80
877 ; GISEL-NEXT:    v_addc_co_u32_e64 v1, s[6:7], 0, -1, vcc
878 ; GISEL-NEXT:    v_mov_b32_e32 v3, -1
879 ; GISEL-NEXT:    v_addc_co_u32_e64 v8, s[6:7], 0, -1, s[6:7]
880 ; GISEL-NEXT:    v_cmp_ge_u64_e32 vcc, v[0:1], v[2:3]
881 ; GISEL-NEXT:    v_addc_co_u32_e64 v9, s[6:7], 0, -1, s[6:7]
882 ; GISEL-NEXT:    v_cndmask_b32_e64 v0, 0, 1, vcc
883 ; GISEL-NEXT:    v_cmp_le_u64_e32 vcc, -1, v[8:9]
884 ; GISEL-NEXT:    v_cmp_lt_i32_e64 s[4:5], -1, v4
885 ; GISEL-NEXT:    v_cndmask_b32_e64 v1, 0, 1, vcc
886 ; GISEL-NEXT:    v_cmp_eq_u64_e32 vcc, -1, v[8:9]
887 ; GISEL-NEXT:    v_cndmask_b32_e32 v0, v1, v0, vcc
888 ; GISEL-NEXT:    v_and_b32_e32 v0, 1, v0
889 ; GISEL-NEXT:    v_cmp_ne_u32_e32 vcc, 0, v0
890 ; GISEL-NEXT:    ; implicit-def: $vgpr0_vgpr1_vgpr2_vgpr3
891 ; GISEL-NEXT:    s_and_saveexec_b64 s[6:7], vcc
892 ; GISEL-NEXT:    s_xor_b64 s[14:15], exec, s[6:7]
893 ; GISEL-NEXT:    s_cbranch_execz .LBB2_7
894 ; GISEL-NEXT:  ; %bb.2: ; %fp-to-i-if-end9
895 ; GISEL-NEXT:    s_xor_b64 s[6:7], s[4:5], -1
896 ; GISEL-NEXT:    v_cndmask_b32_e64 v0, 0, -1, s[6:7]
897 ; GISEL-NEXT:    v_and_b32_e32 v0, 1, v0
898 ; GISEL-NEXT:    v_cndmask_b32_e64 v1, 0, 1, s[6:7]
899 ; GISEL-NEXT:    v_lshlrev_b16_e32 v2, 1, v0
900 ; GISEL-NEXT:    v_or_b32_e32 v1, v1, v2
901 ; GISEL-NEXT:    v_lshlrev_b16_e32 v3, 2, v0
902 ; GISEL-NEXT:    v_or_b32_e32 v2, v0, v2
903 ; GISEL-NEXT:    v_or_b32_e32 v1, v1, v3
904 ; GISEL-NEXT:    v_lshlrev_b16_e32 v5, 3, v0
905 ; GISEL-NEXT:    v_or_b32_e32 v2, v2, v3
906 ; GISEL-NEXT:    v_or_b32_e32 v1, v1, v5
907 ; GISEL-NEXT:    v_lshlrev_b16_e32 v8, 4, v0
908 ; GISEL-NEXT:    v_or_b32_e32 v2, v2, v5
909 ; GISEL-NEXT:    v_or_b32_e32 v1, v1, v8
910 ; GISEL-NEXT:    v_lshlrev_b16_e32 v9, 5, v0
911 ; GISEL-NEXT:    v_or_b32_e32 v2, v2, v8
912 ; GISEL-NEXT:    v_or_b32_e32 v1, v1, v9
913 ; GISEL-NEXT:    v_lshlrev_b16_e32 v10, 6, v0
914 ; GISEL-NEXT:    v_or_b32_e32 v2, v2, v9
915 ; GISEL-NEXT:    v_or_b32_e32 v1, v1, v10
916 ; GISEL-NEXT:    v_lshlrev_b16_e32 v11, 7, v0
917 ; GISEL-NEXT:    v_or_b32_e32 v2, v2, v10
918 ; GISEL-NEXT:    v_or_b32_e32 v1, v1, v11
919 ; GISEL-NEXT:    v_lshlrev_b16_e32 v12, 8, v0
920 ; GISEL-NEXT:    v_or_b32_e32 v2, v2, v11
921 ; GISEL-NEXT:    v_or_b32_e32 v1, v1, v12
922 ; GISEL-NEXT:    v_lshlrev_b16_e32 v13, 9, v0
923 ; GISEL-NEXT:    v_or_b32_e32 v2, v2, v12
924 ; GISEL-NEXT:    v_or_b32_e32 v1, v1, v13
925 ; GISEL-NEXT:    v_lshlrev_b16_e32 v14, 10, v0
926 ; GISEL-NEXT:    v_or_b32_e32 v2, v2, v13
927 ; GISEL-NEXT:    v_or_b32_e32 v1, v1, v14
928 ; GISEL-NEXT:    v_lshlrev_b16_e32 v15, 11, v0
929 ; GISEL-NEXT:    v_or_b32_e32 v2, v2, v14
930 ; GISEL-NEXT:    v_or_b32_e32 v1, v1, v15
931 ; GISEL-NEXT:    v_lshlrev_b16_e32 v16, 12, v0
932 ; GISEL-NEXT:    v_or_b32_e32 v2, v2, v15
933 ; GISEL-NEXT:    v_or_b32_e32 v1, v1, v16
934 ; GISEL-NEXT:    v_lshlrev_b16_e32 v17, 13, v0
935 ; GISEL-NEXT:    v_or_b32_e32 v2, v2, v16
936 ; GISEL-NEXT:    v_or_b32_e32 v1, v1, v17
937 ; GISEL-NEXT:    v_lshlrev_b16_e32 v18, 14, v0
938 ; GISEL-NEXT:    v_or_b32_e32 v2, v2, v17
939 ; GISEL-NEXT:    v_or_b32_e32 v1, v1, v18
940 ; GISEL-NEXT:    v_lshlrev_b16_e32 v0, 15, v0
941 ; GISEL-NEXT:    v_or_b32_e32 v2, v2, v18
942 ; GISEL-NEXT:    v_or_b32_e32 v1, v1, v0
943 ; GISEL-NEXT:    v_or_b32_e32 v0, v2, v0
944 ; GISEL-NEXT:    v_and_b32_e32 v0, 0xffff, v0
945 ; GISEL-NEXT:    v_and_b32_e32 v1, 0xffff, v1
946 ; GISEL-NEXT:    v_lshlrev_b32_e32 v2, 16, v0
947 ; GISEL-NEXT:    v_lshl_or_b32 v9, v0, 16, v0
948 ; GISEL-NEXT:    v_or3_b32 v10, v1, v2, 1
949 ; GISEL-NEXT:    v_or3_b32 v8, v0, v2, 0
950 ; GISEL-NEXT:    v_mov_b32_e32 v0, 0x96
951 ; GISEL-NEXT:    v_mov_b32_e32 v1, 0
952 ; GISEL-NEXT:    v_and_b32_e32 v2, 0x7fffff, v4
953 ; GISEL-NEXT:    v_cmp_ge_u64_e32 vcc, v[6:7], v[0:1]
954 ; GISEL-NEXT:    v_or_b32_e32 v4, 0x800000, v2
955 ; GISEL-NEXT:    v_mov_b32_e32 v5, 0
956 ; GISEL-NEXT:    ; implicit-def: $vgpr0_vgpr1_vgpr2_vgpr3
957 ; GISEL-NEXT:    s_and_saveexec_b64 s[6:7], vcc
958 ; GISEL-NEXT:    s_xor_b64 s[16:17], exec, s[6:7]
959 ; GISEL-NEXT:    s_cbranch_execz .LBB2_4
960 ; GISEL-NEXT:  ; %bb.3: ; %fp-to-i-if-else
961 ; GISEL-NEXT:    v_add_u32_e32 v7, 0xffffff6a, v6
962 ; GISEL-NEXT:    v_lshlrev_b64 v[0:1], v7, v[4:5]
963 ; GISEL-NEXT:    v_cmp_gt_u32_e32 vcc, 64, v7
964 ; GISEL-NEXT:    v_cndmask_b32_e32 v11, 0, v0, vcc
965 ; GISEL-NEXT:    v_cndmask_b32_e32 v12, 0, v1, vcc
966 ; GISEL-NEXT:    v_mad_u64_u32 v[0:1], s[6:7], v11, v9, 0
967 ; GISEL-NEXT:    v_add_u32_e32 v6, 0xffffff2a, v6
968 ; GISEL-NEXT:    v_sub_u32_e32 v2, 64, v7
969 ; GISEL-NEXT:    v_lshrrev_b64 v[2:3], v2, v[4:5]
970 ; GISEL-NEXT:    v_lshlrev_b64 v[4:5], v6, v[4:5]
971 ; GISEL-NEXT:    v_cmp_eq_u32_e64 s[6:7], 0, v7
972 ; GISEL-NEXT:    v_mad_u64_u32 v[6:7], s[8:9], v12, v8, v[0:1]
973 ; GISEL-NEXT:    v_cndmask_b32_e32 v2, v4, v2, vcc
974 ; GISEL-NEXT:    v_cndmask_b32_e64 v13, v2, 0, s[6:7]
975 ; GISEL-NEXT:    v_mad_u64_u32 v[6:7], s[8:9], v13, v10, v[6:7]
976 ; GISEL-NEXT:    v_mad_u64_u32 v[0:1], s[8:9], v11, v10, 0
977 ; GISEL-NEXT:    v_mov_b32_e32 v2, v6
978 ; GISEL-NEXT:    v_mul_lo_u32 v6, v11, v9
979 ; GISEL-NEXT:    v_mad_u64_u32 v[1:2], s[8:9], v11, v8, v[1:2]
980 ; GISEL-NEXT:    v_mul_lo_u32 v4, v12, v9
981 ; GISEL-NEXT:    v_cndmask_b32_e32 v3, v5, v3, vcc
982 ; GISEL-NEXT:    v_mad_u64_u32 v[1:2], s[10:11], v12, v10, v[1:2]
983 ; GISEL-NEXT:    v_addc_co_u32_e64 v6, s[10:11], v7, v6, s[10:11]
984 ; GISEL-NEXT:    v_addc_co_u32_e64 v4, s[8:9], v6, v4, s[8:9]
985 ; GISEL-NEXT:    v_mad_u64_u32 v[6:7], s[8:9], v13, v8, v[4:5]
986 ; GISEL-NEXT:    v_cndmask_b32_e64 v3, v3, 0, s[6:7]
987 ; GISEL-NEXT:    ; implicit-def: $vgpr9
988 ; GISEL-NEXT:    ; implicit-def: $vgpr8
989 ; GISEL-NEXT:    v_mad_u64_u32 v[3:4], s[6:7], v3, v10, v[6:7]
990 ; GISEL-NEXT:    ; implicit-def: $vgpr6
991 ; GISEL-NEXT:    ; implicit-def: $vgpr4_vgpr5
992 ; GISEL-NEXT:    ; implicit-def: $vgpr10
993 ; GISEL-NEXT:  .LBB2_4: ; %Flow
994 ; GISEL-NEXT:    s_andn2_saveexec_b64 s[6:7], s[16:17]
995 ; GISEL-NEXT:    s_cbranch_execz .LBB2_6
996 ; GISEL-NEXT:  ; %bb.5: ; %fp-to-i-if-then12
997 ; GISEL-NEXT:    v_sub_co_u32_e32 v2, vcc, 0x96, v6
998 ; GISEL-NEXT:    v_lshrrev_b64 v[0:1], v2, v[4:5]
999 ; GISEL-NEXT:    v_cmp_gt_u32_e32 vcc, 64, v2
1000 ; GISEL-NEXT:    v_cndmask_b32_e32 v0, 0, v0, vcc
1001 ; GISEL-NEXT:    v_cmp_eq_u32_e32 vcc, 0, v2
1002 ; GISEL-NEXT:    v_cndmask_b32_e32 v4, v0, v4, vcc
1003 ; GISEL-NEXT:    v_mad_u64_u32 v[0:1], s[8:9], v4, v10, 0
1004 ; GISEL-NEXT:    v_mad_u64_u32 v[2:3], s[8:9], v4, v9, 0
1005 ; GISEL-NEXT:    v_mul_lo_u32 v5, v4, v9
1006 ; GISEL-NEXT:    v_mad_u64_u32 v[1:2], vcc, v4, v8, v[1:2]
1007 ; GISEL-NEXT:    v_addc_co_u32_e32 v3, vcc, v3, v5, vcc
1008 ; GISEL-NEXT:  .LBB2_6: ; %Flow1
1009 ; GISEL-NEXT:    s_or_b64 exec, exec, s[6:7]
1010 ; GISEL-NEXT:  .LBB2_7: ; %Flow2
1011 ; GISEL-NEXT:    s_andn2_saveexec_b64 s[6:7], s[14:15]
1012 ; GISEL-NEXT:    s_cbranch_execz .LBB2_9
1013 ; GISEL-NEXT:  ; %bb.8: ; %fp-to-i-if-then5
1014 ; GISEL-NEXT:    v_cndmask_b32_e64 v1, 0, -1, s[4:5]
1015 ; GISEL-NEXT:    v_and_b32_e32 v1, 1, v1
1016 ; GISEL-NEXT:    v_cndmask_b32_e64 v0, 0, 1, s[4:5]
1017 ; GISEL-NEXT:    v_lshlrev_b32_e32 v2, 1, v1
1018 ; GISEL-NEXT:    v_or_b32_e32 v0, v0, v2
1019 ; GISEL-NEXT:    v_lshlrev_b32_e32 v3, 2, v1
1020 ; GISEL-NEXT:    v_lshlrev_b32_e32 v4, 3, v1
1021 ; GISEL-NEXT:    v_or_b32_e32 v2, v1, v2
1022 ; GISEL-NEXT:    v_or3_b32 v0, v0, v3, v4
1023 ; GISEL-NEXT:    v_lshlrev_b32_e32 v5, 4, v1
1024 ; GISEL-NEXT:    v_lshlrev_b32_e32 v6, 5, v1
1025 ; GISEL-NEXT:    v_or3_b32 v2, v2, v3, v4
1026 ; GISEL-NEXT:    v_or3_b32 v0, v0, v5, v6
1027 ; GISEL-NEXT:    v_lshlrev_b32_e32 v7, 6, v1
1028 ; GISEL-NEXT:    v_lshlrev_b32_e32 v8, 7, v1
1029 ; GISEL-NEXT:    v_or3_b32 v2, v2, v5, v6
1030 ; GISEL-NEXT:    v_or3_b32 v0, v0, v7, v8
1031 ; GISEL-NEXT:    v_lshlrev_b32_e32 v9, 8, v1
1032 ; GISEL-NEXT:    v_lshlrev_b32_e32 v10, 9, v1
1033 ; GISEL-NEXT:    v_or3_b32 v2, v2, v7, v8
1034 ; GISEL-NEXT:    v_or3_b32 v0, v0, v9, v10
1035 ; GISEL-NEXT:    v_lshlrev_b32_e32 v11, 10, v1
1036 ; GISEL-NEXT:    v_lshlrev_b32_e32 v12, 11, v1
1037 ; GISEL-NEXT:    v_or3_b32 v2, v2, v9, v10
1038 ; GISEL-NEXT:    v_or3_b32 v0, v0, v11, v12
1039 ; GISEL-NEXT:    v_lshlrev_b32_e32 v13, 12, v1
1040 ; GISEL-NEXT:    v_lshlrev_b32_e32 v14, 13, v1
1041 ; GISEL-NEXT:    v_or3_b32 v2, v2, v11, v12
1042 ; GISEL-NEXT:    v_or3_b32 v0, v0, v13, v14
1043 ; GISEL-NEXT:    v_lshlrev_b32_e32 v15, 14, v1
1044 ; GISEL-NEXT:    v_lshlrev_b32_e32 v16, 15, v1
1045 ; GISEL-NEXT:    v_or3_b32 v2, v2, v13, v14
1046 ; GISEL-NEXT:    v_or3_b32 v0, v0, v15, v16
1047 ; GISEL-NEXT:    v_lshlrev_b32_e32 v17, 16, v1
1048 ; GISEL-NEXT:    v_lshlrev_b32_e32 v18, 17, v1
1049 ; GISEL-NEXT:    v_or3_b32 v2, v2, v15, v16
1050 ; GISEL-NEXT:    v_or3_b32 v0, v0, v17, v18
1051 ; GISEL-NEXT:    v_lshlrev_b32_e32 v19, 18, v1
1052 ; GISEL-NEXT:    v_lshlrev_b32_e32 v3, 19, v1
1053 ; GISEL-NEXT:    v_or3_b32 v2, v2, v17, v18
1054 ; GISEL-NEXT:    v_or3_b32 v0, v0, v19, v3
1055 ; GISEL-NEXT:    v_lshlrev_b32_e32 v4, 20, v1
1056 ; GISEL-NEXT:    v_lshlrev_b32_e32 v5, 21, v1
1057 ; GISEL-NEXT:    v_or3_b32 v2, v2, v19, v3
1058 ; GISEL-NEXT:    v_or3_b32 v0, v0, v4, v5
1059 ; GISEL-NEXT:    v_lshlrev_b32_e32 v6, 22, v1
1060 ; GISEL-NEXT:    v_lshlrev_b32_e32 v7, 23, v1
1061 ; GISEL-NEXT:    v_or3_b32 v2, v2, v4, v5
1062 ; GISEL-NEXT:    v_or3_b32 v0, v0, v6, v7
1063 ; GISEL-NEXT:    v_lshlrev_b32_e32 v8, 24, v1
1064 ; GISEL-NEXT:    v_lshlrev_b32_e32 v9, 25, v1
1065 ; GISEL-NEXT:    v_or3_b32 v2, v2, v6, v7
1066 ; GISEL-NEXT:    v_or3_b32 v0, v0, v8, v9
1067 ; GISEL-NEXT:    v_lshlrev_b32_e32 v10, 26, v1
1068 ; GISEL-NEXT:    v_lshlrev_b32_e32 v11, 27, v1
1069 ; GISEL-NEXT:    v_or3_b32 v2, v2, v8, v9
1070 ; GISEL-NEXT:    v_or3_b32 v0, v0, v10, v11
1071 ; GISEL-NEXT:    v_lshlrev_b32_e32 v12, 28, v1
1072 ; GISEL-NEXT:    v_lshlrev_b32_e32 v13, 29, v1
1073 ; GISEL-NEXT:    v_or3_b32 v2, v2, v10, v11
1074 ; GISEL-NEXT:    v_or3_b32 v0, v0, v12, v13
1075 ; GISEL-NEXT:    v_lshlrev_b32_e32 v14, 30, v1
1076 ; GISEL-NEXT:    v_lshlrev_b32_e32 v1, 31, v1
1077 ; GISEL-NEXT:    v_or3_b32 v2, v2, v12, v13
1078 ; GISEL-NEXT:    v_or3_b32 v0, v0, v14, v1
1079 ; GISEL-NEXT:    v_or3_b32 v1, v2, v14, v1
1080 ; GISEL-NEXT:    v_add_u32_e32 v3, 0x80000000, v1
1081 ; GISEL-NEXT:    v_mov_b32_e32 v2, v1
1082 ; GISEL-NEXT:  .LBB2_9: ; %Flow3
1083 ; GISEL-NEXT:    s_or_b64 exec, exec, s[6:7]
1084 ; GISEL-NEXT:  .LBB2_10: ; %fp-to-i-cleanup
1085 ; GISEL-NEXT:    s_or_b64 exec, exec, s[12:13]
1086 ; GISEL-NEXT:    s_setpc_b64 s[30:31]
1087   %cvt = fptosi float %x to i128
1088   ret i128 %cvt
1091 define i128 @fptoui_f32_to_i128(float %x) {
1092 ; SDAG-LABEL: fptoui_f32_to_i128:
1093 ; SDAG:       ; %bb.0: ; %fp-to-i-entry
1094 ; SDAG-NEXT:    s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1095 ; SDAG-NEXT:    v_mov_b32_e32 v4, v0
1096 ; SDAG-NEXT:    v_bfe_u32 v6, v4, 23, 8
1097 ; SDAG-NEXT:    s_movk_i32 s4, 0x7e
1098 ; SDAG-NEXT:    v_mov_b32_e32 v0, 0
1099 ; SDAG-NEXT:    v_mov_b32_e32 v2, 0
1100 ; SDAG-NEXT:    v_mov_b32_e32 v7, 0
1101 ; SDAG-NEXT:    v_mov_b32_e32 v1, 0
1102 ; SDAG-NEXT:    v_mov_b32_e32 v3, 0
1103 ; SDAG-NEXT:    v_cmp_lt_u32_e32 vcc, s4, v6
1104 ; SDAG-NEXT:    s_and_saveexec_b64 s[8:9], vcc
1105 ; SDAG-NEXT:    s_cbranch_execz .LBB3_10
1106 ; SDAG-NEXT:  ; %bb.1: ; %fp-to-i-if-end
1107 ; SDAG-NEXT:    v_add_co_u32_e32 v0, vcc, 0xffffff01, v6
1108 ; SDAG-NEXT:    v_addc_co_u32_e32 v1, vcc, -1, v7, vcc
1109 ; SDAG-NEXT:    v_addc_co_u32_e32 v2, vcc, -1, v7, vcc
1110 ; SDAG-NEXT:    s_movk_i32 s6, 0xff7f
1111 ; SDAG-NEXT:    v_addc_co_u32_e32 v3, vcc, -1, v7, vcc
1112 ; SDAG-NEXT:    s_mov_b32 s7, -1
1113 ; SDAG-NEXT:    v_cmp_eq_u64_e64 s[4:5], -1, v[2:3]
1114 ; SDAG-NEXT:    v_cmp_lt_u64_e64 s[6:7], s[6:7], v[0:1]
1115 ; SDAG-NEXT:    v_cmp_lt_i32_e32 vcc, -1, v4
1116 ; SDAG-NEXT:    s_and_b64 s[4:5], s[4:5], s[6:7]
1117 ; SDAG-NEXT:    ; implicit-def: $vgpr0_vgpr1
1118 ; SDAG-NEXT:    ; implicit-def: $vgpr2_vgpr3
1119 ; SDAG-NEXT:    s_and_saveexec_b64 s[6:7], s[4:5]
1120 ; SDAG-NEXT:    s_xor_b64 s[10:11], exec, s[6:7]
1121 ; SDAG-NEXT:    s_cbranch_execz .LBB3_7
1122 ; SDAG-NEXT:  ; %bb.2: ; %fp-to-i-if-end9
1123 ; SDAG-NEXT:    v_cndmask_b32_e64 v0, 0, 1, vcc
1124 ; SDAG-NEXT:    v_add_co_u32_e64 v9, s[4:5], -1, v0
1125 ; SDAG-NEXT:    s_mov_b64 s[4:5], 0x95
1126 ; SDAG-NEXT:    v_and_b32_e32 v0, 0x7fffff, v4
1127 ; SDAG-NEXT:    v_cmp_lt_u64_e64 s[4:5], s[4:5], v[6:7]
1128 ; SDAG-NEXT:    v_mov_b32_e32 v5, 0
1129 ; SDAG-NEXT:    v_cndmask_b32_e64 v8, -1, 0, vcc
1130 ; SDAG-NEXT:    v_cndmask_b32_e64 v10, -1, 1, vcc
1131 ; SDAG-NEXT:    v_or_b32_e32 v4, 0x800000, v0
1132 ; SDAG-NEXT:    ; implicit-def: $vgpr0_vgpr1
1133 ; SDAG-NEXT:    ; implicit-def: $vgpr2_vgpr3
1134 ; SDAG-NEXT:    s_and_saveexec_b64 s[6:7], s[4:5]
1135 ; SDAG-NEXT:    s_xor_b64 s[12:13], exec, s[6:7]
1136 ; SDAG-NEXT:    s_cbranch_execz .LBB3_4
1137 ; SDAG-NEXT:  ; %bb.3: ; %fp-to-i-if-else
1138 ; SDAG-NEXT:    v_sub_u32_e32 v0, 0xd6, v6
1139 ; SDAG-NEXT:    v_add_u32_e32 v2, 0xffffff2a, v6
1140 ; SDAG-NEXT:    v_add_u32_e32 v7, 0xffffff6a, v6
1141 ; SDAG-NEXT:    v_lshrrev_b64 v[0:1], v0, v[4:5]
1142 ; SDAG-NEXT:    v_lshlrev_b64 v[2:3], v2, v[4:5]
1143 ; SDAG-NEXT:    v_cmp_gt_u32_e64 s[4:5], 64, v7
1144 ; SDAG-NEXT:    v_cndmask_b32_e64 v1, v3, v1, s[4:5]
1145 ; SDAG-NEXT:    v_cmp_ne_u32_e64 s[6:7], 0, v7
1146 ; SDAG-NEXT:    v_cndmask_b32_e64 v3, 0, v1, s[6:7]
1147 ; SDAG-NEXT:    v_cndmask_b32_e64 v2, v2, v0, s[4:5]
1148 ; SDAG-NEXT:    v_lshlrev_b64 v[0:1], v7, v[4:5]
1149 ; SDAG-NEXT:    v_cndmask_b32_e64 v2, 0, v2, s[6:7]
1150 ; SDAG-NEXT:    v_cndmask_b32_e64 v12, 0, v0, s[4:5]
1151 ; SDAG-NEXT:    v_cndmask_b32_e64 v11, 0, v1, s[4:5]
1152 ; SDAG-NEXT:    v_mad_u64_u32 v[0:1], s[4:5], v12, v10, 0
1153 ; SDAG-NEXT:    v_mul_lo_u32 v13, v8, v2
1154 ; SDAG-NEXT:    v_mul_lo_u32 v14, v10, v3
1155 ; SDAG-NEXT:    v_mov_b32_e32 v4, v1
1156 ; SDAG-NEXT:    v_mad_u64_u32 v[6:7], s[4:5], v11, v10, v[4:5]
1157 ; SDAG-NEXT:    v_mad_u64_u32 v[2:3], s[4:5], v10, v2, 0
1158 ; SDAG-NEXT:    v_mov_b32_e32 v4, v6
1159 ; SDAG-NEXT:    v_mad_u64_u32 v[4:5], s[4:5], v12, v8, v[4:5]
1160 ; SDAG-NEXT:    v_add3_u32 v3, v3, v14, v13
1161 ; SDAG-NEXT:    v_mad_u64_u32 v[1:2], s[4:5], v9, v12, v[2:3]
1162 ; SDAG-NEXT:    v_add_co_u32_e64 v5, s[4:5], v7, v5
1163 ; SDAG-NEXT:    v_addc_co_u32_e64 v6, s[4:5], 0, 0, s[4:5]
1164 ; SDAG-NEXT:    v_mul_lo_u32 v3, v9, v11
1165 ; SDAG-NEXT:    v_mul_lo_u32 v9, v9, v12
1166 ; SDAG-NEXT:    v_mad_u64_u32 v[5:6], s[4:5], v11, v8, v[5:6]
1167 ; SDAG-NEXT:    ; implicit-def: $vgpr10
1168 ; SDAG-NEXT:    ; implicit-def: $vgpr8
1169 ; SDAG-NEXT:    v_add3_u32 v3, v9, v2, v3
1170 ; SDAG-NEXT:    v_add_co_u32_e64 v2, s[4:5], v5, v1
1171 ; SDAG-NEXT:    v_addc_co_u32_e64 v3, s[4:5], v6, v3, s[4:5]
1172 ; SDAG-NEXT:    v_mov_b32_e32 v1, v4
1173 ; SDAG-NEXT:    ; implicit-def: $vgpr6_vgpr7
1174 ; SDAG-NEXT:    ; implicit-def: $vgpr4_vgpr5
1175 ; SDAG-NEXT:    ; implicit-def: $vgpr9
1176 ; SDAG-NEXT:  .LBB3_4: ; %Flow
1177 ; SDAG-NEXT:    s_andn2_saveexec_b64 s[6:7], s[12:13]
1178 ; SDAG-NEXT:    s_cbranch_execz .LBB3_6
1179 ; SDAG-NEXT:  ; %bb.5: ; %fp-to-i-if-then12
1180 ; SDAG-NEXT:    v_sub_u32_e32 v2, 0x96, v6
1181 ; SDAG-NEXT:    v_lshrrev_b64 v[0:1], v2, v[4:5]
1182 ; SDAG-NEXT:    v_cmp_gt_u32_e64 s[4:5], 64, v2
1183 ; SDAG-NEXT:    v_cndmask_b32_e64 v0, 0, v0, s[4:5]
1184 ; SDAG-NEXT:    v_cmp_eq_u32_e64 s[4:5], 0, v2
1185 ; SDAG-NEXT:    v_cndmask_b32_e64 v3, v0, v4, s[4:5]
1186 ; SDAG-NEXT:    v_mad_u64_u32 v[0:1], s[4:5], v3, v10, 0
1187 ; SDAG-NEXT:    v_mov_b32_e32 v2, 0
1188 ; SDAG-NEXT:    v_mad_u64_u32 v[4:5], s[4:5], v3, v8, v[1:2]
1189 ; SDAG-NEXT:    v_mov_b32_e32 v1, v5
1190 ; SDAG-NEXT:    v_mad_i64_i32 v[2:3], s[4:5], v9, v3, v[1:2]
1191 ; SDAG-NEXT:    v_mov_b32_e32 v1, v4
1192 ; SDAG-NEXT:  .LBB3_6: ; %Flow1
1193 ; SDAG-NEXT:    s_or_b64 exec, exec, s[6:7]
1194 ; SDAG-NEXT:  .LBB3_7: ; %Flow2
1195 ; SDAG-NEXT:    s_andn2_saveexec_b64 s[4:5], s[10:11]
1196 ; SDAG-NEXT:  ; %bb.8: ; %fp-to-i-if-then5
1197 ; SDAG-NEXT:    v_bfrev_b32_e32 v0, 1
1198 ; SDAG-NEXT:    v_bfrev_b32_e32 v1, -2
1199 ; SDAG-NEXT:    v_cndmask_b32_e64 v2, 0, -1, vcc
1200 ; SDAG-NEXT:    v_cndmask_b32_e32 v3, v0, v1, vcc
1201 ; SDAG-NEXT:    v_mov_b32_e32 v0, v2
1202 ; SDAG-NEXT:    v_mov_b32_e32 v1, v2
1203 ; SDAG-NEXT:  ; %bb.9: ; %Flow3
1204 ; SDAG-NEXT:    s_or_b64 exec, exec, s[4:5]
1205 ; SDAG-NEXT:  .LBB3_10: ; %fp-to-i-cleanup
1206 ; SDAG-NEXT:    s_or_b64 exec, exec, s[8:9]
1207 ; SDAG-NEXT:    s_setpc_b64 s[30:31]
1209 ; GISEL-LABEL: fptoui_f32_to_i128:
1210 ; GISEL:       ; %bb.0: ; %fp-to-i-entry
1211 ; GISEL-NEXT:    s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1212 ; GISEL-NEXT:    v_mov_b32_e32 v4, v0
1213 ; GISEL-NEXT:    v_mov_b32_e32 v5, 0
1214 ; GISEL-NEXT:    v_lshrrev_b64 v[0:1], 23, v[4:5]
1215 ; GISEL-NEXT:    s_mov_b64 s[4:5], 0
1216 ; GISEL-NEXT:    v_bfe_u32 v6, v0, 0, 8
1217 ; GISEL-NEXT:    v_mov_b32_e32 v0, 0x7f
1218 ; GISEL-NEXT:    v_mov_b32_e32 v1, 0
1219 ; GISEL-NEXT:    v_mov_b32_e32 v7, v5
1220 ; GISEL-NEXT:    v_cmp_ge_u64_e32 vcc, v[6:7], v[0:1]
1221 ; GISEL-NEXT:    s_mov_b64 s[6:7], s[4:5]
1222 ; GISEL-NEXT:    v_mov_b32_e32 v0, s4
1223 ; GISEL-NEXT:    v_mov_b32_e32 v1, s5
1224 ; GISEL-NEXT:    v_mov_b32_e32 v2, s6
1225 ; GISEL-NEXT:    v_mov_b32_e32 v3, s7
1226 ; GISEL-NEXT:    s_and_saveexec_b64 s[12:13], vcc
1227 ; GISEL-NEXT:    s_cbranch_execz .LBB3_10
1228 ; GISEL-NEXT:  ; %bb.1: ; %fp-to-i-if-end
1229 ; GISEL-NEXT:    v_add_co_u32_e32 v0, vcc, 0xffffff01, v6
1230 ; GISEL-NEXT:    v_mov_b32_e32 v2, 0xffffff80
1231 ; GISEL-NEXT:    v_addc_co_u32_e64 v1, s[6:7], 0, -1, vcc
1232 ; GISEL-NEXT:    v_mov_b32_e32 v3, -1
1233 ; GISEL-NEXT:    v_addc_co_u32_e64 v8, s[6:7], 0, -1, s[6:7]
1234 ; GISEL-NEXT:    v_cmp_ge_u64_e32 vcc, v[0:1], v[2:3]
1235 ; GISEL-NEXT:    v_addc_co_u32_e64 v9, s[6:7], 0, -1, s[6:7]
1236 ; GISEL-NEXT:    v_cndmask_b32_e64 v0, 0, 1, vcc
1237 ; GISEL-NEXT:    v_cmp_le_u64_e32 vcc, -1, v[8:9]
1238 ; GISEL-NEXT:    v_cmp_lt_i32_e64 s[4:5], -1, v4
1239 ; GISEL-NEXT:    v_cndmask_b32_e64 v1, 0, 1, vcc
1240 ; GISEL-NEXT:    v_cmp_eq_u64_e32 vcc, -1, v[8:9]
1241 ; GISEL-NEXT:    v_cndmask_b32_e32 v0, v1, v0, vcc
1242 ; GISEL-NEXT:    v_and_b32_e32 v0, 1, v0
1243 ; GISEL-NEXT:    v_cmp_ne_u32_e32 vcc, 0, v0
1244 ; GISEL-NEXT:    ; implicit-def: $vgpr0_vgpr1_vgpr2_vgpr3
1245 ; GISEL-NEXT:    s_and_saveexec_b64 s[6:7], vcc
1246 ; GISEL-NEXT:    s_xor_b64 s[14:15], exec, s[6:7]
1247 ; GISEL-NEXT:    s_cbranch_execz .LBB3_7
1248 ; GISEL-NEXT:  ; %bb.2: ; %fp-to-i-if-end9
1249 ; GISEL-NEXT:    s_xor_b64 s[6:7], s[4:5], -1
1250 ; GISEL-NEXT:    v_cndmask_b32_e64 v0, 0, -1, s[6:7]
1251 ; GISEL-NEXT:    v_and_b32_e32 v0, 1, v0
1252 ; GISEL-NEXT:    v_cndmask_b32_e64 v1, 0, 1, s[6:7]
1253 ; GISEL-NEXT:    v_lshlrev_b16_e32 v2, 1, v0
1254 ; GISEL-NEXT:    v_or_b32_e32 v1, v1, v2
1255 ; GISEL-NEXT:    v_lshlrev_b16_e32 v3, 2, v0
1256 ; GISEL-NEXT:    v_or_b32_e32 v2, v0, v2
1257 ; GISEL-NEXT:    v_or_b32_e32 v1, v1, v3
1258 ; GISEL-NEXT:    v_lshlrev_b16_e32 v5, 3, v0
1259 ; GISEL-NEXT:    v_or_b32_e32 v2, v2, v3
1260 ; GISEL-NEXT:    v_or_b32_e32 v1, v1, v5
1261 ; GISEL-NEXT:    v_lshlrev_b16_e32 v8, 4, v0
1262 ; GISEL-NEXT:    v_or_b32_e32 v2, v2, v5
1263 ; GISEL-NEXT:    v_or_b32_e32 v1, v1, v8
1264 ; GISEL-NEXT:    v_lshlrev_b16_e32 v9, 5, v0
1265 ; GISEL-NEXT:    v_or_b32_e32 v2, v2, v8
1266 ; GISEL-NEXT:    v_or_b32_e32 v1, v1, v9
1267 ; GISEL-NEXT:    v_lshlrev_b16_e32 v10, 6, v0
1268 ; GISEL-NEXT:    v_or_b32_e32 v2, v2, v9
1269 ; GISEL-NEXT:    v_or_b32_e32 v1, v1, v10
1270 ; GISEL-NEXT:    v_lshlrev_b16_e32 v11, 7, v0
1271 ; GISEL-NEXT:    v_or_b32_e32 v2, v2, v10
1272 ; GISEL-NEXT:    v_or_b32_e32 v1, v1, v11
1273 ; GISEL-NEXT:    v_lshlrev_b16_e32 v12, 8, v0
1274 ; GISEL-NEXT:    v_or_b32_e32 v2, v2, v11
1275 ; GISEL-NEXT:    v_or_b32_e32 v1, v1, v12
1276 ; GISEL-NEXT:    v_lshlrev_b16_e32 v13, 9, v0
1277 ; GISEL-NEXT:    v_or_b32_e32 v2, v2, v12
1278 ; GISEL-NEXT:    v_or_b32_e32 v1, v1, v13
1279 ; GISEL-NEXT:    v_lshlrev_b16_e32 v14, 10, v0
1280 ; GISEL-NEXT:    v_or_b32_e32 v2, v2, v13
1281 ; GISEL-NEXT:    v_or_b32_e32 v1, v1, v14
1282 ; GISEL-NEXT:    v_lshlrev_b16_e32 v15, 11, v0
1283 ; GISEL-NEXT:    v_or_b32_e32 v2, v2, v14
1284 ; GISEL-NEXT:    v_or_b32_e32 v1, v1, v15
1285 ; GISEL-NEXT:    v_lshlrev_b16_e32 v16, 12, v0
1286 ; GISEL-NEXT:    v_or_b32_e32 v2, v2, v15
1287 ; GISEL-NEXT:    v_or_b32_e32 v1, v1, v16
1288 ; GISEL-NEXT:    v_lshlrev_b16_e32 v17, 13, v0
1289 ; GISEL-NEXT:    v_or_b32_e32 v2, v2, v16
1290 ; GISEL-NEXT:    v_or_b32_e32 v1, v1, v17
1291 ; GISEL-NEXT:    v_lshlrev_b16_e32 v18, 14, v0
1292 ; GISEL-NEXT:    v_or_b32_e32 v2, v2, v17
1293 ; GISEL-NEXT:    v_or_b32_e32 v1, v1, v18
1294 ; GISEL-NEXT:    v_lshlrev_b16_e32 v0, 15, v0
1295 ; GISEL-NEXT:    v_or_b32_e32 v2, v2, v18
1296 ; GISEL-NEXT:    v_or_b32_e32 v1, v1, v0
1297 ; GISEL-NEXT:    v_or_b32_e32 v0, v2, v0
1298 ; GISEL-NEXT:    v_and_b32_e32 v0, 0xffff, v0
1299 ; GISEL-NEXT:    v_and_b32_e32 v1, 0xffff, v1
1300 ; GISEL-NEXT:    v_lshlrev_b32_e32 v2, 16, v0
1301 ; GISEL-NEXT:    v_lshl_or_b32 v9, v0, 16, v0
1302 ; GISEL-NEXT:    v_or3_b32 v10, v1, v2, 1
1303 ; GISEL-NEXT:    v_or3_b32 v8, v0, v2, 0
1304 ; GISEL-NEXT:    v_mov_b32_e32 v0, 0x96
1305 ; GISEL-NEXT:    v_mov_b32_e32 v1, 0
1306 ; GISEL-NEXT:    v_and_b32_e32 v2, 0x7fffff, v4
1307 ; GISEL-NEXT:    v_cmp_ge_u64_e32 vcc, v[6:7], v[0:1]
1308 ; GISEL-NEXT:    v_or_b32_e32 v4, 0x800000, v2
1309 ; GISEL-NEXT:    v_mov_b32_e32 v5, 0
1310 ; GISEL-NEXT:    ; implicit-def: $vgpr0_vgpr1_vgpr2_vgpr3
1311 ; GISEL-NEXT:    s_and_saveexec_b64 s[6:7], vcc
1312 ; GISEL-NEXT:    s_xor_b64 s[16:17], exec, s[6:7]
1313 ; GISEL-NEXT:    s_cbranch_execz .LBB3_4
1314 ; GISEL-NEXT:  ; %bb.3: ; %fp-to-i-if-else
1315 ; GISEL-NEXT:    v_add_u32_e32 v7, 0xffffff6a, v6
1316 ; GISEL-NEXT:    v_lshlrev_b64 v[0:1], v7, v[4:5]
1317 ; GISEL-NEXT:    v_cmp_gt_u32_e32 vcc, 64, v7
1318 ; GISEL-NEXT:    v_cndmask_b32_e32 v11, 0, v0, vcc
1319 ; GISEL-NEXT:    v_cndmask_b32_e32 v12, 0, v1, vcc
1320 ; GISEL-NEXT:    v_mad_u64_u32 v[0:1], s[6:7], v11, v9, 0
1321 ; GISEL-NEXT:    v_add_u32_e32 v6, 0xffffff2a, v6
1322 ; GISEL-NEXT:    v_sub_u32_e32 v2, 64, v7
1323 ; GISEL-NEXT:    v_lshrrev_b64 v[2:3], v2, v[4:5]
1324 ; GISEL-NEXT:    v_lshlrev_b64 v[4:5], v6, v[4:5]
1325 ; GISEL-NEXT:    v_cmp_eq_u32_e64 s[6:7], 0, v7
1326 ; GISEL-NEXT:    v_mad_u64_u32 v[6:7], s[8:9], v12, v8, v[0:1]
1327 ; GISEL-NEXT:    v_cndmask_b32_e32 v2, v4, v2, vcc
1328 ; GISEL-NEXT:    v_cndmask_b32_e64 v13, v2, 0, s[6:7]
1329 ; GISEL-NEXT:    v_mad_u64_u32 v[6:7], s[8:9], v13, v10, v[6:7]
1330 ; GISEL-NEXT:    v_mad_u64_u32 v[0:1], s[8:9], v11, v10, 0
1331 ; GISEL-NEXT:    v_mov_b32_e32 v2, v6
1332 ; GISEL-NEXT:    v_mul_lo_u32 v6, v11, v9
1333 ; GISEL-NEXT:    v_mad_u64_u32 v[1:2], s[8:9], v11, v8, v[1:2]
1334 ; GISEL-NEXT:    v_mul_lo_u32 v4, v12, v9
1335 ; GISEL-NEXT:    v_cndmask_b32_e32 v3, v5, v3, vcc
1336 ; GISEL-NEXT:    v_mad_u64_u32 v[1:2], s[10:11], v12, v10, v[1:2]
1337 ; GISEL-NEXT:    v_addc_co_u32_e64 v6, s[10:11], v7, v6, s[10:11]
1338 ; GISEL-NEXT:    v_addc_co_u32_e64 v4, s[8:9], v6, v4, s[8:9]
1339 ; GISEL-NEXT:    v_mad_u64_u32 v[6:7], s[8:9], v13, v8, v[4:5]
1340 ; GISEL-NEXT:    v_cndmask_b32_e64 v3, v3, 0, s[6:7]
1341 ; GISEL-NEXT:    ; implicit-def: $vgpr9
1342 ; GISEL-NEXT:    ; implicit-def: $vgpr8
1343 ; GISEL-NEXT:    v_mad_u64_u32 v[3:4], s[6:7], v3, v10, v[6:7]
1344 ; GISEL-NEXT:    ; implicit-def: $vgpr6
1345 ; GISEL-NEXT:    ; implicit-def: $vgpr4_vgpr5
1346 ; GISEL-NEXT:    ; implicit-def: $vgpr10
1347 ; GISEL-NEXT:  .LBB3_4: ; %Flow
1348 ; GISEL-NEXT:    s_andn2_saveexec_b64 s[6:7], s[16:17]
1349 ; GISEL-NEXT:    s_cbranch_execz .LBB3_6
1350 ; GISEL-NEXT:  ; %bb.5: ; %fp-to-i-if-then12
1351 ; GISEL-NEXT:    v_sub_co_u32_e32 v2, vcc, 0x96, v6
1352 ; GISEL-NEXT:    v_lshrrev_b64 v[0:1], v2, v[4:5]
1353 ; GISEL-NEXT:    v_cmp_gt_u32_e32 vcc, 64, v2
1354 ; GISEL-NEXT:    v_cndmask_b32_e32 v0, 0, v0, vcc
1355 ; GISEL-NEXT:    v_cmp_eq_u32_e32 vcc, 0, v2
1356 ; GISEL-NEXT:    v_cndmask_b32_e32 v4, v0, v4, vcc
1357 ; GISEL-NEXT:    v_mad_u64_u32 v[0:1], s[8:9], v4, v10, 0
1358 ; GISEL-NEXT:    v_mad_u64_u32 v[2:3], s[8:9], v4, v9, 0
1359 ; GISEL-NEXT:    v_mul_lo_u32 v5, v4, v9
1360 ; GISEL-NEXT:    v_mad_u64_u32 v[1:2], vcc, v4, v8, v[1:2]
1361 ; GISEL-NEXT:    v_addc_co_u32_e32 v3, vcc, v3, v5, vcc
1362 ; GISEL-NEXT:  .LBB3_6: ; %Flow1
1363 ; GISEL-NEXT:    s_or_b64 exec, exec, s[6:7]
1364 ; GISEL-NEXT:  .LBB3_7: ; %Flow2
1365 ; GISEL-NEXT:    s_andn2_saveexec_b64 s[6:7], s[14:15]
1366 ; GISEL-NEXT:    s_cbranch_execz .LBB3_9
1367 ; GISEL-NEXT:  ; %bb.8: ; %fp-to-i-if-then5
1368 ; GISEL-NEXT:    v_cndmask_b32_e64 v1, 0, -1, s[4:5]
1369 ; GISEL-NEXT:    v_and_b32_e32 v1, 1, v1
1370 ; GISEL-NEXT:    v_cndmask_b32_e64 v0, 0, 1, s[4:5]
1371 ; GISEL-NEXT:    v_lshlrev_b32_e32 v2, 1, v1
1372 ; GISEL-NEXT:    v_or_b32_e32 v0, v0, v2
1373 ; GISEL-NEXT:    v_lshlrev_b32_e32 v3, 2, v1
1374 ; GISEL-NEXT:    v_lshlrev_b32_e32 v4, 3, v1
1375 ; GISEL-NEXT:    v_or_b32_e32 v2, v1, v2
1376 ; GISEL-NEXT:    v_or3_b32 v0, v0, v3, v4
1377 ; GISEL-NEXT:    v_lshlrev_b32_e32 v5, 4, v1
1378 ; GISEL-NEXT:    v_lshlrev_b32_e32 v6, 5, v1
1379 ; GISEL-NEXT:    v_or3_b32 v2, v2, v3, v4
1380 ; GISEL-NEXT:    v_or3_b32 v0, v0, v5, v6
1381 ; GISEL-NEXT:    v_lshlrev_b32_e32 v7, 6, v1
1382 ; GISEL-NEXT:    v_lshlrev_b32_e32 v8, 7, v1
1383 ; GISEL-NEXT:    v_or3_b32 v2, v2, v5, v6
1384 ; GISEL-NEXT:    v_or3_b32 v0, v0, v7, v8
1385 ; GISEL-NEXT:    v_lshlrev_b32_e32 v9, 8, v1
1386 ; GISEL-NEXT:    v_lshlrev_b32_e32 v10, 9, v1
1387 ; GISEL-NEXT:    v_or3_b32 v2, v2, v7, v8
1388 ; GISEL-NEXT:    v_or3_b32 v0, v0, v9, v10
1389 ; GISEL-NEXT:    v_lshlrev_b32_e32 v11, 10, v1
1390 ; GISEL-NEXT:    v_lshlrev_b32_e32 v12, 11, v1
1391 ; GISEL-NEXT:    v_or3_b32 v2, v2, v9, v10
1392 ; GISEL-NEXT:    v_or3_b32 v0, v0, v11, v12
1393 ; GISEL-NEXT:    v_lshlrev_b32_e32 v13, 12, v1
1394 ; GISEL-NEXT:    v_lshlrev_b32_e32 v14, 13, v1
1395 ; GISEL-NEXT:    v_or3_b32 v2, v2, v11, v12
1396 ; GISEL-NEXT:    v_or3_b32 v0, v0, v13, v14
1397 ; GISEL-NEXT:    v_lshlrev_b32_e32 v15, 14, v1
1398 ; GISEL-NEXT:    v_lshlrev_b32_e32 v16, 15, v1
1399 ; GISEL-NEXT:    v_or3_b32 v2, v2, v13, v14
1400 ; GISEL-NEXT:    v_or3_b32 v0, v0, v15, v16
1401 ; GISEL-NEXT:    v_lshlrev_b32_e32 v17, 16, v1
1402 ; GISEL-NEXT:    v_lshlrev_b32_e32 v18, 17, v1
1403 ; GISEL-NEXT:    v_or3_b32 v2, v2, v15, v16
1404 ; GISEL-NEXT:    v_or3_b32 v0, v0, v17, v18
1405 ; GISEL-NEXT:    v_lshlrev_b32_e32 v19, 18, v1
1406 ; GISEL-NEXT:    v_lshlrev_b32_e32 v3, 19, v1
1407 ; GISEL-NEXT:    v_or3_b32 v2, v2, v17, v18
1408 ; GISEL-NEXT:    v_or3_b32 v0, v0, v19, v3
1409 ; GISEL-NEXT:    v_lshlrev_b32_e32 v4, 20, v1
1410 ; GISEL-NEXT:    v_lshlrev_b32_e32 v5, 21, v1
1411 ; GISEL-NEXT:    v_or3_b32 v2, v2, v19, v3
1412 ; GISEL-NEXT:    v_or3_b32 v0, v0, v4, v5
1413 ; GISEL-NEXT:    v_lshlrev_b32_e32 v6, 22, v1
1414 ; GISEL-NEXT:    v_lshlrev_b32_e32 v7, 23, v1
1415 ; GISEL-NEXT:    v_or3_b32 v2, v2, v4, v5
1416 ; GISEL-NEXT:    v_or3_b32 v0, v0, v6, v7
1417 ; GISEL-NEXT:    v_lshlrev_b32_e32 v8, 24, v1
1418 ; GISEL-NEXT:    v_lshlrev_b32_e32 v9, 25, v1
1419 ; GISEL-NEXT:    v_or3_b32 v2, v2, v6, v7
1420 ; GISEL-NEXT:    v_or3_b32 v0, v0, v8, v9
1421 ; GISEL-NEXT:    v_lshlrev_b32_e32 v10, 26, v1
1422 ; GISEL-NEXT:    v_lshlrev_b32_e32 v11, 27, v1
1423 ; GISEL-NEXT:    v_or3_b32 v2, v2, v8, v9
1424 ; GISEL-NEXT:    v_or3_b32 v0, v0, v10, v11
1425 ; GISEL-NEXT:    v_lshlrev_b32_e32 v12, 28, v1
1426 ; GISEL-NEXT:    v_lshlrev_b32_e32 v13, 29, v1
1427 ; GISEL-NEXT:    v_or3_b32 v2, v2, v10, v11
1428 ; GISEL-NEXT:    v_or3_b32 v0, v0, v12, v13
1429 ; GISEL-NEXT:    v_lshlrev_b32_e32 v14, 30, v1
1430 ; GISEL-NEXT:    v_lshlrev_b32_e32 v1, 31, v1
1431 ; GISEL-NEXT:    v_or3_b32 v2, v2, v12, v13
1432 ; GISEL-NEXT:    v_or3_b32 v0, v0, v14, v1
1433 ; GISEL-NEXT:    v_or3_b32 v1, v2, v14, v1
1434 ; GISEL-NEXT:    v_add_u32_e32 v3, 0x80000000, v1
1435 ; GISEL-NEXT:    v_mov_b32_e32 v2, v1
1436 ; GISEL-NEXT:  .LBB3_9: ; %Flow3
1437 ; GISEL-NEXT:    s_or_b64 exec, exec, s[6:7]
1438 ; GISEL-NEXT:  .LBB3_10: ; %fp-to-i-cleanup
1439 ; GISEL-NEXT:    s_or_b64 exec, exec, s[12:13]
1440 ; GISEL-NEXT:    s_setpc_b64 s[30:31]
1441   %cvt = fptoui float %x to i128
1442   ret i128 %cvt
1445 define i128 @fptosi_f16_to_i128(half %x) {
1446 ; GCN-LABEL: fptosi_f16_to_i128:
1447 ; GCN:       ; %bb.0:
1448 ; GCN-NEXT:    s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1449 ; GCN-NEXT:    v_cvt_f32_f16_e32 v0, v0
1450 ; GCN-NEXT:    v_cvt_i32_f32_e32 v0, v0
1451 ; GCN-NEXT:    v_ashrrev_i32_e32 v1, 31, v0
1452 ; GCN-NEXT:    v_mov_b32_e32 v2, v1
1453 ; GCN-NEXT:    v_mov_b32_e32 v3, v1
1454 ; GCN-NEXT:    s_setpc_b64 s[30:31]
1455   %cvt = fptosi half %x to i128
1456   ret i128 %cvt
1459 define i128 @fptoui_f16_to_i128(half %x) {
1460 ; GCN-LABEL: fptoui_f16_to_i128:
1461 ; GCN:       ; %bb.0:
1462 ; GCN-NEXT:    s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1463 ; GCN-NEXT:    v_cvt_f32_f16_e32 v0, v0
1464 ; GCN-NEXT:    v_mov_b32_e32 v1, 0
1465 ; GCN-NEXT:    v_mov_b32_e32 v2, 0
1466 ; GCN-NEXT:    v_mov_b32_e32 v3, 0
1467 ; GCN-NEXT:    v_cvt_u32_f32_e32 v0, v0
1468 ; GCN-NEXT:    s_setpc_b64 s[30:31]
1469   %cvt = fptoui half %x to i128
1470   ret i128 %cvt
1473 define i128 @fptosi_bf16_to_i128(bfloat %x) {
1474 ; SDAG-LABEL: fptosi_bf16_to_i128:
1475 ; SDAG:       ; %bb.0: ; %fp-to-i-entry
1476 ; SDAG-NEXT:    s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1477 ; SDAG-NEXT:    v_mov_b32_e32 v4, v0
1478 ; SDAG-NEXT:    v_bfe_u32 v6, v4, 7, 8
1479 ; SDAG-NEXT:    s_movk_i32 s4, 0x7e
1480 ; SDAG-NEXT:    v_mov_b32_e32 v0, 0
1481 ; SDAG-NEXT:    v_mov_b32_e32 v2, 0
1482 ; SDAG-NEXT:    v_mov_b32_e32 v7, 0
1483 ; SDAG-NEXT:    v_mov_b32_e32 v1, 0
1484 ; SDAG-NEXT:    v_mov_b32_e32 v3, 0
1485 ; SDAG-NEXT:    v_cmp_lt_u32_e32 vcc, s4, v6
1486 ; SDAG-NEXT:    s_and_saveexec_b64 s[8:9], vcc
1487 ; SDAG-NEXT:    s_cbranch_execz .LBB6_10
1488 ; SDAG-NEXT:  ; %bb.1: ; %fp-to-i-if-end
1489 ; SDAG-NEXT:    v_add_co_u32_e32 v0, vcc, 0xffffff01, v6
1490 ; SDAG-NEXT:    v_addc_co_u32_e32 v1, vcc, -1, v7, vcc
1491 ; SDAG-NEXT:    v_addc_co_u32_e32 v2, vcc, -1, v7, vcc
1492 ; SDAG-NEXT:    s_movk_i32 s6, 0xff7f
1493 ; SDAG-NEXT:    v_addc_co_u32_e32 v3, vcc, -1, v7, vcc
1494 ; SDAG-NEXT:    s_mov_b32 s7, -1
1495 ; SDAG-NEXT:    v_cmp_eq_u64_e64 s[4:5], -1, v[2:3]
1496 ; SDAG-NEXT:    v_cmp_lt_u64_e64 s[6:7], s[6:7], v[0:1]
1497 ; SDAG-NEXT:    v_cmp_lt_i16_e32 vcc, -1, v4
1498 ; SDAG-NEXT:    s_and_b64 s[4:5], s[4:5], s[6:7]
1499 ; SDAG-NEXT:    ; implicit-def: $vgpr0_vgpr1
1500 ; SDAG-NEXT:    ; implicit-def: $vgpr2_vgpr3
1501 ; SDAG-NEXT:    s_and_saveexec_b64 s[6:7], s[4:5]
1502 ; SDAG-NEXT:    s_xor_b64 s[10:11], exec, s[6:7]
1503 ; SDAG-NEXT:    s_cbranch_execz .LBB6_7
1504 ; SDAG-NEXT:  ; %bb.2: ; %fp-to-i-if-end9
1505 ; SDAG-NEXT:    s_movk_i32 s4, 0x7f
1506 ; SDAG-NEXT:    v_and_b32_sdwa v0, v4, s4 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_0 src1_sel:DWORD
1507 ; SDAG-NEXT:    s_mov_b64 s[4:5], 0x85
1508 ; SDAG-NEXT:    v_cmp_lt_u64_e64 s[4:5], s[4:5], v[6:7]
1509 ; SDAG-NEXT:    v_mov_b32_e32 v5, 0
1510 ; SDAG-NEXT:    v_cndmask_b32_e64 v9, -1, 0, vcc
1511 ; SDAG-NEXT:    v_cndmask_b32_e64 v8, -1, 1, vcc
1512 ; SDAG-NEXT:    v_or_b32_e32 v4, 0x80, v0
1513 ; SDAG-NEXT:    ; implicit-def: $vgpr0_vgpr1
1514 ; SDAG-NEXT:    ; implicit-def: $vgpr2_vgpr3
1515 ; SDAG-NEXT:    s_and_saveexec_b64 s[6:7], s[4:5]
1516 ; SDAG-NEXT:    s_xor_b64 s[12:13], exec, s[6:7]
1517 ; SDAG-NEXT:    s_cbranch_execz .LBB6_4
1518 ; SDAG-NEXT:  ; %bb.3: ; %fp-to-i-if-else
1519 ; SDAG-NEXT:    v_cndmask_b32_e64 v0, 0, 1, vcc
1520 ; SDAG-NEXT:    v_add_co_u32_e64 v10, s[4:5], -1, v0
1521 ; SDAG-NEXT:    v_sub_u32_e32 v0, 0xc6, v6
1522 ; SDAG-NEXT:    v_add_u32_e32 v2, 0xffffff3a, v6
1523 ; SDAG-NEXT:    v_add_u32_e32 v7, 0xffffff7a, v6
1524 ; SDAG-NEXT:    v_lshrrev_b64 v[0:1], v0, v[4:5]
1525 ; SDAG-NEXT:    v_lshlrev_b64 v[2:3], v2, v[4:5]
1526 ; SDAG-NEXT:    v_cmp_gt_u32_e64 s[4:5], 64, v7
1527 ; SDAG-NEXT:    v_cndmask_b32_e64 v1, v3, v1, s[4:5]
1528 ; SDAG-NEXT:    v_cmp_ne_u32_e64 s[6:7], 0, v7
1529 ; SDAG-NEXT:    v_cndmask_b32_e64 v3, 0, v1, s[6:7]
1530 ; SDAG-NEXT:    v_cndmask_b32_e64 v2, v2, v0, s[4:5]
1531 ; SDAG-NEXT:    v_lshlrev_b64 v[0:1], v7, v[4:5]
1532 ; SDAG-NEXT:    v_cndmask_b32_e64 v2, 0, v2, s[6:7]
1533 ; SDAG-NEXT:    v_cndmask_b32_e64 v12, 0, v0, s[4:5]
1534 ; SDAG-NEXT:    v_cndmask_b32_e64 v11, 0, v1, s[4:5]
1535 ; SDAG-NEXT:    v_mad_u64_u32 v[0:1], s[4:5], v12, v8, 0
1536 ; SDAG-NEXT:    v_mul_lo_u32 v13, v9, v2
1537 ; SDAG-NEXT:    v_mul_lo_u32 v14, v8, v3
1538 ; SDAG-NEXT:    v_mov_b32_e32 v4, v1
1539 ; SDAG-NEXT:    v_mad_u64_u32 v[6:7], s[4:5], v11, v8, v[4:5]
1540 ; SDAG-NEXT:    v_mad_u64_u32 v[2:3], s[4:5], v8, v2, 0
1541 ; SDAG-NEXT:    v_mov_b32_e32 v4, v6
1542 ; SDAG-NEXT:    v_mad_u64_u32 v[4:5], s[4:5], v12, v9, v[4:5]
1543 ; SDAG-NEXT:    v_add3_u32 v3, v3, v14, v13
1544 ; SDAG-NEXT:    v_mad_u64_u32 v[1:2], s[4:5], v10, v12, v[2:3]
1545 ; SDAG-NEXT:    v_add_co_u32_e64 v5, s[4:5], v7, v5
1546 ; SDAG-NEXT:    v_addc_co_u32_e64 v6, s[4:5], 0, 0, s[4:5]
1547 ; SDAG-NEXT:    v_mul_lo_u32 v3, v10, v11
1548 ; SDAG-NEXT:    v_mul_lo_u32 v8, v10, v12
1549 ; SDAG-NEXT:    v_mad_u64_u32 v[5:6], s[4:5], v11, v9, v[5:6]
1550 ; SDAG-NEXT:    v_add3_u32 v3, v8, v2, v3
1551 ; SDAG-NEXT:    v_add_co_u32_e64 v2, s[4:5], v5, v1
1552 ; SDAG-NEXT:    v_addc_co_u32_e64 v3, s[4:5], v6, v3, s[4:5]
1553 ; SDAG-NEXT:    v_mov_b32_e32 v1, v4
1554 ; SDAG-NEXT:    ; implicit-def: $vgpr6_vgpr7
1555 ; SDAG-NEXT:    ; implicit-def: $vgpr4_vgpr5
1556 ; SDAG-NEXT:    ; implicit-def: $vgpr8
1557 ; SDAG-NEXT:  .LBB6_4: ; %Flow
1558 ; SDAG-NEXT:    s_andn2_saveexec_b64 s[6:7], s[12:13]
1559 ; SDAG-NEXT:    s_cbranch_execz .LBB6_6
1560 ; SDAG-NEXT:  ; %bb.5: ; %fp-to-i-if-then12
1561 ; SDAG-NEXT:    v_sub_u32_e32 v2, 0x86, v6
1562 ; SDAG-NEXT:    v_lshrrev_b64 v[0:1], v2, v[4:5]
1563 ; SDAG-NEXT:    v_cmp_gt_u32_e64 s[4:5], 64, v2
1564 ; SDAG-NEXT:    v_cndmask_b32_e64 v0, 0, v0, s[4:5]
1565 ; SDAG-NEXT:    v_cmp_eq_u32_e64 s[4:5], 0, v2
1566 ; SDAG-NEXT:    v_cndmask_b32_e64 v0, v0, v4, s[4:5]
1567 ; SDAG-NEXT:    v_mul_hi_i32_i24_e32 v1, v0, v8
1568 ; SDAG-NEXT:    v_ashrrev_i32_e32 v2, 31, v1
1569 ; SDAG-NEXT:    v_mul_i32_i24_e32 v0, v0, v8
1570 ; SDAG-NEXT:    v_mov_b32_e32 v3, v2
1571 ; SDAG-NEXT:  .LBB6_6: ; %Flow1
1572 ; SDAG-NEXT:    s_or_b64 exec, exec, s[6:7]
1573 ; SDAG-NEXT:  .LBB6_7: ; %Flow2
1574 ; SDAG-NEXT:    s_andn2_saveexec_b64 s[4:5], s[10:11]
1575 ; SDAG-NEXT:  ; %bb.8: ; %fp-to-i-if-then5
1576 ; SDAG-NEXT:    v_bfrev_b32_e32 v0, 1
1577 ; SDAG-NEXT:    v_bfrev_b32_e32 v1, -2
1578 ; SDAG-NEXT:    v_cndmask_b32_e64 v2, 0, -1, vcc
1579 ; SDAG-NEXT:    v_cndmask_b32_e32 v3, v0, v1, vcc
1580 ; SDAG-NEXT:    v_mov_b32_e32 v0, v2
1581 ; SDAG-NEXT:    v_mov_b32_e32 v1, v2
1582 ; SDAG-NEXT:  ; %bb.9: ; %Flow3
1583 ; SDAG-NEXT:    s_or_b64 exec, exec, s[4:5]
1584 ; SDAG-NEXT:  .LBB6_10: ; %fp-to-i-cleanup
1585 ; SDAG-NEXT:    s_or_b64 exec, exec, s[8:9]
1586 ; SDAG-NEXT:    s_setpc_b64 s[30:31]
1588 ; GISEL-LABEL: fptosi_bf16_to_i128:
1589 ; GISEL:       ; %bb.0: ; %fp-to-i-entry
1590 ; GISEL-NEXT:    s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1591 ; GISEL-NEXT:    v_mov_b32_e32 v4, v0
1592 ; GISEL-NEXT:    v_and_b32_e32 v5, 0xffff, v4
1593 ; GISEL-NEXT:    v_mov_b32_e32 v6, 0
1594 ; GISEL-NEXT:    v_lshrrev_b64 v[0:1], 7, v[5:6]
1595 ; GISEL-NEXT:    v_mov_b32_e32 v1, 0x7f
1596 ; GISEL-NEXT:    s_mov_b64 s[4:5], 0
1597 ; GISEL-NEXT:    v_mov_b32_e32 v2, 0
1598 ; GISEL-NEXT:    v_bfe_u32 v5, v0, 0, 8
1599 ; GISEL-NEXT:    v_cmp_ge_u64_e32 vcc, v[5:6], v[1:2]
1600 ; GISEL-NEXT:    s_mov_b64 s[6:7], s[4:5]
1601 ; GISEL-NEXT:    v_mov_b32_e32 v0, s4
1602 ; GISEL-NEXT:    v_mov_b32_e32 v1, s5
1603 ; GISEL-NEXT:    v_mov_b32_e32 v2, s6
1604 ; GISEL-NEXT:    v_mov_b32_e32 v3, s7
1605 ; GISEL-NEXT:    s_and_saveexec_b64 s[12:13], vcc
1606 ; GISEL-NEXT:    s_cbranch_execz .LBB6_10
1607 ; GISEL-NEXT:  ; %bb.1: ; %fp-to-i-if-end
1608 ; GISEL-NEXT:    v_add_co_u32_e32 v0, vcc, 0xffffff01, v5
1609 ; GISEL-NEXT:    v_mov_b32_e32 v2, 0xffffff80
1610 ; GISEL-NEXT:    v_addc_co_u32_e64 v1, s[6:7], 0, -1, vcc
1611 ; GISEL-NEXT:    v_mov_b32_e32 v3, -1
1612 ; GISEL-NEXT:    v_addc_co_u32_e64 v7, s[6:7], 0, -1, s[6:7]
1613 ; GISEL-NEXT:    v_cmp_ge_u64_e32 vcc, v[0:1], v[2:3]
1614 ; GISEL-NEXT:    v_addc_co_u32_e64 v8, s[6:7], 0, -1, s[6:7]
1615 ; GISEL-NEXT:    v_cndmask_b32_e64 v0, 0, 1, vcc
1616 ; GISEL-NEXT:    v_cmp_le_u64_e32 vcc, -1, v[7:8]
1617 ; GISEL-NEXT:    v_cmp_lt_i16_e64 s[4:5], -1, v4
1618 ; GISEL-NEXT:    v_cndmask_b32_e64 v1, 0, 1, vcc
1619 ; GISEL-NEXT:    v_cmp_eq_u64_e32 vcc, -1, v[7:8]
1620 ; GISEL-NEXT:    v_cndmask_b32_e32 v0, v1, v0, vcc
1621 ; GISEL-NEXT:    v_and_b32_e32 v0, 1, v0
1622 ; GISEL-NEXT:    v_cmp_ne_u32_e32 vcc, 0, v0
1623 ; GISEL-NEXT:    ; implicit-def: $vgpr0_vgpr1_vgpr2_vgpr3
1624 ; GISEL-NEXT:    s_and_saveexec_b64 s[6:7], vcc
1625 ; GISEL-NEXT:    s_xor_b64 s[14:15], exec, s[6:7]
1626 ; GISEL-NEXT:    s_cbranch_execz .LBB6_7
1627 ; GISEL-NEXT:  ; %bb.2: ; %fp-to-i-if-end9
1628 ; GISEL-NEXT:    s_xor_b64 s[6:7], s[4:5], -1
1629 ; GISEL-NEXT:    v_cndmask_b32_e64 v0, 0, -1, s[6:7]
1630 ; GISEL-NEXT:    v_and_b32_e32 v0, 1, v0
1631 ; GISEL-NEXT:    v_lshlrev_b16_e32 v2, 1, v0
1632 ; GISEL-NEXT:    v_cndmask_b32_e64 v1, 0, 1, s[6:7]
1633 ; GISEL-NEXT:    v_lshlrev_b16_e32 v3, 2, v0
1634 ; GISEL-NEXT:    v_lshlrev_b16_e32 v7, 3, v0
1635 ; GISEL-NEXT:    v_lshlrev_b16_e32 v8, 4, v0
1636 ; GISEL-NEXT:    v_lshlrev_b16_e32 v9, 5, v0
1637 ; GISEL-NEXT:    v_lshlrev_b16_e32 v10, 6, v0
1638 ; GISEL-NEXT:    v_lshlrev_b16_e32 v11, 7, v0
1639 ; GISEL-NEXT:    v_lshlrev_b16_e32 v12, 8, v0
1640 ; GISEL-NEXT:    v_lshlrev_b16_e32 v13, 9, v0
1641 ; GISEL-NEXT:    v_lshlrev_b16_e32 v14, 10, v0
1642 ; GISEL-NEXT:    v_lshlrev_b16_e32 v15, 11, v0
1643 ; GISEL-NEXT:    v_lshlrev_b16_e32 v16, 12, v0
1644 ; GISEL-NEXT:    v_lshlrev_b16_e32 v17, 13, v0
1645 ; GISEL-NEXT:    v_lshlrev_b16_e32 v18, 14, v0
1646 ; GISEL-NEXT:    v_lshlrev_b16_e32 v19, 15, v0
1647 ; GISEL-NEXT:    v_or_b32_e32 v0, v0, v2
1648 ; GISEL-NEXT:    v_or_b32_e32 v1, v1, v2
1649 ; GISEL-NEXT:    v_or_b32_e32 v0, v0, v3
1650 ; GISEL-NEXT:    v_or_b32_e32 v1, v1, v3
1651 ; GISEL-NEXT:    v_or_b32_e32 v0, v0, v7
1652 ; GISEL-NEXT:    v_or_b32_e32 v1, v1, v7
1653 ; GISEL-NEXT:    v_or_b32_e32 v0, v0, v8
1654 ; GISEL-NEXT:    v_or_b32_e32 v1, v1, v8
1655 ; GISEL-NEXT:    v_or_b32_e32 v0, v0, v9
1656 ; GISEL-NEXT:    v_or_b32_e32 v1, v1, v9
1657 ; GISEL-NEXT:    v_or_b32_e32 v0, v0, v10
1658 ; GISEL-NEXT:    v_or_b32_e32 v1, v1, v10
1659 ; GISEL-NEXT:    v_or_b32_e32 v0, v0, v11
1660 ; GISEL-NEXT:    v_or_b32_e32 v1, v1, v11
1661 ; GISEL-NEXT:    v_or_b32_e32 v0, v0, v12
1662 ; GISEL-NEXT:    v_or_b32_e32 v1, v1, v12
1663 ; GISEL-NEXT:    v_or_b32_e32 v0, v0, v13
1664 ; GISEL-NEXT:    v_or_b32_e32 v1, v1, v13
1665 ; GISEL-NEXT:    v_or_b32_e32 v0, v0, v14
1666 ; GISEL-NEXT:    v_or_b32_e32 v1, v1, v14
1667 ; GISEL-NEXT:    v_or_b32_e32 v0, v0, v15
1668 ; GISEL-NEXT:    v_or_b32_e32 v1, v1, v15
1669 ; GISEL-NEXT:    v_or_b32_e32 v0, v0, v16
1670 ; GISEL-NEXT:    v_or_b32_e32 v1, v1, v16
1671 ; GISEL-NEXT:    v_or_b32_e32 v0, v0, v17
1672 ; GISEL-NEXT:    v_or_b32_e32 v1, v1, v17
1673 ; GISEL-NEXT:    v_or_b32_e32 v0, v0, v18
1674 ; GISEL-NEXT:    v_or_b32_e32 v1, v1, v18
1675 ; GISEL-NEXT:    v_or_b32_e32 v0, v0, v19
1676 ; GISEL-NEXT:    v_or_b32_e32 v1, v1, v19
1677 ; GISEL-NEXT:    v_and_b32_e32 v11, 0xffff, v0
1678 ; GISEL-NEXT:    v_and_b32_e32 v1, 0xffff, v1
1679 ; GISEL-NEXT:    v_lshlrev_b32_e32 v0, 16, v11
1680 ; GISEL-NEXT:    v_or3_b32 v9, v1, v0, 1
1681 ; GISEL-NEXT:    v_or3_b32 v10, v11, v0, 0
1682 ; GISEL-NEXT:    v_mov_b32_e32 v0, 0x86
1683 ; GISEL-NEXT:    v_mov_b32_e32 v1, 0
1684 ; GISEL-NEXT:    v_and_b32_e32 v2, 0x7f, v4
1685 ; GISEL-NEXT:    v_cmp_ge_u64_e32 vcc, v[5:6], v[0:1]
1686 ; GISEL-NEXT:    v_or_b32_e32 v7, 0x80, v2
1687 ; GISEL-NEXT:    v_mov_b32_e32 v8, 0
1688 ; GISEL-NEXT:    ; implicit-def: $vgpr0_vgpr1_vgpr2_vgpr3
1689 ; GISEL-NEXT:    s_and_saveexec_b64 s[6:7], vcc
1690 ; GISEL-NEXT:    s_xor_b64 s[16:17], exec, s[6:7]
1691 ; GISEL-NEXT:    s_cbranch_execz .LBB6_4
1692 ; GISEL-NEXT:  ; %bb.3: ; %fp-to-i-if-else
1693 ; GISEL-NEXT:    v_add_u32_e32 v6, 0xffffff7a, v5
1694 ; GISEL-NEXT:    v_lshlrev_b64 v[0:1], v6, v[7:8]
1695 ; GISEL-NEXT:    v_add_u32_e32 v4, 0xffffff3a, v5
1696 ; GISEL-NEXT:    v_sub_u32_e32 v2, 64, v6
1697 ; GISEL-NEXT:    v_cmp_gt_u32_e32 vcc, 64, v6
1698 ; GISEL-NEXT:    v_lshl_or_b32 v11, v11, 16, v11
1699 ; GISEL-NEXT:    v_lshrrev_b64 v[2:3], v2, v[7:8]
1700 ; GISEL-NEXT:    v_lshlrev_b64 v[4:5], v4, v[7:8]
1701 ; GISEL-NEXT:    v_cndmask_b32_e32 v8, 0, v0, vcc
1702 ; GISEL-NEXT:    v_cndmask_b32_e32 v12, 0, v1, vcc
1703 ; GISEL-NEXT:    v_mad_u64_u32 v[0:1], s[6:7], v8, v11, 0
1704 ; GISEL-NEXT:    v_cmp_eq_u32_e64 s[6:7], 0, v6
1705 ; GISEL-NEXT:    v_cndmask_b32_e32 v2, v4, v2, vcc
1706 ; GISEL-NEXT:    v_mad_u64_u32 v[6:7], s[8:9], v12, v10, v[0:1]
1707 ; GISEL-NEXT:    v_cndmask_b32_e64 v13, v2, 0, s[6:7]
1708 ; GISEL-NEXT:    v_mad_u64_u32 v[0:1], s[8:9], v8, v9, 0
1709 ; GISEL-NEXT:    v_mad_u64_u32 v[6:7], s[8:9], v13, v9, v[6:7]
1710 ; GISEL-NEXT:    v_mul_lo_u32 v4, v12, v11
1711 ; GISEL-NEXT:    v_cndmask_b32_e32 v3, v5, v3, vcc
1712 ; GISEL-NEXT:    v_mov_b32_e32 v2, v6
1713 ; GISEL-NEXT:    v_mad_u64_u32 v[1:2], s[8:9], v8, v10, v[1:2]
1714 ; GISEL-NEXT:    v_mul_lo_u32 v6, v8, v11
1715 ; GISEL-NEXT:    v_cndmask_b32_e64 v3, v3, 0, s[6:7]
1716 ; GISEL-NEXT:    v_mad_u64_u32 v[1:2], s[10:11], v12, v9, v[1:2]
1717 ; GISEL-NEXT:    v_addc_co_u32_e64 v6, s[10:11], v7, v6, s[10:11]
1718 ; GISEL-NEXT:    v_addc_co_u32_e64 v4, s[8:9], v6, v4, s[8:9]
1719 ; GISEL-NEXT:    v_mad_u64_u32 v[6:7], s[8:9], v13, v10, v[4:5]
1720 ; GISEL-NEXT:    ; implicit-def: $vgpr5
1721 ; GISEL-NEXT:    v_mad_u64_u32 v[3:4], s[6:7], v3, v9, v[6:7]
1722 ; GISEL-NEXT:    ; implicit-def: $vgpr7_vgpr8
1723 ; GISEL-NEXT:    ; implicit-def: $vgpr9
1724 ; GISEL-NEXT:  .LBB6_4: ; %Flow
1725 ; GISEL-NEXT:    s_andn2_saveexec_b64 s[6:7], s[16:17]
1726 ; GISEL-NEXT:    s_cbranch_execz .LBB6_6
1727 ; GISEL-NEXT:  ; %bb.5: ; %fp-to-i-if-then12
1728 ; GISEL-NEXT:    v_sub_co_u32_e32 v2, vcc, 0x86, v5
1729 ; GISEL-NEXT:    v_lshrrev_b64 v[0:1], v2, v[7:8]
1730 ; GISEL-NEXT:    v_cmp_gt_u32_e32 vcc, 64, v2
1731 ; GISEL-NEXT:    v_cndmask_b32_e32 v0, 0, v0, vcc
1732 ; GISEL-NEXT:    v_cmp_eq_u32_e32 vcc, 0, v2
1733 ; GISEL-NEXT:    v_cndmask_b32_e32 v0, v0, v7, vcc
1734 ; GISEL-NEXT:    v_mul_hi_i32_i24_e32 v1, v0, v9
1735 ; GISEL-NEXT:    v_ashrrev_i32_e32 v2, 31, v1
1736 ; GISEL-NEXT:    v_mul_i32_i24_e32 v0, v0, v9
1737 ; GISEL-NEXT:    v_mov_b32_e32 v3, v2
1738 ; GISEL-NEXT:  .LBB6_6: ; %Flow1
1739 ; GISEL-NEXT:    s_or_b64 exec, exec, s[6:7]
1740 ; GISEL-NEXT:  .LBB6_7: ; %Flow2
1741 ; GISEL-NEXT:    s_andn2_saveexec_b64 s[6:7], s[14:15]
1742 ; GISEL-NEXT:    s_cbranch_execz .LBB6_9
1743 ; GISEL-NEXT:  ; %bb.8: ; %fp-to-i-if-then5
1744 ; GISEL-NEXT:    v_cndmask_b32_e64 v1, 0, -1, s[4:5]
1745 ; GISEL-NEXT:    v_and_b32_e32 v1, 1, v1
1746 ; GISEL-NEXT:    v_cndmask_b32_e64 v0, 0, 1, s[4:5]
1747 ; GISEL-NEXT:    v_lshlrev_b32_e32 v2, 1, v1
1748 ; GISEL-NEXT:    v_or_b32_e32 v0, v0, v2
1749 ; GISEL-NEXT:    v_lshlrev_b32_e32 v3, 2, v1
1750 ; GISEL-NEXT:    v_lshlrev_b32_e32 v4, 3, v1
1751 ; GISEL-NEXT:    v_or_b32_e32 v2, v1, v2
1752 ; GISEL-NEXT:    v_or3_b32 v0, v0, v3, v4
1753 ; GISEL-NEXT:    v_lshlrev_b32_e32 v5, 4, v1
1754 ; GISEL-NEXT:    v_lshlrev_b32_e32 v6, 5, v1
1755 ; GISEL-NEXT:    v_or3_b32 v2, v2, v3, v4
1756 ; GISEL-NEXT:    v_or3_b32 v0, v0, v5, v6
1757 ; GISEL-NEXT:    v_lshlrev_b32_e32 v7, 6, v1
1758 ; GISEL-NEXT:    v_lshlrev_b32_e32 v8, 7, v1
1759 ; GISEL-NEXT:    v_or3_b32 v2, v2, v5, v6
1760 ; GISEL-NEXT:    v_or3_b32 v0, v0, v7, v8
1761 ; GISEL-NEXT:    v_lshlrev_b32_e32 v9, 8, v1
1762 ; GISEL-NEXT:    v_lshlrev_b32_e32 v10, 9, v1
1763 ; GISEL-NEXT:    v_or3_b32 v2, v2, v7, v8
1764 ; GISEL-NEXT:    v_or3_b32 v0, v0, v9, v10
1765 ; GISEL-NEXT:    v_lshlrev_b32_e32 v11, 10, v1
1766 ; GISEL-NEXT:    v_lshlrev_b32_e32 v12, 11, v1
1767 ; GISEL-NEXT:    v_or3_b32 v2, v2, v9, v10
1768 ; GISEL-NEXT:    v_or3_b32 v0, v0, v11, v12
1769 ; GISEL-NEXT:    v_lshlrev_b32_e32 v13, 12, v1
1770 ; GISEL-NEXT:    v_lshlrev_b32_e32 v14, 13, v1
1771 ; GISEL-NEXT:    v_or3_b32 v2, v2, v11, v12
1772 ; GISEL-NEXT:    v_or3_b32 v0, v0, v13, v14
1773 ; GISEL-NEXT:    v_lshlrev_b32_e32 v15, 14, v1
1774 ; GISEL-NEXT:    v_lshlrev_b32_e32 v16, 15, v1
1775 ; GISEL-NEXT:    v_or3_b32 v2, v2, v13, v14
1776 ; GISEL-NEXT:    v_or3_b32 v0, v0, v15, v16
1777 ; GISEL-NEXT:    v_lshlrev_b32_e32 v17, 16, v1
1778 ; GISEL-NEXT:    v_lshlrev_b32_e32 v18, 17, v1
1779 ; GISEL-NEXT:    v_or3_b32 v2, v2, v15, v16
1780 ; GISEL-NEXT:    v_or3_b32 v0, v0, v17, v18
1781 ; GISEL-NEXT:    v_lshlrev_b32_e32 v19, 18, v1
1782 ; GISEL-NEXT:    v_lshlrev_b32_e32 v3, 19, v1
1783 ; GISEL-NEXT:    v_or3_b32 v2, v2, v17, v18
1784 ; GISEL-NEXT:    v_or3_b32 v0, v0, v19, v3
1785 ; GISEL-NEXT:    v_lshlrev_b32_e32 v4, 20, v1
1786 ; GISEL-NEXT:    v_lshlrev_b32_e32 v5, 21, v1
1787 ; GISEL-NEXT:    v_or3_b32 v2, v2, v19, v3
1788 ; GISEL-NEXT:    v_or3_b32 v0, v0, v4, v5
1789 ; GISEL-NEXT:    v_lshlrev_b32_e32 v6, 22, v1
1790 ; GISEL-NEXT:    v_lshlrev_b32_e32 v7, 23, v1
1791 ; GISEL-NEXT:    v_or3_b32 v2, v2, v4, v5
1792 ; GISEL-NEXT:    v_or3_b32 v0, v0, v6, v7
1793 ; GISEL-NEXT:    v_lshlrev_b32_e32 v8, 24, v1
1794 ; GISEL-NEXT:    v_lshlrev_b32_e32 v9, 25, v1
1795 ; GISEL-NEXT:    v_or3_b32 v2, v2, v6, v7
1796 ; GISEL-NEXT:    v_or3_b32 v0, v0, v8, v9
1797 ; GISEL-NEXT:    v_lshlrev_b32_e32 v10, 26, v1
1798 ; GISEL-NEXT:    v_lshlrev_b32_e32 v11, 27, v1
1799 ; GISEL-NEXT:    v_or3_b32 v2, v2, v8, v9
1800 ; GISEL-NEXT:    v_or3_b32 v0, v0, v10, v11
1801 ; GISEL-NEXT:    v_lshlrev_b32_e32 v12, 28, v1
1802 ; GISEL-NEXT:    v_lshlrev_b32_e32 v13, 29, v1
1803 ; GISEL-NEXT:    v_or3_b32 v2, v2, v10, v11
1804 ; GISEL-NEXT:    v_or3_b32 v0, v0, v12, v13
1805 ; GISEL-NEXT:    v_lshlrev_b32_e32 v14, 30, v1
1806 ; GISEL-NEXT:    v_lshlrev_b32_e32 v1, 31, v1
1807 ; GISEL-NEXT:    v_or3_b32 v2, v2, v12, v13
1808 ; GISEL-NEXT:    v_or3_b32 v0, v0, v14, v1
1809 ; GISEL-NEXT:    v_or3_b32 v1, v2, v14, v1
1810 ; GISEL-NEXT:    v_add_u32_e32 v3, 0x80000000, v1
1811 ; GISEL-NEXT:    v_mov_b32_e32 v2, v1
1812 ; GISEL-NEXT:  .LBB6_9: ; %Flow3
1813 ; GISEL-NEXT:    s_or_b64 exec, exec, s[6:7]
1814 ; GISEL-NEXT:  .LBB6_10: ; %fp-to-i-cleanup
1815 ; GISEL-NEXT:    s_or_b64 exec, exec, s[12:13]
1816 ; GISEL-NEXT:    s_setpc_b64 s[30:31]
1817   %cvt = fptosi bfloat %x to i128
1818   ret i128 %cvt
1821 define i128 @fptoui_bf16_to_i128(bfloat %x) {
1822 ; SDAG-LABEL: fptoui_bf16_to_i128:
1823 ; SDAG:       ; %bb.0: ; %fp-to-i-entry
1824 ; SDAG-NEXT:    s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1825 ; SDAG-NEXT:    v_mov_b32_e32 v4, v0
1826 ; SDAG-NEXT:    v_bfe_u32 v6, v4, 7, 8
1827 ; SDAG-NEXT:    s_movk_i32 s4, 0x7e
1828 ; SDAG-NEXT:    v_mov_b32_e32 v0, 0
1829 ; SDAG-NEXT:    v_mov_b32_e32 v2, 0
1830 ; SDAG-NEXT:    v_mov_b32_e32 v7, 0
1831 ; SDAG-NEXT:    v_mov_b32_e32 v1, 0
1832 ; SDAG-NEXT:    v_mov_b32_e32 v3, 0
1833 ; SDAG-NEXT:    v_cmp_lt_u32_e32 vcc, s4, v6
1834 ; SDAG-NEXT:    s_and_saveexec_b64 s[8:9], vcc
1835 ; SDAG-NEXT:    s_cbranch_execz .LBB7_10
1836 ; SDAG-NEXT:  ; %bb.1: ; %fp-to-i-if-end
1837 ; SDAG-NEXT:    v_add_co_u32_e32 v0, vcc, 0xffffff01, v6
1838 ; SDAG-NEXT:    v_addc_co_u32_e32 v1, vcc, -1, v7, vcc
1839 ; SDAG-NEXT:    v_addc_co_u32_e32 v2, vcc, -1, v7, vcc
1840 ; SDAG-NEXT:    s_movk_i32 s6, 0xff7f
1841 ; SDAG-NEXT:    v_addc_co_u32_e32 v3, vcc, -1, v7, vcc
1842 ; SDAG-NEXT:    s_mov_b32 s7, -1
1843 ; SDAG-NEXT:    v_cmp_eq_u64_e64 s[4:5], -1, v[2:3]
1844 ; SDAG-NEXT:    v_cmp_lt_u64_e64 s[6:7], s[6:7], v[0:1]
1845 ; SDAG-NEXT:    v_cmp_lt_i16_e32 vcc, -1, v4
1846 ; SDAG-NEXT:    s_and_b64 s[4:5], s[4:5], s[6:7]
1847 ; SDAG-NEXT:    ; implicit-def: $vgpr0_vgpr1
1848 ; SDAG-NEXT:    ; implicit-def: $vgpr2_vgpr3
1849 ; SDAG-NEXT:    s_and_saveexec_b64 s[6:7], s[4:5]
1850 ; SDAG-NEXT:    s_xor_b64 s[10:11], exec, s[6:7]
1851 ; SDAG-NEXT:    s_cbranch_execz .LBB7_7
1852 ; SDAG-NEXT:  ; %bb.2: ; %fp-to-i-if-end9
1853 ; SDAG-NEXT:    s_movk_i32 s4, 0x7f
1854 ; SDAG-NEXT:    v_and_b32_sdwa v0, v4, s4 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_0 src1_sel:DWORD
1855 ; SDAG-NEXT:    s_mov_b64 s[4:5], 0x85
1856 ; SDAG-NEXT:    v_cmp_lt_u64_e64 s[4:5], s[4:5], v[6:7]
1857 ; SDAG-NEXT:    v_mov_b32_e32 v5, 0
1858 ; SDAG-NEXT:    v_cndmask_b32_e64 v9, -1, 0, vcc
1859 ; SDAG-NEXT:    v_cndmask_b32_e64 v8, -1, 1, vcc
1860 ; SDAG-NEXT:    v_or_b32_e32 v4, 0x80, v0
1861 ; SDAG-NEXT:    ; implicit-def: $vgpr0_vgpr1
1862 ; SDAG-NEXT:    ; implicit-def: $vgpr2_vgpr3
1863 ; SDAG-NEXT:    s_and_saveexec_b64 s[6:7], s[4:5]
1864 ; SDAG-NEXT:    s_xor_b64 s[12:13], exec, s[6:7]
1865 ; SDAG-NEXT:    s_cbranch_execz .LBB7_4
1866 ; SDAG-NEXT:  ; %bb.3: ; %fp-to-i-if-else
1867 ; SDAG-NEXT:    v_cndmask_b32_e64 v0, 0, 1, vcc
1868 ; SDAG-NEXT:    v_add_co_u32_e64 v10, s[4:5], -1, v0
1869 ; SDAG-NEXT:    v_sub_u32_e32 v0, 0xc6, v6
1870 ; SDAG-NEXT:    v_add_u32_e32 v2, 0xffffff3a, v6
1871 ; SDAG-NEXT:    v_add_u32_e32 v7, 0xffffff7a, v6
1872 ; SDAG-NEXT:    v_lshrrev_b64 v[0:1], v0, v[4:5]
1873 ; SDAG-NEXT:    v_lshlrev_b64 v[2:3], v2, v[4:5]
1874 ; SDAG-NEXT:    v_cmp_gt_u32_e64 s[4:5], 64, v7
1875 ; SDAG-NEXT:    v_cndmask_b32_e64 v1, v3, v1, s[4:5]
1876 ; SDAG-NEXT:    v_cmp_ne_u32_e64 s[6:7], 0, v7
1877 ; SDAG-NEXT:    v_cndmask_b32_e64 v3, 0, v1, s[6:7]
1878 ; SDAG-NEXT:    v_cndmask_b32_e64 v2, v2, v0, s[4:5]
1879 ; SDAG-NEXT:    v_lshlrev_b64 v[0:1], v7, v[4:5]
1880 ; SDAG-NEXT:    v_cndmask_b32_e64 v2, 0, v2, s[6:7]
1881 ; SDAG-NEXT:    v_cndmask_b32_e64 v12, 0, v0, s[4:5]
1882 ; SDAG-NEXT:    v_cndmask_b32_e64 v11, 0, v1, s[4:5]
1883 ; SDAG-NEXT:    v_mad_u64_u32 v[0:1], s[4:5], v12, v8, 0
1884 ; SDAG-NEXT:    v_mul_lo_u32 v13, v9, v2
1885 ; SDAG-NEXT:    v_mul_lo_u32 v14, v8, v3
1886 ; SDAG-NEXT:    v_mov_b32_e32 v4, v1
1887 ; SDAG-NEXT:    v_mad_u64_u32 v[6:7], s[4:5], v11, v8, v[4:5]
1888 ; SDAG-NEXT:    v_mad_u64_u32 v[2:3], s[4:5], v8, v2, 0
1889 ; SDAG-NEXT:    v_mov_b32_e32 v4, v6
1890 ; SDAG-NEXT:    v_mad_u64_u32 v[4:5], s[4:5], v12, v9, v[4:5]
1891 ; SDAG-NEXT:    v_add3_u32 v3, v3, v14, v13
1892 ; SDAG-NEXT:    v_mad_u64_u32 v[1:2], s[4:5], v10, v12, v[2:3]
1893 ; SDAG-NEXT:    v_add_co_u32_e64 v5, s[4:5], v7, v5
1894 ; SDAG-NEXT:    v_addc_co_u32_e64 v6, s[4:5], 0, 0, s[4:5]
1895 ; SDAG-NEXT:    v_mul_lo_u32 v3, v10, v11
1896 ; SDAG-NEXT:    v_mul_lo_u32 v8, v10, v12
1897 ; SDAG-NEXT:    v_mad_u64_u32 v[5:6], s[4:5], v11, v9, v[5:6]
1898 ; SDAG-NEXT:    v_add3_u32 v3, v8, v2, v3
1899 ; SDAG-NEXT:    v_add_co_u32_e64 v2, s[4:5], v5, v1
1900 ; SDAG-NEXT:    v_addc_co_u32_e64 v3, s[4:5], v6, v3, s[4:5]
1901 ; SDAG-NEXT:    v_mov_b32_e32 v1, v4
1902 ; SDAG-NEXT:    ; implicit-def: $vgpr6_vgpr7
1903 ; SDAG-NEXT:    ; implicit-def: $vgpr4_vgpr5
1904 ; SDAG-NEXT:    ; implicit-def: $vgpr8
1905 ; SDAG-NEXT:  .LBB7_4: ; %Flow
1906 ; SDAG-NEXT:    s_andn2_saveexec_b64 s[6:7], s[12:13]
1907 ; SDAG-NEXT:    s_cbranch_execz .LBB7_6
1908 ; SDAG-NEXT:  ; %bb.5: ; %fp-to-i-if-then12
1909 ; SDAG-NEXT:    v_sub_u32_e32 v2, 0x86, v6
1910 ; SDAG-NEXT:    v_lshrrev_b64 v[0:1], v2, v[4:5]
1911 ; SDAG-NEXT:    v_cmp_gt_u32_e64 s[4:5], 64, v2
1912 ; SDAG-NEXT:    v_cndmask_b32_e64 v0, 0, v0, s[4:5]
1913 ; SDAG-NEXT:    v_cmp_eq_u32_e64 s[4:5], 0, v2
1914 ; SDAG-NEXT:    v_cndmask_b32_e64 v0, v0, v4, s[4:5]
1915 ; SDAG-NEXT:    v_mul_hi_i32_i24_e32 v1, v0, v8
1916 ; SDAG-NEXT:    v_ashrrev_i32_e32 v2, 31, v1
1917 ; SDAG-NEXT:    v_mul_i32_i24_e32 v0, v0, v8
1918 ; SDAG-NEXT:    v_mov_b32_e32 v3, v2
1919 ; SDAG-NEXT:  .LBB7_6: ; %Flow1
1920 ; SDAG-NEXT:    s_or_b64 exec, exec, s[6:7]
1921 ; SDAG-NEXT:  .LBB7_7: ; %Flow2
1922 ; SDAG-NEXT:    s_andn2_saveexec_b64 s[4:5], s[10:11]
1923 ; SDAG-NEXT:  ; %bb.8: ; %fp-to-i-if-then5
1924 ; SDAG-NEXT:    v_bfrev_b32_e32 v0, 1
1925 ; SDAG-NEXT:    v_bfrev_b32_e32 v1, -2
1926 ; SDAG-NEXT:    v_cndmask_b32_e64 v2, 0, -1, vcc
1927 ; SDAG-NEXT:    v_cndmask_b32_e32 v3, v0, v1, vcc
1928 ; SDAG-NEXT:    v_mov_b32_e32 v0, v2
1929 ; SDAG-NEXT:    v_mov_b32_e32 v1, v2
1930 ; SDAG-NEXT:  ; %bb.9: ; %Flow3
1931 ; SDAG-NEXT:    s_or_b64 exec, exec, s[4:5]
1932 ; SDAG-NEXT:  .LBB7_10: ; %fp-to-i-cleanup
1933 ; SDAG-NEXT:    s_or_b64 exec, exec, s[8:9]
1934 ; SDAG-NEXT:    s_setpc_b64 s[30:31]
1936 ; GISEL-LABEL: fptoui_bf16_to_i128:
1937 ; GISEL:       ; %bb.0: ; %fp-to-i-entry
1938 ; GISEL-NEXT:    s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1939 ; GISEL-NEXT:    v_mov_b32_e32 v4, v0
1940 ; GISEL-NEXT:    v_and_b32_e32 v5, 0xffff, v4
1941 ; GISEL-NEXT:    v_mov_b32_e32 v6, 0
1942 ; GISEL-NEXT:    v_lshrrev_b64 v[0:1], 7, v[5:6]
1943 ; GISEL-NEXT:    v_mov_b32_e32 v1, 0x7f
1944 ; GISEL-NEXT:    s_mov_b64 s[4:5], 0
1945 ; GISEL-NEXT:    v_mov_b32_e32 v2, 0
1946 ; GISEL-NEXT:    v_bfe_u32 v5, v0, 0, 8
1947 ; GISEL-NEXT:    v_cmp_ge_u64_e32 vcc, v[5:6], v[1:2]
1948 ; GISEL-NEXT:    s_mov_b64 s[6:7], s[4:5]
1949 ; GISEL-NEXT:    v_mov_b32_e32 v0, s4
1950 ; GISEL-NEXT:    v_mov_b32_e32 v1, s5
1951 ; GISEL-NEXT:    v_mov_b32_e32 v2, s6
1952 ; GISEL-NEXT:    v_mov_b32_e32 v3, s7
1953 ; GISEL-NEXT:    s_and_saveexec_b64 s[12:13], vcc
1954 ; GISEL-NEXT:    s_cbranch_execz .LBB7_10
1955 ; GISEL-NEXT:  ; %bb.1: ; %fp-to-i-if-end
1956 ; GISEL-NEXT:    v_add_co_u32_e32 v0, vcc, 0xffffff01, v5
1957 ; GISEL-NEXT:    v_mov_b32_e32 v2, 0xffffff80
1958 ; GISEL-NEXT:    v_addc_co_u32_e64 v1, s[6:7], 0, -1, vcc
1959 ; GISEL-NEXT:    v_mov_b32_e32 v3, -1
1960 ; GISEL-NEXT:    v_addc_co_u32_e64 v7, s[6:7], 0, -1, s[6:7]
1961 ; GISEL-NEXT:    v_cmp_ge_u64_e32 vcc, v[0:1], v[2:3]
1962 ; GISEL-NEXT:    v_addc_co_u32_e64 v8, s[6:7], 0, -1, s[6:7]
1963 ; GISEL-NEXT:    v_cndmask_b32_e64 v0, 0, 1, vcc
1964 ; GISEL-NEXT:    v_cmp_le_u64_e32 vcc, -1, v[7:8]
1965 ; GISEL-NEXT:    v_cmp_lt_i16_e64 s[4:5], -1, v4
1966 ; GISEL-NEXT:    v_cndmask_b32_e64 v1, 0, 1, vcc
1967 ; GISEL-NEXT:    v_cmp_eq_u64_e32 vcc, -1, v[7:8]
1968 ; GISEL-NEXT:    v_cndmask_b32_e32 v0, v1, v0, vcc
1969 ; GISEL-NEXT:    v_and_b32_e32 v0, 1, v0
1970 ; GISEL-NEXT:    v_cmp_ne_u32_e32 vcc, 0, v0
1971 ; GISEL-NEXT:    ; implicit-def: $vgpr0_vgpr1_vgpr2_vgpr3
1972 ; GISEL-NEXT:    s_and_saveexec_b64 s[6:7], vcc
1973 ; GISEL-NEXT:    s_xor_b64 s[14:15], exec, s[6:7]
1974 ; GISEL-NEXT:    s_cbranch_execz .LBB7_7
1975 ; GISEL-NEXT:  ; %bb.2: ; %fp-to-i-if-end9
1976 ; GISEL-NEXT:    s_xor_b64 s[6:7], s[4:5], -1
1977 ; GISEL-NEXT:    v_cndmask_b32_e64 v0, 0, -1, s[6:7]
1978 ; GISEL-NEXT:    v_and_b32_e32 v0, 1, v0
1979 ; GISEL-NEXT:    v_lshlrev_b16_e32 v2, 1, v0
1980 ; GISEL-NEXT:    v_cndmask_b32_e64 v1, 0, 1, s[6:7]
1981 ; GISEL-NEXT:    v_lshlrev_b16_e32 v3, 2, v0
1982 ; GISEL-NEXT:    v_lshlrev_b16_e32 v7, 3, v0
1983 ; GISEL-NEXT:    v_lshlrev_b16_e32 v8, 4, v0
1984 ; GISEL-NEXT:    v_lshlrev_b16_e32 v9, 5, v0
1985 ; GISEL-NEXT:    v_lshlrev_b16_e32 v10, 6, v0
1986 ; GISEL-NEXT:    v_lshlrev_b16_e32 v11, 7, v0
1987 ; GISEL-NEXT:    v_lshlrev_b16_e32 v12, 8, v0
1988 ; GISEL-NEXT:    v_lshlrev_b16_e32 v13, 9, v0
1989 ; GISEL-NEXT:    v_lshlrev_b16_e32 v14, 10, v0
1990 ; GISEL-NEXT:    v_lshlrev_b16_e32 v15, 11, v0
1991 ; GISEL-NEXT:    v_lshlrev_b16_e32 v16, 12, v0
1992 ; GISEL-NEXT:    v_lshlrev_b16_e32 v17, 13, v0
1993 ; GISEL-NEXT:    v_lshlrev_b16_e32 v18, 14, v0
1994 ; GISEL-NEXT:    v_lshlrev_b16_e32 v19, 15, v0
1995 ; GISEL-NEXT:    v_or_b32_e32 v0, v0, v2
1996 ; GISEL-NEXT:    v_or_b32_e32 v1, v1, v2
1997 ; GISEL-NEXT:    v_or_b32_e32 v0, v0, v3
1998 ; GISEL-NEXT:    v_or_b32_e32 v1, v1, v3
1999 ; GISEL-NEXT:    v_or_b32_e32 v0, v0, v7
2000 ; GISEL-NEXT:    v_or_b32_e32 v1, v1, v7
2001 ; GISEL-NEXT:    v_or_b32_e32 v0, v0, v8
2002 ; GISEL-NEXT:    v_or_b32_e32 v1, v1, v8
2003 ; GISEL-NEXT:    v_or_b32_e32 v0, v0, v9
2004 ; GISEL-NEXT:    v_or_b32_e32 v1, v1, v9
2005 ; GISEL-NEXT:    v_or_b32_e32 v0, v0, v10
2006 ; GISEL-NEXT:    v_or_b32_e32 v1, v1, v10
2007 ; GISEL-NEXT:    v_or_b32_e32 v0, v0, v11
2008 ; GISEL-NEXT:    v_or_b32_e32 v1, v1, v11
2009 ; GISEL-NEXT:    v_or_b32_e32 v0, v0, v12
2010 ; GISEL-NEXT:    v_or_b32_e32 v1, v1, v12
2011 ; GISEL-NEXT:    v_or_b32_e32 v0, v0, v13
2012 ; GISEL-NEXT:    v_or_b32_e32 v1, v1, v13
2013 ; GISEL-NEXT:    v_or_b32_e32 v0, v0, v14
2014 ; GISEL-NEXT:    v_or_b32_e32 v1, v1, v14
2015 ; GISEL-NEXT:    v_or_b32_e32 v0, v0, v15
2016 ; GISEL-NEXT:    v_or_b32_e32 v1, v1, v15
2017 ; GISEL-NEXT:    v_or_b32_e32 v0, v0, v16
2018 ; GISEL-NEXT:    v_or_b32_e32 v1, v1, v16
2019 ; GISEL-NEXT:    v_or_b32_e32 v0, v0, v17
2020 ; GISEL-NEXT:    v_or_b32_e32 v1, v1, v17
2021 ; GISEL-NEXT:    v_or_b32_e32 v0, v0, v18
2022 ; GISEL-NEXT:    v_or_b32_e32 v1, v1, v18
2023 ; GISEL-NEXT:    v_or_b32_e32 v0, v0, v19
2024 ; GISEL-NEXT:    v_or_b32_e32 v1, v1, v19
2025 ; GISEL-NEXT:    v_and_b32_e32 v11, 0xffff, v0
2026 ; GISEL-NEXT:    v_and_b32_e32 v1, 0xffff, v1
2027 ; GISEL-NEXT:    v_lshlrev_b32_e32 v0, 16, v11
2028 ; GISEL-NEXT:    v_or3_b32 v9, v1, v0, 1
2029 ; GISEL-NEXT:    v_or3_b32 v10, v11, v0, 0
2030 ; GISEL-NEXT:    v_mov_b32_e32 v0, 0x86
2031 ; GISEL-NEXT:    v_mov_b32_e32 v1, 0
2032 ; GISEL-NEXT:    v_and_b32_e32 v2, 0x7f, v4
2033 ; GISEL-NEXT:    v_cmp_ge_u64_e32 vcc, v[5:6], v[0:1]
2034 ; GISEL-NEXT:    v_or_b32_e32 v7, 0x80, v2
2035 ; GISEL-NEXT:    v_mov_b32_e32 v8, 0
2036 ; GISEL-NEXT:    ; implicit-def: $vgpr0_vgpr1_vgpr2_vgpr3
2037 ; GISEL-NEXT:    s_and_saveexec_b64 s[6:7], vcc
2038 ; GISEL-NEXT:    s_xor_b64 s[16:17], exec, s[6:7]
2039 ; GISEL-NEXT:    s_cbranch_execz .LBB7_4
2040 ; GISEL-NEXT:  ; %bb.3: ; %fp-to-i-if-else
2041 ; GISEL-NEXT:    v_add_u32_e32 v6, 0xffffff7a, v5
2042 ; GISEL-NEXT:    v_lshlrev_b64 v[0:1], v6, v[7:8]
2043 ; GISEL-NEXT:    v_add_u32_e32 v4, 0xffffff3a, v5
2044 ; GISEL-NEXT:    v_sub_u32_e32 v2, 64, v6
2045 ; GISEL-NEXT:    v_cmp_gt_u32_e32 vcc, 64, v6
2046 ; GISEL-NEXT:    v_lshl_or_b32 v11, v11, 16, v11
2047 ; GISEL-NEXT:    v_lshrrev_b64 v[2:3], v2, v[7:8]
2048 ; GISEL-NEXT:    v_lshlrev_b64 v[4:5], v4, v[7:8]
2049 ; GISEL-NEXT:    v_cndmask_b32_e32 v8, 0, v0, vcc
2050 ; GISEL-NEXT:    v_cndmask_b32_e32 v12, 0, v1, vcc
2051 ; GISEL-NEXT:    v_mad_u64_u32 v[0:1], s[6:7], v8, v11, 0
2052 ; GISEL-NEXT:    v_cmp_eq_u32_e64 s[6:7], 0, v6
2053 ; GISEL-NEXT:    v_cndmask_b32_e32 v2, v4, v2, vcc
2054 ; GISEL-NEXT:    v_mad_u64_u32 v[6:7], s[8:9], v12, v10, v[0:1]
2055 ; GISEL-NEXT:    v_cndmask_b32_e64 v13, v2, 0, s[6:7]
2056 ; GISEL-NEXT:    v_mad_u64_u32 v[0:1], s[8:9], v8, v9, 0
2057 ; GISEL-NEXT:    v_mad_u64_u32 v[6:7], s[8:9], v13, v9, v[6:7]
2058 ; GISEL-NEXT:    v_mul_lo_u32 v4, v12, v11
2059 ; GISEL-NEXT:    v_cndmask_b32_e32 v3, v5, v3, vcc
2060 ; GISEL-NEXT:    v_mov_b32_e32 v2, v6
2061 ; GISEL-NEXT:    v_mad_u64_u32 v[1:2], s[8:9], v8, v10, v[1:2]
2062 ; GISEL-NEXT:    v_mul_lo_u32 v6, v8, v11
2063 ; GISEL-NEXT:    v_cndmask_b32_e64 v3, v3, 0, s[6:7]
2064 ; GISEL-NEXT:    v_mad_u64_u32 v[1:2], s[10:11], v12, v9, v[1:2]
2065 ; GISEL-NEXT:    v_addc_co_u32_e64 v6, s[10:11], v7, v6, s[10:11]
2066 ; GISEL-NEXT:    v_addc_co_u32_e64 v4, s[8:9], v6, v4, s[8:9]
2067 ; GISEL-NEXT:    v_mad_u64_u32 v[6:7], s[8:9], v13, v10, v[4:5]
2068 ; GISEL-NEXT:    ; implicit-def: $vgpr5
2069 ; GISEL-NEXT:    v_mad_u64_u32 v[3:4], s[6:7], v3, v9, v[6:7]
2070 ; GISEL-NEXT:    ; implicit-def: $vgpr7_vgpr8
2071 ; GISEL-NEXT:    ; implicit-def: $vgpr9
2072 ; GISEL-NEXT:  .LBB7_4: ; %Flow
2073 ; GISEL-NEXT:    s_andn2_saveexec_b64 s[6:7], s[16:17]
2074 ; GISEL-NEXT:    s_cbranch_execz .LBB7_6
2075 ; GISEL-NEXT:  ; %bb.5: ; %fp-to-i-if-then12
2076 ; GISEL-NEXT:    v_sub_co_u32_e32 v2, vcc, 0x86, v5
2077 ; GISEL-NEXT:    v_lshrrev_b64 v[0:1], v2, v[7:8]
2078 ; GISEL-NEXT:    v_cmp_gt_u32_e32 vcc, 64, v2
2079 ; GISEL-NEXT:    v_cndmask_b32_e32 v0, 0, v0, vcc
2080 ; GISEL-NEXT:    v_cmp_eq_u32_e32 vcc, 0, v2
2081 ; GISEL-NEXT:    v_cndmask_b32_e32 v0, v0, v7, vcc
2082 ; GISEL-NEXT:    v_mul_hi_i32_i24_e32 v1, v0, v9
2083 ; GISEL-NEXT:    v_ashrrev_i32_e32 v2, 31, v1
2084 ; GISEL-NEXT:    v_mul_i32_i24_e32 v0, v0, v9
2085 ; GISEL-NEXT:    v_mov_b32_e32 v3, v2
2086 ; GISEL-NEXT:  .LBB7_6: ; %Flow1
2087 ; GISEL-NEXT:    s_or_b64 exec, exec, s[6:7]
2088 ; GISEL-NEXT:  .LBB7_7: ; %Flow2
2089 ; GISEL-NEXT:    s_andn2_saveexec_b64 s[6:7], s[14:15]
2090 ; GISEL-NEXT:    s_cbranch_execz .LBB7_9
2091 ; GISEL-NEXT:  ; %bb.8: ; %fp-to-i-if-then5
2092 ; GISEL-NEXT:    v_cndmask_b32_e64 v1, 0, -1, s[4:5]
2093 ; GISEL-NEXT:    v_and_b32_e32 v1, 1, v1
2094 ; GISEL-NEXT:    v_cndmask_b32_e64 v0, 0, 1, s[4:5]
2095 ; GISEL-NEXT:    v_lshlrev_b32_e32 v2, 1, v1
2096 ; GISEL-NEXT:    v_or_b32_e32 v0, v0, v2
2097 ; GISEL-NEXT:    v_lshlrev_b32_e32 v3, 2, v1
2098 ; GISEL-NEXT:    v_lshlrev_b32_e32 v4, 3, v1
2099 ; GISEL-NEXT:    v_or_b32_e32 v2, v1, v2
2100 ; GISEL-NEXT:    v_or3_b32 v0, v0, v3, v4
2101 ; GISEL-NEXT:    v_lshlrev_b32_e32 v5, 4, v1
2102 ; GISEL-NEXT:    v_lshlrev_b32_e32 v6, 5, v1
2103 ; GISEL-NEXT:    v_or3_b32 v2, v2, v3, v4
2104 ; GISEL-NEXT:    v_or3_b32 v0, v0, v5, v6
2105 ; GISEL-NEXT:    v_lshlrev_b32_e32 v7, 6, v1
2106 ; GISEL-NEXT:    v_lshlrev_b32_e32 v8, 7, v1
2107 ; GISEL-NEXT:    v_or3_b32 v2, v2, v5, v6
2108 ; GISEL-NEXT:    v_or3_b32 v0, v0, v7, v8
2109 ; GISEL-NEXT:    v_lshlrev_b32_e32 v9, 8, v1
2110 ; GISEL-NEXT:    v_lshlrev_b32_e32 v10, 9, v1
2111 ; GISEL-NEXT:    v_or3_b32 v2, v2, v7, v8
2112 ; GISEL-NEXT:    v_or3_b32 v0, v0, v9, v10
2113 ; GISEL-NEXT:    v_lshlrev_b32_e32 v11, 10, v1
2114 ; GISEL-NEXT:    v_lshlrev_b32_e32 v12, 11, v1
2115 ; GISEL-NEXT:    v_or3_b32 v2, v2, v9, v10
2116 ; GISEL-NEXT:    v_or3_b32 v0, v0, v11, v12
2117 ; GISEL-NEXT:    v_lshlrev_b32_e32 v13, 12, v1
2118 ; GISEL-NEXT:    v_lshlrev_b32_e32 v14, 13, v1
2119 ; GISEL-NEXT:    v_or3_b32 v2, v2, v11, v12
2120 ; GISEL-NEXT:    v_or3_b32 v0, v0, v13, v14
2121 ; GISEL-NEXT:    v_lshlrev_b32_e32 v15, 14, v1
2122 ; GISEL-NEXT:    v_lshlrev_b32_e32 v16, 15, v1
2123 ; GISEL-NEXT:    v_or3_b32 v2, v2, v13, v14
2124 ; GISEL-NEXT:    v_or3_b32 v0, v0, v15, v16
2125 ; GISEL-NEXT:    v_lshlrev_b32_e32 v17, 16, v1
2126 ; GISEL-NEXT:    v_lshlrev_b32_e32 v18, 17, v1
2127 ; GISEL-NEXT:    v_or3_b32 v2, v2, v15, v16
2128 ; GISEL-NEXT:    v_or3_b32 v0, v0, v17, v18
2129 ; GISEL-NEXT:    v_lshlrev_b32_e32 v19, 18, v1
2130 ; GISEL-NEXT:    v_lshlrev_b32_e32 v3, 19, v1
2131 ; GISEL-NEXT:    v_or3_b32 v2, v2, v17, v18
2132 ; GISEL-NEXT:    v_or3_b32 v0, v0, v19, v3
2133 ; GISEL-NEXT:    v_lshlrev_b32_e32 v4, 20, v1
2134 ; GISEL-NEXT:    v_lshlrev_b32_e32 v5, 21, v1
2135 ; GISEL-NEXT:    v_or3_b32 v2, v2, v19, v3
2136 ; GISEL-NEXT:    v_or3_b32 v0, v0, v4, v5
2137 ; GISEL-NEXT:    v_lshlrev_b32_e32 v6, 22, v1
2138 ; GISEL-NEXT:    v_lshlrev_b32_e32 v7, 23, v1
2139 ; GISEL-NEXT:    v_or3_b32 v2, v2, v4, v5
2140 ; GISEL-NEXT:    v_or3_b32 v0, v0, v6, v7
2141 ; GISEL-NEXT:    v_lshlrev_b32_e32 v8, 24, v1
2142 ; GISEL-NEXT:    v_lshlrev_b32_e32 v9, 25, v1
2143 ; GISEL-NEXT:    v_or3_b32 v2, v2, v6, v7
2144 ; GISEL-NEXT:    v_or3_b32 v0, v0, v8, v9
2145 ; GISEL-NEXT:    v_lshlrev_b32_e32 v10, 26, v1
2146 ; GISEL-NEXT:    v_lshlrev_b32_e32 v11, 27, v1
2147 ; GISEL-NEXT:    v_or3_b32 v2, v2, v8, v9
2148 ; GISEL-NEXT:    v_or3_b32 v0, v0, v10, v11
2149 ; GISEL-NEXT:    v_lshlrev_b32_e32 v12, 28, v1
2150 ; GISEL-NEXT:    v_lshlrev_b32_e32 v13, 29, v1
2151 ; GISEL-NEXT:    v_or3_b32 v2, v2, v10, v11
2152 ; GISEL-NEXT:    v_or3_b32 v0, v0, v12, v13
2153 ; GISEL-NEXT:    v_lshlrev_b32_e32 v14, 30, v1
2154 ; GISEL-NEXT:    v_lshlrev_b32_e32 v1, 31, v1
2155 ; GISEL-NEXT:    v_or3_b32 v2, v2, v12, v13
2156 ; GISEL-NEXT:    v_or3_b32 v0, v0, v14, v1
2157 ; GISEL-NEXT:    v_or3_b32 v1, v2, v14, v1
2158 ; GISEL-NEXT:    v_add_u32_e32 v3, 0x80000000, v1
2159 ; GISEL-NEXT:    v_mov_b32_e32 v2, v1
2160 ; GISEL-NEXT:  .LBB7_9: ; %Flow3
2161 ; GISEL-NEXT:    s_or_b64 exec, exec, s[6:7]
2162 ; GISEL-NEXT:  .LBB7_10: ; %fp-to-i-cleanup
2163 ; GISEL-NEXT:    s_or_b64 exec, exec, s[12:13]
2164 ; GISEL-NEXT:    s_setpc_b64 s[30:31]
2165   %cvt = fptoui bfloat %x to i128
2166   ret i128 %cvt