1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -global-isel -amdgpu-codegenprepare-disable-idiv-expansion=1 -mtriple=amdgcn-amd-amdpal < %s | FileCheck -check-prefixes=CHECK,GISEL %s
3 ; RUN: llc -global-isel -amdgpu-codegenprepare-disable-idiv-expansion=0 -mtriple=amdgcn-amd-amdpal < %s | FileCheck -check-prefixes=CHECK,CGP %s
5 ; The same 32-bit expansion is implemented in the legalizer and in AMDGPUCodeGenPrepare.
7 define i32 @v_sdiv_i32(i32 %num, i32 %den) {
8 ; GISEL-LABEL: v_sdiv_i32:
10 ; GISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
11 ; GISEL-NEXT: v_ashrrev_i32_e32 v2, 31, v0
12 ; GISEL-NEXT: v_ashrrev_i32_e32 v3, 31, v1
13 ; GISEL-NEXT: v_add_i32_e32 v0, vcc, v0, v2
14 ; GISEL-NEXT: v_add_i32_e32 v1, vcc, v1, v3
15 ; GISEL-NEXT: v_xor_b32_e32 v0, v0, v2
16 ; GISEL-NEXT: v_xor_b32_e32 v1, v1, v3
17 ; GISEL-NEXT: v_cvt_f32_u32_e32 v4, v1
18 ; GISEL-NEXT: v_sub_i32_e32 v5, vcc, 0, v1
19 ; GISEL-NEXT: v_rcp_iflag_f32_e32 v4, v4
20 ; GISEL-NEXT: v_mul_f32_e32 v4, 0x4f7ffffe, v4
21 ; GISEL-NEXT: v_cvt_u32_f32_e32 v4, v4
22 ; GISEL-NEXT: v_mul_lo_u32 v5, v5, v4
23 ; GISEL-NEXT: v_mul_hi_u32 v5, v4, v5
24 ; GISEL-NEXT: v_add_i32_e32 v4, vcc, v4, v5
25 ; GISEL-NEXT: v_mul_hi_u32 v4, v0, v4
26 ; GISEL-NEXT: v_mul_lo_u32 v5, v4, v1
27 ; GISEL-NEXT: v_add_i32_e32 v6, vcc, 1, v4
28 ; GISEL-NEXT: v_sub_i32_e32 v0, vcc, v0, v5
29 ; GISEL-NEXT: v_cmp_ge_u32_e32 vcc, v0, v1
30 ; GISEL-NEXT: v_cndmask_b32_e32 v4, v4, v6, vcc
31 ; GISEL-NEXT: v_sub_i32_e64 v5, s[4:5], v0, v1
32 ; GISEL-NEXT: v_cndmask_b32_e32 v0, v0, v5, vcc
33 ; GISEL-NEXT: v_add_i32_e32 v5, vcc, 1, v4
34 ; GISEL-NEXT: v_cmp_ge_u32_e32 vcc, v0, v1
35 ; GISEL-NEXT: v_cndmask_b32_e32 v0, v4, v5, vcc
36 ; GISEL-NEXT: v_xor_b32_e32 v1, v2, v3
37 ; GISEL-NEXT: v_xor_b32_e32 v0, v0, v1
38 ; GISEL-NEXT: v_sub_i32_e32 v0, vcc, v0, v1
39 ; GISEL-NEXT: s_setpc_b64 s[30:31]
41 ; CGP-LABEL: v_sdiv_i32:
43 ; CGP-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
44 ; CGP-NEXT: v_ashrrev_i32_e32 v2, 31, v0
45 ; CGP-NEXT: v_ashrrev_i32_e32 v3, 31, v1
46 ; CGP-NEXT: v_xor_b32_e32 v4, v2, v3
47 ; CGP-NEXT: v_add_i32_e32 v0, vcc, v0, v2
48 ; CGP-NEXT: v_add_i32_e32 v1, vcc, v1, v3
49 ; CGP-NEXT: v_xor_b32_e32 v0, v0, v2
50 ; CGP-NEXT: v_xor_b32_e32 v1, v1, v3
51 ; CGP-NEXT: v_cvt_f32_u32_e32 v2, v1
52 ; CGP-NEXT: v_sub_i32_e32 v3, vcc, 0, v1
53 ; CGP-NEXT: v_rcp_f32_e32 v2, v2
54 ; CGP-NEXT: v_mul_f32_e32 v2, 0x4f7ffffe, v2
55 ; CGP-NEXT: v_cvt_u32_f32_e32 v2, v2
56 ; CGP-NEXT: v_mul_lo_u32 v3, v3, v2
57 ; CGP-NEXT: v_mul_hi_u32 v3, v2, v3
58 ; CGP-NEXT: v_add_i32_e32 v2, vcc, v2, v3
59 ; CGP-NEXT: v_mul_hi_u32 v2, v0, v2
60 ; CGP-NEXT: v_mul_lo_u32 v3, v2, v1
61 ; CGP-NEXT: v_add_i32_e32 v5, vcc, 1, v2
62 ; CGP-NEXT: v_sub_i32_e32 v0, vcc, v0, v3
63 ; CGP-NEXT: v_cmp_ge_u32_e32 vcc, v0, v1
64 ; CGP-NEXT: v_cndmask_b32_e32 v2, v2, v5, vcc
65 ; CGP-NEXT: v_sub_i32_e64 v3, s[4:5], v0, v1
66 ; CGP-NEXT: v_cndmask_b32_e32 v0, v0, v3, vcc
67 ; CGP-NEXT: v_add_i32_e32 v3, vcc, 1, v2
68 ; CGP-NEXT: v_cmp_ge_u32_e32 vcc, v0, v1
69 ; CGP-NEXT: v_cndmask_b32_e32 v0, v2, v3, vcc
70 ; CGP-NEXT: v_xor_b32_e32 v0, v0, v4
71 ; CGP-NEXT: v_sub_i32_e32 v0, vcc, v0, v4
72 ; CGP-NEXT: s_setpc_b64 s[30:31]
73 %result = sdiv i32 %num, %den
77 ; FIXME: This is a workaround for not handling uniform VGPR case.
78 declare i32 @llvm.amdgcn.readfirstlane(i32)
80 define amdgpu_ps i32 @s_sdiv_i32(i32 inreg %num, i32 inreg %den) {
81 ; GISEL-LABEL: s_sdiv_i32:
83 ; GISEL-NEXT: s_ashr_i32 s2, s0, 31
84 ; GISEL-NEXT: s_ashr_i32 s3, s1, 31
85 ; GISEL-NEXT: s_add_i32 s0, s0, s2
86 ; GISEL-NEXT: s_add_i32 s1, s1, s3
87 ; GISEL-NEXT: s_xor_b32 s0, s0, s2
88 ; GISEL-NEXT: s_xor_b32 s4, s1, s3
89 ; GISEL-NEXT: v_cvt_f32_u32_e32 v0, s4
90 ; GISEL-NEXT: s_sub_i32 s1, 0, s4
91 ; GISEL-NEXT: v_rcp_iflag_f32_e32 v0, v0
92 ; GISEL-NEXT: v_mul_f32_e32 v0, 0x4f7ffffe, v0
93 ; GISEL-NEXT: v_cvt_u32_f32_e32 v0, v0
94 ; GISEL-NEXT: v_mul_lo_u32 v1, s1, v0
95 ; GISEL-NEXT: v_mul_hi_u32 v1, v0, v1
96 ; GISEL-NEXT: v_add_i32_e32 v0, vcc, v0, v1
97 ; GISEL-NEXT: v_mul_hi_u32 v0, s0, v0
98 ; GISEL-NEXT: v_mul_lo_u32 v1, v0, s4
99 ; GISEL-NEXT: v_add_i32_e32 v2, vcc, 1, v0
100 ; GISEL-NEXT: v_sub_i32_e32 v1, vcc, s0, v1
101 ; GISEL-NEXT: v_cmp_le_u32_e32 vcc, s4, v1
102 ; GISEL-NEXT: v_cndmask_b32_e32 v0, v0, v2, vcc
103 ; GISEL-NEXT: v_subrev_i32_e64 v2, s[0:1], s4, v1
104 ; GISEL-NEXT: v_cndmask_b32_e32 v1, v1, v2, vcc
105 ; GISEL-NEXT: v_add_i32_e32 v2, vcc, 1, v0
106 ; GISEL-NEXT: v_cmp_le_u32_e32 vcc, s4, v1
107 ; GISEL-NEXT: v_cndmask_b32_e32 v0, v0, v2, vcc
108 ; GISEL-NEXT: s_xor_b32 s0, s2, s3
109 ; GISEL-NEXT: v_xor_b32_e32 v0, s0, v0
110 ; GISEL-NEXT: v_subrev_i32_e32 v0, vcc, s0, v0
111 ; GISEL-NEXT: v_readfirstlane_b32 s0, v0
112 ; GISEL-NEXT: ; return to shader part epilog
114 ; CGP-LABEL: s_sdiv_i32:
116 ; CGP-NEXT: s_ashr_i32 s2, s0, 31
117 ; CGP-NEXT: s_ashr_i32 s3, s1, 31
118 ; CGP-NEXT: s_xor_b32 s4, s2, s3
119 ; CGP-NEXT: s_add_i32 s0, s0, s2
120 ; CGP-NEXT: s_add_i32 s1, s1, s3
121 ; CGP-NEXT: s_xor_b32 s0, s0, s2
122 ; CGP-NEXT: s_xor_b32 s2, s1, s3
123 ; CGP-NEXT: v_cvt_f32_u32_e32 v0, s2
124 ; CGP-NEXT: s_sub_i32 s1, 0, s2
125 ; CGP-NEXT: v_rcp_f32_e32 v0, v0
126 ; CGP-NEXT: v_mul_f32_e32 v0, 0x4f7ffffe, v0
127 ; CGP-NEXT: v_cvt_u32_f32_e32 v0, v0
128 ; CGP-NEXT: v_mul_lo_u32 v1, s1, v0
129 ; CGP-NEXT: v_mul_hi_u32 v1, v0, v1
130 ; CGP-NEXT: v_add_i32_e32 v0, vcc, v0, v1
131 ; CGP-NEXT: v_mul_hi_u32 v0, s0, v0
132 ; CGP-NEXT: v_mul_lo_u32 v1, v0, s2
133 ; CGP-NEXT: v_add_i32_e32 v2, vcc, 1, v0
134 ; CGP-NEXT: v_sub_i32_e32 v1, vcc, s0, v1
135 ; CGP-NEXT: v_cmp_le_u32_e32 vcc, s2, v1
136 ; CGP-NEXT: v_cndmask_b32_e32 v0, v0, v2, vcc
137 ; CGP-NEXT: v_subrev_i32_e64 v2, s[0:1], s2, v1
138 ; CGP-NEXT: v_cndmask_b32_e32 v1, v1, v2, vcc
139 ; CGP-NEXT: v_add_i32_e32 v2, vcc, 1, v0
140 ; CGP-NEXT: v_cmp_le_u32_e32 vcc, s2, v1
141 ; CGP-NEXT: v_cndmask_b32_e32 v0, v0, v2, vcc
142 ; CGP-NEXT: v_xor_b32_e32 v0, s4, v0
143 ; CGP-NEXT: v_subrev_i32_e32 v0, vcc, s4, v0
144 ; CGP-NEXT: v_readfirstlane_b32 s0, v0
145 ; CGP-NEXT: ; return to shader part epilog
146 %result = sdiv i32 %num, %den
147 %readlane = call i32 @llvm.amdgcn.readfirstlane(i32 %result)
151 define <2 x i32> @v_sdiv_v2i32(<2 x i32> %num, <2 x i32> %den) {
152 ; GISEL-LABEL: v_sdiv_v2i32:
154 ; GISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
155 ; GISEL-NEXT: v_ashrrev_i32_e32 v4, 31, v0
156 ; GISEL-NEXT: v_ashrrev_i32_e32 v5, 31, v2
157 ; GISEL-NEXT: v_ashrrev_i32_e32 v6, 31, v1
158 ; GISEL-NEXT: v_ashrrev_i32_e32 v7, 31, v3
159 ; GISEL-NEXT: v_add_i32_e32 v0, vcc, v0, v4
160 ; GISEL-NEXT: v_add_i32_e32 v2, vcc, v2, v5
161 ; GISEL-NEXT: v_xor_b32_e32 v8, v4, v5
162 ; GISEL-NEXT: v_add_i32_e32 v1, vcc, v1, v6
163 ; GISEL-NEXT: v_add_i32_e32 v3, vcc, v3, v7
164 ; GISEL-NEXT: v_xor_b32_e32 v9, v6, v7
165 ; GISEL-NEXT: v_xor_b32_e32 v0, v0, v4
166 ; GISEL-NEXT: v_xor_b32_e32 v2, v2, v5
167 ; GISEL-NEXT: v_xor_b32_e32 v1, v1, v6
168 ; GISEL-NEXT: v_xor_b32_e32 v3, v3, v7
169 ; GISEL-NEXT: v_cvt_f32_u32_e32 v4, v2
170 ; GISEL-NEXT: v_sub_i32_e32 v5, vcc, 0, v2
171 ; GISEL-NEXT: v_cvt_f32_u32_e32 v6, v3
172 ; GISEL-NEXT: v_sub_i32_e32 v7, vcc, 0, v3
173 ; GISEL-NEXT: v_rcp_iflag_f32_e32 v4, v4
174 ; GISEL-NEXT: v_rcp_iflag_f32_e32 v6, v6
175 ; GISEL-NEXT: v_mul_f32_e32 v4, 0x4f7ffffe, v4
176 ; GISEL-NEXT: v_mul_f32_e32 v6, 0x4f7ffffe, v6
177 ; GISEL-NEXT: v_cvt_u32_f32_e32 v4, v4
178 ; GISEL-NEXT: v_cvt_u32_f32_e32 v6, v6
179 ; GISEL-NEXT: v_mul_lo_u32 v5, v5, v4
180 ; GISEL-NEXT: v_mul_lo_u32 v7, v7, v6
181 ; GISEL-NEXT: v_mul_hi_u32 v5, v4, v5
182 ; GISEL-NEXT: v_mul_hi_u32 v7, v6, v7
183 ; GISEL-NEXT: v_add_i32_e32 v4, vcc, v4, v5
184 ; GISEL-NEXT: v_add_i32_e32 v5, vcc, v6, v7
185 ; GISEL-NEXT: v_mul_hi_u32 v4, v0, v4
186 ; GISEL-NEXT: v_mul_hi_u32 v5, v1, v5
187 ; GISEL-NEXT: v_mul_lo_u32 v6, v4, v2
188 ; GISEL-NEXT: v_add_i32_e32 v7, vcc, 1, v4
189 ; GISEL-NEXT: v_mul_lo_u32 v10, v5, v3
190 ; GISEL-NEXT: v_add_i32_e32 v11, vcc, 1, v5
191 ; GISEL-NEXT: v_sub_i32_e32 v0, vcc, v0, v6
192 ; GISEL-NEXT: v_sub_i32_e32 v1, vcc, v1, v10
193 ; GISEL-NEXT: v_cmp_ge_u32_e32 vcc, v0, v2
194 ; GISEL-NEXT: v_cndmask_b32_e32 v4, v4, v7, vcc
195 ; GISEL-NEXT: v_sub_i32_e64 v6, s[4:5], v0, v2
196 ; GISEL-NEXT: v_cmp_ge_u32_e64 s[4:5], v1, v3
197 ; GISEL-NEXT: v_cndmask_b32_e64 v5, v5, v11, s[4:5]
198 ; GISEL-NEXT: v_sub_i32_e64 v7, s[6:7], v1, v3
199 ; GISEL-NEXT: v_cndmask_b32_e32 v0, v0, v6, vcc
200 ; GISEL-NEXT: v_add_i32_e32 v6, vcc, 1, v4
201 ; GISEL-NEXT: v_cndmask_b32_e64 v1, v1, v7, s[4:5]
202 ; GISEL-NEXT: v_add_i32_e32 v7, vcc, 1, v5
203 ; GISEL-NEXT: v_cmp_ge_u32_e32 vcc, v0, v2
204 ; GISEL-NEXT: v_cndmask_b32_e32 v0, v4, v6, vcc
205 ; GISEL-NEXT: v_cmp_ge_u32_e32 vcc, v1, v3
206 ; GISEL-NEXT: v_cndmask_b32_e32 v1, v5, v7, vcc
207 ; GISEL-NEXT: v_xor_b32_e32 v0, v0, v8
208 ; GISEL-NEXT: v_xor_b32_e32 v1, v1, v9
209 ; GISEL-NEXT: v_sub_i32_e32 v0, vcc, v0, v8
210 ; GISEL-NEXT: v_sub_i32_e32 v1, vcc, v1, v9
211 ; GISEL-NEXT: s_setpc_b64 s[30:31]
213 ; CGP-LABEL: v_sdiv_v2i32:
215 ; CGP-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
216 ; CGP-NEXT: v_ashrrev_i32_e32 v4, 31, v0
217 ; CGP-NEXT: v_ashrrev_i32_e32 v5, 31, v2
218 ; CGP-NEXT: v_ashrrev_i32_e32 v6, 31, v1
219 ; CGP-NEXT: v_ashrrev_i32_e32 v7, 31, v3
220 ; CGP-NEXT: v_xor_b32_e32 v8, v4, v5
221 ; CGP-NEXT: v_add_i32_e32 v0, vcc, v0, v4
222 ; CGP-NEXT: v_add_i32_e32 v2, vcc, v2, v5
223 ; CGP-NEXT: v_xor_b32_e32 v9, v6, v7
224 ; CGP-NEXT: v_add_i32_e32 v1, vcc, v1, v6
225 ; CGP-NEXT: v_add_i32_e32 v3, vcc, v3, v7
226 ; CGP-NEXT: v_xor_b32_e32 v0, v0, v4
227 ; CGP-NEXT: v_xor_b32_e32 v2, v2, v5
228 ; CGP-NEXT: v_xor_b32_e32 v1, v1, v6
229 ; CGP-NEXT: v_xor_b32_e32 v3, v3, v7
230 ; CGP-NEXT: v_cvt_f32_u32_e32 v4, v2
231 ; CGP-NEXT: v_sub_i32_e32 v5, vcc, 0, v2
232 ; CGP-NEXT: v_cvt_f32_u32_e32 v6, v3
233 ; CGP-NEXT: v_sub_i32_e32 v7, vcc, 0, v3
234 ; CGP-NEXT: v_rcp_f32_e32 v4, v4
235 ; CGP-NEXT: v_rcp_f32_e32 v6, v6
236 ; CGP-NEXT: v_mul_f32_e32 v4, 0x4f7ffffe, v4
237 ; CGP-NEXT: v_mul_f32_e32 v6, 0x4f7ffffe, v6
238 ; CGP-NEXT: v_cvt_u32_f32_e32 v4, v4
239 ; CGP-NEXT: v_cvt_u32_f32_e32 v6, v6
240 ; CGP-NEXT: v_mul_lo_u32 v5, v5, v4
241 ; CGP-NEXT: v_mul_lo_u32 v7, v7, v6
242 ; CGP-NEXT: v_mul_hi_u32 v5, v4, v5
243 ; CGP-NEXT: v_mul_hi_u32 v7, v6, v7
244 ; CGP-NEXT: v_add_i32_e32 v4, vcc, v4, v5
245 ; CGP-NEXT: v_add_i32_e32 v5, vcc, v6, v7
246 ; CGP-NEXT: v_mul_hi_u32 v4, v0, v4
247 ; CGP-NEXT: v_mul_hi_u32 v5, v1, v5
248 ; CGP-NEXT: v_mul_lo_u32 v6, v4, v2
249 ; CGP-NEXT: v_add_i32_e32 v7, vcc, 1, v4
250 ; CGP-NEXT: v_mul_lo_u32 v10, v5, v3
251 ; CGP-NEXT: v_add_i32_e32 v11, vcc, 1, v5
252 ; CGP-NEXT: v_sub_i32_e32 v0, vcc, v0, v6
253 ; CGP-NEXT: v_sub_i32_e32 v1, vcc, v1, v10
254 ; CGP-NEXT: v_cmp_ge_u32_e32 vcc, v0, v2
255 ; CGP-NEXT: v_cndmask_b32_e32 v4, v4, v7, vcc
256 ; CGP-NEXT: v_sub_i32_e64 v6, s[4:5], v0, v2
257 ; CGP-NEXT: v_cmp_ge_u32_e64 s[4:5], v1, v3
258 ; CGP-NEXT: v_cndmask_b32_e64 v5, v5, v11, s[4:5]
259 ; CGP-NEXT: v_sub_i32_e64 v7, s[6:7], v1, v3
260 ; CGP-NEXT: v_cndmask_b32_e32 v0, v0, v6, vcc
261 ; CGP-NEXT: v_add_i32_e32 v6, vcc, 1, v4
262 ; CGP-NEXT: v_cndmask_b32_e64 v1, v1, v7, s[4:5]
263 ; CGP-NEXT: v_add_i32_e32 v7, vcc, 1, v5
264 ; CGP-NEXT: v_cmp_ge_u32_e32 vcc, v0, v2
265 ; CGP-NEXT: v_cndmask_b32_e32 v0, v4, v6, vcc
266 ; CGP-NEXT: v_cmp_ge_u32_e32 vcc, v1, v3
267 ; CGP-NEXT: v_cndmask_b32_e32 v1, v5, v7, vcc
268 ; CGP-NEXT: v_xor_b32_e32 v0, v0, v8
269 ; CGP-NEXT: v_xor_b32_e32 v1, v1, v9
270 ; CGP-NEXT: v_sub_i32_e32 v0, vcc, v0, v8
271 ; CGP-NEXT: v_sub_i32_e32 v1, vcc, v1, v9
272 ; CGP-NEXT: s_setpc_b64 s[30:31]
273 %result = sdiv <2 x i32> %num, %den
274 ret <2 x i32> %result
277 define i32 @v_sdiv_i32_pow2k_denom(i32 %num) {
278 ; CHECK-LABEL: v_sdiv_i32_pow2k_denom:
280 ; CHECK-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
281 ; CHECK-NEXT: s_movk_i32 s6, 0x1000
282 ; CHECK-NEXT: v_ashrrev_i32_e32 v1, 31, v0
283 ; CHECK-NEXT: v_rcp_iflag_f32_e32 v2, 0x45800000
284 ; CHECK-NEXT: v_mov_b32_e32 v3, 0xfffff000
285 ; CHECK-NEXT: v_add_i32_e32 v0, vcc, v0, v1
286 ; CHECK-NEXT: v_mul_f32_e32 v2, 0x4f7ffffe, v2
287 ; CHECK-NEXT: v_xor_b32_e32 v0, v0, v1
288 ; CHECK-NEXT: v_cvt_u32_f32_e32 v2, v2
289 ; CHECK-NEXT: v_mul_lo_u32 v3, v2, v3
290 ; CHECK-NEXT: v_mul_hi_u32 v3, v2, v3
291 ; CHECK-NEXT: v_add_i32_e32 v2, vcc, v2, v3
292 ; CHECK-NEXT: v_mul_hi_u32 v2, v0, v2
293 ; CHECK-NEXT: v_lshlrev_b32_e32 v3, 12, v2
294 ; CHECK-NEXT: v_add_i32_e32 v4, vcc, 1, v2
295 ; CHECK-NEXT: v_sub_i32_e32 v0, vcc, v0, v3
296 ; CHECK-NEXT: v_cmp_le_u32_e64 s[4:5], s6, v0
297 ; CHECK-NEXT: v_cndmask_b32_e64 v2, v2, v4, s[4:5]
298 ; CHECK-NEXT: v_subrev_i32_e32 v3, vcc, s6, v0
299 ; CHECK-NEXT: v_cndmask_b32_e64 v0, v0, v3, s[4:5]
300 ; CHECK-NEXT: v_add_i32_e32 v3, vcc, 1, v2
301 ; CHECK-NEXT: v_cmp_le_u32_e32 vcc, s6, v0
302 ; CHECK-NEXT: v_cndmask_b32_e32 v0, v2, v3, vcc
303 ; CHECK-NEXT: v_xor_b32_e32 v0, v0, v1
304 ; CHECK-NEXT: v_sub_i32_e32 v0, vcc, v0, v1
305 ; CHECK-NEXT: s_setpc_b64 s[30:31]
306 %result = sdiv i32 %num, 4096
310 define <2 x i32> @v_sdiv_v2i32_pow2k_denom(<2 x i32> %num) {
311 ; GISEL-LABEL: v_sdiv_v2i32_pow2k_denom:
313 ; GISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
314 ; GISEL-NEXT: v_ashrrev_i32_e32 v2, 31, v0
315 ; GISEL-NEXT: s_movk_i32 s8, 0x1000
316 ; GISEL-NEXT: v_mov_b32_e32 v3, 0x1000
317 ; GISEL-NEXT: v_cvt_f32_u32_e32 v4, 0x1000
318 ; GISEL-NEXT: v_mov_b32_e32 v5, 0xfffff000
319 ; GISEL-NEXT: v_ashrrev_i32_e32 v6, 31, v1
320 ; GISEL-NEXT: v_add_i32_e32 v0, vcc, v0, v2
321 ; GISEL-NEXT: v_rcp_iflag_f32_e32 v4, v4
322 ; GISEL-NEXT: v_add_i32_e32 v1, vcc, v1, v6
323 ; GISEL-NEXT: v_xor_b32_e32 v0, v0, v2
324 ; GISEL-NEXT: v_mul_f32_e32 v7, 0x4f7ffffe, v4
325 ; GISEL-NEXT: v_xor_b32_e32 v1, v1, v6
326 ; GISEL-NEXT: v_mul_f32_e32 v4, 0x4f7ffffe, v4
327 ; GISEL-NEXT: v_cvt_u32_f32_e32 v7, v7
328 ; GISEL-NEXT: v_cvt_u32_f32_e32 v4, v4
329 ; GISEL-NEXT: v_mul_lo_u32 v8, v7, v5
330 ; GISEL-NEXT: v_mul_lo_u32 v5, v4, v5
331 ; GISEL-NEXT: v_mul_hi_u32 v8, v7, v8
332 ; GISEL-NEXT: v_mul_hi_u32 v5, v4, v5
333 ; GISEL-NEXT: v_add_i32_e32 v7, vcc, v7, v8
334 ; GISEL-NEXT: v_add_i32_e32 v4, vcc, v4, v5
335 ; GISEL-NEXT: v_mul_hi_u32 v5, v0, v7
336 ; GISEL-NEXT: v_mul_hi_u32 v4, v1, v4
337 ; GISEL-NEXT: v_lshlrev_b32_e32 v7, 12, v5
338 ; GISEL-NEXT: v_add_i32_e32 v8, vcc, 1, v5
339 ; GISEL-NEXT: v_lshlrev_b32_e32 v9, 12, v4
340 ; GISEL-NEXT: v_add_i32_e32 v10, vcc, 1, v4
341 ; GISEL-NEXT: v_sub_i32_e32 v0, vcc, v0, v7
342 ; GISEL-NEXT: v_sub_i32_e32 v1, vcc, v1, v9
343 ; GISEL-NEXT: v_cmp_le_u32_e64 s[4:5], s8, v0
344 ; GISEL-NEXT: v_cndmask_b32_e64 v5, v5, v8, s[4:5]
345 ; GISEL-NEXT: v_subrev_i32_e32 v7, vcc, s8, v0
346 ; GISEL-NEXT: v_cmp_le_u32_e64 s[6:7], s8, v1
347 ; GISEL-NEXT: v_cndmask_b32_e64 v4, v4, v10, s[6:7]
348 ; GISEL-NEXT: v_subrev_i32_e32 v8, vcc, s8, v1
349 ; GISEL-NEXT: v_cndmask_b32_e64 v0, v0, v7, s[4:5]
350 ; GISEL-NEXT: v_add_i32_e32 v7, vcc, 1, v5
351 ; GISEL-NEXT: v_cndmask_b32_e64 v1, v1, v8, s[6:7]
352 ; GISEL-NEXT: v_add_i32_e32 v8, vcc, 1, v4
353 ; GISEL-NEXT: v_cmp_ge_u32_e32 vcc, v0, v3
354 ; GISEL-NEXT: v_cndmask_b32_e32 v0, v5, v7, vcc
355 ; GISEL-NEXT: v_cmp_le_u32_e32 vcc, s8, v1
356 ; GISEL-NEXT: v_cndmask_b32_e32 v1, v4, v8, vcc
357 ; GISEL-NEXT: v_xor_b32_e32 v0, v0, v2
358 ; GISEL-NEXT: v_xor_b32_e32 v1, v1, v6
359 ; GISEL-NEXT: v_sub_i32_e32 v0, vcc, v0, v2
360 ; GISEL-NEXT: v_sub_i32_e32 v1, vcc, v1, v6
361 ; GISEL-NEXT: s_setpc_b64 s[30:31]
363 ; CGP-LABEL: v_sdiv_v2i32_pow2k_denom:
365 ; CGP-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
366 ; CGP-NEXT: s_movk_i32 s8, 0x1000
367 ; CGP-NEXT: v_ashrrev_i32_e32 v2, 31, v0
368 ; CGP-NEXT: v_rcp_iflag_f32_e32 v3, 0x45800000
369 ; CGP-NEXT: s_movk_i32 s4, 0xf000
370 ; CGP-NEXT: v_mov_b32_e32 v4, 0xfffff000
371 ; CGP-NEXT: v_mov_b32_e32 v5, 0x1000
372 ; CGP-NEXT: v_ashrrev_i32_e32 v6, 31, v1
373 ; CGP-NEXT: v_rcp_iflag_f32_e32 v7, 0x45800000
374 ; CGP-NEXT: v_add_i32_e32 v0, vcc, v0, v2
375 ; CGP-NEXT: v_mul_f32_e32 v3, 0x4f7ffffe, v3
376 ; CGP-NEXT: v_add_i32_e32 v1, vcc, v1, v6
377 ; CGP-NEXT: v_mul_f32_e32 v7, 0x4f7ffffe, v7
378 ; CGP-NEXT: v_xor_b32_e32 v0, v0, v2
379 ; CGP-NEXT: v_cvt_u32_f32_e32 v3, v3
380 ; CGP-NEXT: v_xor_b32_e32 v1, v1, v6
381 ; CGP-NEXT: v_cvt_u32_f32_e32 v7, v7
382 ; CGP-NEXT: v_mul_lo_u32 v8, v3, s4
383 ; CGP-NEXT: v_mul_lo_u32 v4, v7, v4
384 ; CGP-NEXT: v_mul_hi_u32 v8, v3, v8
385 ; CGP-NEXT: v_mul_hi_u32 v4, v7, v4
386 ; CGP-NEXT: v_add_i32_e32 v3, vcc, v3, v8
387 ; CGP-NEXT: v_add_i32_e32 v4, vcc, v7, v4
388 ; CGP-NEXT: v_mul_hi_u32 v3, v0, v3
389 ; CGP-NEXT: v_mul_hi_u32 v4, v1, v4
390 ; CGP-NEXT: v_lshlrev_b32_e32 v7, 12, v3
391 ; CGP-NEXT: v_add_i32_e32 v8, vcc, 1, v3
392 ; CGP-NEXT: v_lshlrev_b32_e32 v9, 12, v4
393 ; CGP-NEXT: v_add_i32_e32 v10, vcc, 1, v4
394 ; CGP-NEXT: v_sub_i32_e32 v0, vcc, v0, v7
395 ; CGP-NEXT: v_sub_i32_e32 v1, vcc, v1, v9
396 ; CGP-NEXT: v_cmp_le_u32_e64 s[4:5], s8, v0
397 ; CGP-NEXT: v_cndmask_b32_e64 v3, v3, v8, s[4:5]
398 ; CGP-NEXT: v_subrev_i32_e32 v7, vcc, s8, v0
399 ; CGP-NEXT: v_cmp_ge_u32_e64 s[6:7], v1, v5
400 ; CGP-NEXT: v_cndmask_b32_e64 v4, v4, v10, s[6:7]
401 ; CGP-NEXT: v_subrev_i32_e32 v8, vcc, 0x1000, v1
402 ; CGP-NEXT: v_cndmask_b32_e64 v0, v0, v7, s[4:5]
403 ; CGP-NEXT: v_add_i32_e32 v7, vcc, 1, v3
404 ; CGP-NEXT: v_cndmask_b32_e64 v1, v1, v8, s[6:7]
405 ; CGP-NEXT: v_add_i32_e32 v8, vcc, 1, v4
406 ; CGP-NEXT: v_cmp_le_u32_e32 vcc, s8, v0
407 ; CGP-NEXT: v_cndmask_b32_e32 v0, v3, v7, vcc
408 ; CGP-NEXT: v_cmp_ge_u32_e32 vcc, v1, v5
409 ; CGP-NEXT: v_cndmask_b32_e32 v1, v4, v8, vcc
410 ; CGP-NEXT: v_xor_b32_e32 v0, v0, v2
411 ; CGP-NEXT: v_xor_b32_e32 v1, v1, v6
412 ; CGP-NEXT: v_sub_i32_e32 v0, vcc, v0, v2
413 ; CGP-NEXT: v_sub_i32_e32 v1, vcc, v1, v6
414 ; CGP-NEXT: s_setpc_b64 s[30:31]
415 %result = sdiv <2 x i32> %num, <i32 4096, i32 4096>
416 ret <2 x i32> %result
419 define i32 @v_sdiv_i32_oddk_denom(i32 %num) {
420 ; CHECK-LABEL: v_sdiv_i32_oddk_denom:
422 ; CHECK-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
423 ; CHECK-NEXT: s_mov_b32 s6, 0x12d8fb
424 ; CHECK-NEXT: v_ashrrev_i32_e32 v1, 31, v0
425 ; CHECK-NEXT: v_rcp_iflag_f32_e32 v2, 0x4996c7d8
426 ; CHECK-NEXT: v_mov_b32_e32 v3, 0xffed2705
427 ; CHECK-NEXT: v_add_i32_e32 v0, vcc, v0, v1
428 ; CHECK-NEXT: v_mul_f32_e32 v2, 0x4f7ffffe, v2
429 ; CHECK-NEXT: v_xor_b32_e32 v0, v0, v1
430 ; CHECK-NEXT: v_cvt_u32_f32_e32 v2, v2
431 ; CHECK-NEXT: v_mul_lo_u32 v3, v2, v3
432 ; CHECK-NEXT: v_mul_hi_u32 v3, v2, v3
433 ; CHECK-NEXT: v_add_i32_e32 v2, vcc, v2, v3
434 ; CHECK-NEXT: v_mul_hi_u32 v2, v0, v2
435 ; CHECK-NEXT: v_mul_lo_u32 v3, v2, s6
436 ; CHECK-NEXT: v_add_i32_e32 v4, vcc, 1, v2
437 ; CHECK-NEXT: v_sub_i32_e32 v0, vcc, v0, v3
438 ; CHECK-NEXT: v_cmp_le_u32_e64 s[4:5], s6, v0
439 ; CHECK-NEXT: v_cndmask_b32_e64 v2, v2, v4, s[4:5]
440 ; CHECK-NEXT: v_subrev_i32_e32 v3, vcc, s6, v0
441 ; CHECK-NEXT: v_cndmask_b32_e64 v0, v0, v3, s[4:5]
442 ; CHECK-NEXT: v_add_i32_e32 v3, vcc, 1, v2
443 ; CHECK-NEXT: v_cmp_le_u32_e32 vcc, s6, v0
444 ; CHECK-NEXT: v_cndmask_b32_e32 v0, v2, v3, vcc
445 ; CHECK-NEXT: v_xor_b32_e32 v0, v0, v1
446 ; CHECK-NEXT: v_sub_i32_e32 v0, vcc, v0, v1
447 ; CHECK-NEXT: s_setpc_b64 s[30:31]
448 %result = sdiv i32 %num, 1235195
452 define <2 x i32> @v_sdiv_v2i32_oddk_denom(<2 x i32> %num) {
453 ; GISEL-LABEL: v_sdiv_v2i32_oddk_denom:
455 ; GISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
456 ; GISEL-NEXT: v_ashrrev_i32_e32 v2, 31, v0
457 ; GISEL-NEXT: s_mov_b32 s8, 0x12d8fb
458 ; GISEL-NEXT: v_cvt_f32_u32_e32 v3, 0x12d8fb
459 ; GISEL-NEXT: v_mov_b32_e32 v4, 0xffed2705
460 ; GISEL-NEXT: v_ashrrev_i32_e32 v5, 31, v1
461 ; GISEL-NEXT: v_add_i32_e32 v0, vcc, v0, v2
462 ; GISEL-NEXT: v_rcp_iflag_f32_e32 v3, v3
463 ; GISEL-NEXT: v_add_i32_e32 v1, vcc, v1, v5
464 ; GISEL-NEXT: v_xor_b32_e32 v0, v0, v2
465 ; GISEL-NEXT: v_mul_f32_e32 v6, 0x4f7ffffe, v3
466 ; GISEL-NEXT: v_xor_b32_e32 v1, v1, v5
467 ; GISEL-NEXT: v_mul_f32_e32 v3, 0x4f7ffffe, v3
468 ; GISEL-NEXT: v_cvt_u32_f32_e32 v6, v6
469 ; GISEL-NEXT: v_cvt_u32_f32_e32 v3, v3
470 ; GISEL-NEXT: v_mul_lo_u32 v7, v6, v4
471 ; GISEL-NEXT: v_mul_lo_u32 v4, v3, v4
472 ; GISEL-NEXT: v_mul_hi_u32 v7, v6, v7
473 ; GISEL-NEXT: v_mul_hi_u32 v4, v3, v4
474 ; GISEL-NEXT: v_add_i32_e32 v6, vcc, v6, v7
475 ; GISEL-NEXT: v_add_i32_e32 v3, vcc, v3, v4
476 ; GISEL-NEXT: v_mul_hi_u32 v4, v0, v6
477 ; GISEL-NEXT: v_mul_hi_u32 v3, v1, v3
478 ; GISEL-NEXT: v_mul_lo_u32 v6, v4, s8
479 ; GISEL-NEXT: v_add_i32_e32 v7, vcc, 1, v4
480 ; GISEL-NEXT: v_mul_lo_u32 v8, v3, s8
481 ; GISEL-NEXT: v_add_i32_e32 v9, vcc, 1, v3
482 ; GISEL-NEXT: v_sub_i32_e32 v0, vcc, v0, v6
483 ; GISEL-NEXT: v_sub_i32_e32 v1, vcc, v1, v8
484 ; GISEL-NEXT: v_cmp_le_u32_e64 s[4:5], s8, v0
485 ; GISEL-NEXT: v_cndmask_b32_e64 v4, v4, v7, s[4:5]
486 ; GISEL-NEXT: v_subrev_i32_e32 v6, vcc, s8, v0
487 ; GISEL-NEXT: v_cmp_le_u32_e64 s[6:7], s8, v1
488 ; GISEL-NEXT: v_cndmask_b32_e64 v3, v3, v9, s[6:7]
489 ; GISEL-NEXT: v_subrev_i32_e32 v7, vcc, s8, v1
490 ; GISEL-NEXT: v_cndmask_b32_e64 v0, v0, v6, s[4:5]
491 ; GISEL-NEXT: v_add_i32_e32 v6, vcc, 1, v4
492 ; GISEL-NEXT: v_cndmask_b32_e64 v1, v1, v7, s[6:7]
493 ; GISEL-NEXT: v_add_i32_e32 v7, vcc, 1, v3
494 ; GISEL-NEXT: v_cmp_le_u32_e32 vcc, s8, v0
495 ; GISEL-NEXT: v_cndmask_b32_e32 v0, v4, v6, vcc
496 ; GISEL-NEXT: v_cmp_le_u32_e32 vcc, s8, v1
497 ; GISEL-NEXT: v_cndmask_b32_e32 v1, v3, v7, vcc
498 ; GISEL-NEXT: v_xor_b32_e32 v0, v0, v2
499 ; GISEL-NEXT: v_xor_b32_e32 v1, v1, v5
500 ; GISEL-NEXT: v_sub_i32_e32 v0, vcc, v0, v2
501 ; GISEL-NEXT: v_sub_i32_e32 v1, vcc, v1, v5
502 ; GISEL-NEXT: s_setpc_b64 s[30:31]
504 ; CGP-LABEL: v_sdiv_v2i32_oddk_denom:
506 ; CGP-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
507 ; CGP-NEXT: s_mov_b32 s8, 0x12d8fb
508 ; CGP-NEXT: v_ashrrev_i32_e32 v2, 31, v0
509 ; CGP-NEXT: v_rcp_iflag_f32_e32 v3, 0x4996c7d8
510 ; CGP-NEXT: s_mov_b32 s4, 0xffed2705
511 ; CGP-NEXT: v_mov_b32_e32 v4, 0xffed2705
512 ; CGP-NEXT: v_mov_b32_e32 v5, 0x12d8fb
513 ; CGP-NEXT: v_ashrrev_i32_e32 v6, 31, v1
514 ; CGP-NEXT: v_rcp_iflag_f32_e32 v7, 0x4996c7d8
515 ; CGP-NEXT: v_add_i32_e32 v0, vcc, v0, v2
516 ; CGP-NEXT: v_mul_f32_e32 v3, 0x4f7ffffe, v3
517 ; CGP-NEXT: v_add_i32_e32 v1, vcc, v1, v6
518 ; CGP-NEXT: v_mul_f32_e32 v7, 0x4f7ffffe, v7
519 ; CGP-NEXT: v_xor_b32_e32 v0, v0, v2
520 ; CGP-NEXT: v_cvt_u32_f32_e32 v3, v3
521 ; CGP-NEXT: v_xor_b32_e32 v1, v1, v6
522 ; CGP-NEXT: v_cvt_u32_f32_e32 v7, v7
523 ; CGP-NEXT: v_mul_lo_u32 v8, v3, s4
524 ; CGP-NEXT: v_mul_lo_u32 v4, v7, v4
525 ; CGP-NEXT: v_mul_hi_u32 v8, v3, v8
526 ; CGP-NEXT: v_mul_hi_u32 v4, v7, v4
527 ; CGP-NEXT: v_add_i32_e32 v3, vcc, v3, v8
528 ; CGP-NEXT: v_add_i32_e32 v4, vcc, v7, v4
529 ; CGP-NEXT: v_mul_hi_u32 v3, v0, v3
530 ; CGP-NEXT: v_mul_hi_u32 v4, v1, v4
531 ; CGP-NEXT: v_mul_lo_u32 v7, v3, s8
532 ; CGP-NEXT: v_add_i32_e32 v8, vcc, 1, v3
533 ; CGP-NEXT: v_mul_lo_u32 v9, v4, v5
534 ; CGP-NEXT: v_add_i32_e32 v10, vcc, 1, v4
535 ; CGP-NEXT: v_sub_i32_e32 v0, vcc, v0, v7
536 ; CGP-NEXT: v_sub_i32_e32 v1, vcc, v1, v9
537 ; CGP-NEXT: v_cmp_le_u32_e64 s[4:5], s8, v0
538 ; CGP-NEXT: v_cndmask_b32_e64 v3, v3, v8, s[4:5]
539 ; CGP-NEXT: v_subrev_i32_e32 v7, vcc, s8, v0
540 ; CGP-NEXT: v_cmp_ge_u32_e64 s[6:7], v1, v5
541 ; CGP-NEXT: v_cndmask_b32_e64 v4, v4, v10, s[6:7]
542 ; CGP-NEXT: v_subrev_i32_e32 v8, vcc, 0x12d8fb, v1
543 ; CGP-NEXT: v_cndmask_b32_e64 v0, v0, v7, s[4:5]
544 ; CGP-NEXT: v_add_i32_e32 v7, vcc, 1, v3
545 ; CGP-NEXT: v_cndmask_b32_e64 v1, v1, v8, s[6:7]
546 ; CGP-NEXT: v_add_i32_e32 v8, vcc, 1, v4
547 ; CGP-NEXT: v_cmp_le_u32_e32 vcc, s8, v0
548 ; CGP-NEXT: v_cndmask_b32_e32 v0, v3, v7, vcc
549 ; CGP-NEXT: v_cmp_ge_u32_e32 vcc, v1, v5
550 ; CGP-NEXT: v_cndmask_b32_e32 v1, v4, v8, vcc
551 ; CGP-NEXT: v_xor_b32_e32 v0, v0, v2
552 ; CGP-NEXT: v_xor_b32_e32 v1, v1, v6
553 ; CGP-NEXT: v_sub_i32_e32 v0, vcc, v0, v2
554 ; CGP-NEXT: v_sub_i32_e32 v1, vcc, v1, v6
555 ; CGP-NEXT: s_setpc_b64 s[30:31]
556 %result = sdiv <2 x i32> %num, <i32 1235195, i32 1235195>
557 ret <2 x i32> %result
560 define i32 @v_sdiv_i32_pow2_shl_denom(i32 %x, i32 %y) {
561 ; CHECK-LABEL: v_sdiv_i32_pow2_shl_denom:
563 ; CHECK-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
564 ; CHECK-NEXT: v_lshl_b32_e32 v1, 0x1000, v1
565 ; CHECK-NEXT: v_ashrrev_i32_e32 v2, 31, v0
566 ; CHECK-NEXT: v_ashrrev_i32_e32 v3, 31, v1
567 ; CHECK-NEXT: v_add_i32_e32 v0, vcc, v0, v2
568 ; CHECK-NEXT: v_add_i32_e32 v1, vcc, v1, v3
569 ; CHECK-NEXT: v_xor_b32_e32 v0, v0, v2
570 ; CHECK-NEXT: v_xor_b32_e32 v1, v1, v3
571 ; CHECK-NEXT: v_cvt_f32_u32_e32 v4, v1
572 ; CHECK-NEXT: v_sub_i32_e32 v5, vcc, 0, v1
573 ; CHECK-NEXT: v_rcp_iflag_f32_e32 v4, v4
574 ; CHECK-NEXT: v_mul_f32_e32 v4, 0x4f7ffffe, v4
575 ; CHECK-NEXT: v_cvt_u32_f32_e32 v4, v4
576 ; CHECK-NEXT: v_mul_lo_u32 v5, v5, v4
577 ; CHECK-NEXT: v_mul_hi_u32 v5, v4, v5
578 ; CHECK-NEXT: v_add_i32_e32 v4, vcc, v4, v5
579 ; CHECK-NEXT: v_mul_hi_u32 v4, v0, v4
580 ; CHECK-NEXT: v_mul_lo_u32 v5, v4, v1
581 ; CHECK-NEXT: v_add_i32_e32 v6, vcc, 1, v4
582 ; CHECK-NEXT: v_sub_i32_e32 v0, vcc, v0, v5
583 ; CHECK-NEXT: v_cmp_ge_u32_e32 vcc, v0, v1
584 ; CHECK-NEXT: v_cndmask_b32_e32 v4, v4, v6, vcc
585 ; CHECK-NEXT: v_sub_i32_e64 v5, s[4:5], v0, v1
586 ; CHECK-NEXT: v_cndmask_b32_e32 v0, v0, v5, vcc
587 ; CHECK-NEXT: v_add_i32_e32 v5, vcc, 1, v4
588 ; CHECK-NEXT: v_cmp_ge_u32_e32 vcc, v0, v1
589 ; CHECK-NEXT: v_cndmask_b32_e32 v0, v4, v5, vcc
590 ; CHECK-NEXT: v_xor_b32_e32 v1, v2, v3
591 ; CHECK-NEXT: v_xor_b32_e32 v0, v0, v1
592 ; CHECK-NEXT: v_sub_i32_e32 v0, vcc, v0, v1
593 ; CHECK-NEXT: s_setpc_b64 s[30:31]
594 %shl.y = shl i32 4096, %y
595 %r = sdiv i32 %x, %shl.y
599 define <2 x i32> @v_sdiv_v2i32_pow2_shl_denom(<2 x i32> %x, <2 x i32> %y) {
600 ; GISEL-LABEL: v_sdiv_v2i32_pow2_shl_denom:
602 ; GISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
603 ; GISEL-NEXT: v_lshl_b32_e32 v2, 0x1000, v2
604 ; GISEL-NEXT: v_lshl_b32_e32 v3, 0x1000, v3
605 ; GISEL-NEXT: v_ashrrev_i32_e32 v4, 31, v0
606 ; GISEL-NEXT: v_ashrrev_i32_e32 v5, 31, v1
607 ; GISEL-NEXT: v_ashrrev_i32_e32 v6, 31, v2
608 ; GISEL-NEXT: v_add_i32_e32 v0, vcc, v0, v4
609 ; GISEL-NEXT: v_ashrrev_i32_e32 v7, 31, v3
610 ; GISEL-NEXT: v_add_i32_e32 v1, vcc, v1, v5
611 ; GISEL-NEXT: v_add_i32_e32 v2, vcc, v2, v6
612 ; GISEL-NEXT: v_xor_b32_e32 v0, v0, v4
613 ; GISEL-NEXT: v_xor_b32_e32 v4, v4, v6
614 ; GISEL-NEXT: v_add_i32_e32 v3, vcc, v3, v7
615 ; GISEL-NEXT: v_xor_b32_e32 v1, v1, v5
616 ; GISEL-NEXT: v_xor_b32_e32 v5, v5, v7
617 ; GISEL-NEXT: v_xor_b32_e32 v2, v2, v6
618 ; GISEL-NEXT: v_xor_b32_e32 v3, v3, v7
619 ; GISEL-NEXT: v_cvt_f32_u32_e32 v6, v2
620 ; GISEL-NEXT: v_sub_i32_e32 v7, vcc, 0, v2
621 ; GISEL-NEXT: v_cvt_f32_u32_e32 v8, v3
622 ; GISEL-NEXT: v_sub_i32_e32 v9, vcc, 0, v3
623 ; GISEL-NEXT: v_rcp_iflag_f32_e32 v6, v6
624 ; GISEL-NEXT: v_rcp_iflag_f32_e32 v8, v8
625 ; GISEL-NEXT: v_mul_f32_e32 v6, 0x4f7ffffe, v6
626 ; GISEL-NEXT: v_mul_f32_e32 v8, 0x4f7ffffe, v8
627 ; GISEL-NEXT: v_cvt_u32_f32_e32 v6, v6
628 ; GISEL-NEXT: v_cvt_u32_f32_e32 v8, v8
629 ; GISEL-NEXT: v_mul_lo_u32 v7, v7, v6
630 ; GISEL-NEXT: v_mul_lo_u32 v9, v9, v8
631 ; GISEL-NEXT: v_mul_hi_u32 v7, v6, v7
632 ; GISEL-NEXT: v_mul_hi_u32 v9, v8, v9
633 ; GISEL-NEXT: v_add_i32_e32 v6, vcc, v6, v7
634 ; GISEL-NEXT: v_add_i32_e32 v7, vcc, v8, v9
635 ; GISEL-NEXT: v_mul_hi_u32 v6, v0, v6
636 ; GISEL-NEXT: v_mul_hi_u32 v7, v1, v7
637 ; GISEL-NEXT: v_mul_lo_u32 v8, v6, v2
638 ; GISEL-NEXT: v_add_i32_e32 v9, vcc, 1, v6
639 ; GISEL-NEXT: v_mul_lo_u32 v10, v7, v3
640 ; GISEL-NEXT: v_add_i32_e32 v11, vcc, 1, v7
641 ; GISEL-NEXT: v_sub_i32_e32 v0, vcc, v0, v8
642 ; GISEL-NEXT: v_sub_i32_e32 v1, vcc, v1, v10
643 ; GISEL-NEXT: v_cmp_ge_u32_e32 vcc, v0, v2
644 ; GISEL-NEXT: v_cndmask_b32_e32 v6, v6, v9, vcc
645 ; GISEL-NEXT: v_sub_i32_e64 v8, s[4:5], v0, v2
646 ; GISEL-NEXT: v_cmp_ge_u32_e64 s[4:5], v1, v3
647 ; GISEL-NEXT: v_cndmask_b32_e64 v7, v7, v11, s[4:5]
648 ; GISEL-NEXT: v_sub_i32_e64 v9, s[6:7], v1, v3
649 ; GISEL-NEXT: v_cndmask_b32_e32 v0, v0, v8, vcc
650 ; GISEL-NEXT: v_add_i32_e32 v8, vcc, 1, v6
651 ; GISEL-NEXT: v_cndmask_b32_e64 v1, v1, v9, s[4:5]
652 ; GISEL-NEXT: v_add_i32_e32 v9, vcc, 1, v7
653 ; GISEL-NEXT: v_cmp_ge_u32_e32 vcc, v0, v2
654 ; GISEL-NEXT: v_cndmask_b32_e32 v0, v6, v8, vcc
655 ; GISEL-NEXT: v_cmp_ge_u32_e32 vcc, v1, v3
656 ; GISEL-NEXT: v_cndmask_b32_e32 v1, v7, v9, vcc
657 ; GISEL-NEXT: v_xor_b32_e32 v0, v0, v4
658 ; GISEL-NEXT: v_xor_b32_e32 v1, v1, v5
659 ; GISEL-NEXT: v_sub_i32_e32 v0, vcc, v0, v4
660 ; GISEL-NEXT: v_sub_i32_e32 v1, vcc, v1, v5
661 ; GISEL-NEXT: s_setpc_b64 s[30:31]
663 ; CGP-LABEL: v_sdiv_v2i32_pow2_shl_denom:
665 ; CGP-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
666 ; CGP-NEXT: v_lshl_b32_e32 v2, 0x1000, v2
667 ; CGP-NEXT: v_lshl_b32_e32 v3, 0x1000, v3
668 ; CGP-NEXT: v_ashrrev_i32_e32 v4, 31, v0
669 ; CGP-NEXT: v_ashrrev_i32_e32 v5, 31, v1
670 ; CGP-NEXT: v_ashrrev_i32_e32 v6, 31, v2
671 ; CGP-NEXT: v_add_i32_e32 v0, vcc, v0, v4
672 ; CGP-NEXT: v_ashrrev_i32_e32 v7, 31, v3
673 ; CGP-NEXT: v_add_i32_e32 v1, vcc, v1, v5
674 ; CGP-NEXT: v_xor_b32_e32 v8, v4, v6
675 ; CGP-NEXT: v_add_i32_e32 v2, vcc, v2, v6
676 ; CGP-NEXT: v_xor_b32_e32 v0, v0, v4
677 ; CGP-NEXT: v_xor_b32_e32 v4, v5, v7
678 ; CGP-NEXT: v_add_i32_e32 v3, vcc, v3, v7
679 ; CGP-NEXT: v_xor_b32_e32 v1, v1, v5
680 ; CGP-NEXT: v_xor_b32_e32 v2, v2, v6
681 ; CGP-NEXT: v_xor_b32_e32 v3, v3, v7
682 ; CGP-NEXT: v_cvt_f32_u32_e32 v5, v2
683 ; CGP-NEXT: v_sub_i32_e32 v6, vcc, 0, v2
684 ; CGP-NEXT: v_cvt_f32_u32_e32 v7, v3
685 ; CGP-NEXT: v_sub_i32_e32 v9, vcc, 0, v3
686 ; CGP-NEXT: v_rcp_f32_e32 v5, v5
687 ; CGP-NEXT: v_rcp_f32_e32 v7, v7
688 ; CGP-NEXT: v_mul_f32_e32 v5, 0x4f7ffffe, v5
689 ; CGP-NEXT: v_mul_f32_e32 v7, 0x4f7ffffe, v7
690 ; CGP-NEXT: v_cvt_u32_f32_e32 v5, v5
691 ; CGP-NEXT: v_cvt_u32_f32_e32 v7, v7
692 ; CGP-NEXT: v_mul_lo_u32 v6, v6, v5
693 ; CGP-NEXT: v_mul_lo_u32 v9, v9, v7
694 ; CGP-NEXT: v_mul_hi_u32 v6, v5, v6
695 ; CGP-NEXT: v_mul_hi_u32 v9, v7, v9
696 ; CGP-NEXT: v_add_i32_e32 v5, vcc, v5, v6
697 ; CGP-NEXT: v_add_i32_e32 v6, vcc, v7, v9
698 ; CGP-NEXT: v_mul_hi_u32 v5, v0, v5
699 ; CGP-NEXT: v_mul_hi_u32 v6, v1, v6
700 ; CGP-NEXT: v_mul_lo_u32 v7, v5, v2
701 ; CGP-NEXT: v_add_i32_e32 v9, vcc, 1, v5
702 ; CGP-NEXT: v_mul_lo_u32 v10, v6, v3
703 ; CGP-NEXT: v_add_i32_e32 v11, vcc, 1, v6
704 ; CGP-NEXT: v_sub_i32_e32 v0, vcc, v0, v7
705 ; CGP-NEXT: v_sub_i32_e32 v1, vcc, v1, v10
706 ; CGP-NEXT: v_cmp_ge_u32_e32 vcc, v0, v2
707 ; CGP-NEXT: v_cndmask_b32_e32 v5, v5, v9, vcc
708 ; CGP-NEXT: v_sub_i32_e64 v7, s[4:5], v0, v2
709 ; CGP-NEXT: v_cmp_ge_u32_e64 s[4:5], v1, v3
710 ; CGP-NEXT: v_cndmask_b32_e64 v6, v6, v11, s[4:5]
711 ; CGP-NEXT: v_sub_i32_e64 v9, s[6:7], v1, v3
712 ; CGP-NEXT: v_cndmask_b32_e32 v0, v0, v7, vcc
713 ; CGP-NEXT: v_add_i32_e32 v7, vcc, 1, v5
714 ; CGP-NEXT: v_cndmask_b32_e64 v1, v1, v9, s[4:5]
715 ; CGP-NEXT: v_add_i32_e32 v9, vcc, 1, v6
716 ; CGP-NEXT: v_cmp_ge_u32_e32 vcc, v0, v2
717 ; CGP-NEXT: v_cndmask_b32_e32 v0, v5, v7, vcc
718 ; CGP-NEXT: v_cmp_ge_u32_e32 vcc, v1, v3
719 ; CGP-NEXT: v_cndmask_b32_e32 v1, v6, v9, vcc
720 ; CGP-NEXT: v_xor_b32_e32 v0, v0, v8
721 ; CGP-NEXT: v_xor_b32_e32 v1, v1, v4
722 ; CGP-NEXT: v_sub_i32_e32 v0, vcc, v0, v8
723 ; CGP-NEXT: v_sub_i32_e32 v1, vcc, v1, v4
724 ; CGP-NEXT: s_setpc_b64 s[30:31]
725 %shl.y = shl <2 x i32> <i32 4096, i32 4096>, %y
726 %r = sdiv <2 x i32> %x, %shl.y
730 define i32 @v_sdiv_i32_24bit(i32 %num, i32 %den) {
731 ; GISEL-LABEL: v_sdiv_i32_24bit:
733 ; GISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
734 ; GISEL-NEXT: v_and_b32_e32 v0, 0xffffff, v0
735 ; GISEL-NEXT: v_and_b32_e32 v1, 0xffffff, v1
736 ; GISEL-NEXT: v_ashrrev_i32_e32 v2, 31, v0
737 ; GISEL-NEXT: v_ashrrev_i32_e32 v3, 31, v1
738 ; GISEL-NEXT: v_add_i32_e32 v0, vcc, v0, v2
739 ; GISEL-NEXT: v_add_i32_e32 v1, vcc, v1, v3
740 ; GISEL-NEXT: v_xor_b32_e32 v0, v0, v2
741 ; GISEL-NEXT: v_xor_b32_e32 v1, v1, v3
742 ; GISEL-NEXT: v_cvt_f32_u32_e32 v4, v1
743 ; GISEL-NEXT: v_sub_i32_e32 v5, vcc, 0, v1
744 ; GISEL-NEXT: v_rcp_iflag_f32_e32 v4, v4
745 ; GISEL-NEXT: v_mul_f32_e32 v4, 0x4f7ffffe, v4
746 ; GISEL-NEXT: v_cvt_u32_f32_e32 v4, v4
747 ; GISEL-NEXT: v_mul_lo_u32 v5, v5, v4
748 ; GISEL-NEXT: v_mul_hi_u32 v5, v4, v5
749 ; GISEL-NEXT: v_add_i32_e32 v4, vcc, v4, v5
750 ; GISEL-NEXT: v_mul_hi_u32 v4, v0, v4
751 ; GISEL-NEXT: v_mul_lo_u32 v5, v4, v1
752 ; GISEL-NEXT: v_add_i32_e32 v6, vcc, 1, v4
753 ; GISEL-NEXT: v_sub_i32_e32 v0, vcc, v0, v5
754 ; GISEL-NEXT: v_cmp_ge_u32_e32 vcc, v0, v1
755 ; GISEL-NEXT: v_cndmask_b32_e32 v4, v4, v6, vcc
756 ; GISEL-NEXT: v_sub_i32_e64 v5, s[4:5], v0, v1
757 ; GISEL-NEXT: v_cndmask_b32_e32 v0, v0, v5, vcc
758 ; GISEL-NEXT: v_add_i32_e32 v5, vcc, 1, v4
759 ; GISEL-NEXT: v_cmp_ge_u32_e32 vcc, v0, v1
760 ; GISEL-NEXT: v_cndmask_b32_e32 v0, v4, v5, vcc
761 ; GISEL-NEXT: v_xor_b32_e32 v1, v2, v3
762 ; GISEL-NEXT: v_xor_b32_e32 v0, v0, v1
763 ; GISEL-NEXT: v_sub_i32_e32 v0, vcc, v0, v1
764 ; GISEL-NEXT: s_setpc_b64 s[30:31]
766 ; CGP-LABEL: v_sdiv_i32_24bit:
768 ; CGP-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
769 ; CGP-NEXT: v_and_b32_e32 v0, 0xffffff, v0
770 ; CGP-NEXT: v_and_b32_e32 v1, 0xffffff, v1
771 ; CGP-NEXT: v_cvt_f32_u32_e32 v2, v1
772 ; CGP-NEXT: v_sub_i32_e32 v3, vcc, 0, v1
773 ; CGP-NEXT: v_rcp_f32_e32 v2, v2
774 ; CGP-NEXT: v_mul_f32_e32 v2, 0x4f7ffffe, v2
775 ; CGP-NEXT: v_cvt_u32_f32_e32 v2, v2
776 ; CGP-NEXT: v_mul_lo_u32 v3, v3, v2
777 ; CGP-NEXT: v_mul_hi_u32 v3, v2, v3
778 ; CGP-NEXT: v_add_i32_e32 v2, vcc, v2, v3
779 ; CGP-NEXT: v_mul_hi_u32 v2, v0, v2
780 ; CGP-NEXT: v_mul_lo_u32 v3, v2, v1
781 ; CGP-NEXT: v_add_i32_e32 v4, vcc, 1, v2
782 ; CGP-NEXT: v_sub_i32_e32 v0, vcc, v0, v3
783 ; CGP-NEXT: v_cmp_ge_u32_e32 vcc, v0, v1
784 ; CGP-NEXT: v_cndmask_b32_e32 v2, v2, v4, vcc
785 ; CGP-NEXT: v_sub_i32_e64 v3, s[4:5], v0, v1
786 ; CGP-NEXT: v_cndmask_b32_e32 v0, v0, v3, vcc
787 ; CGP-NEXT: v_add_i32_e32 v3, vcc, 1, v2
788 ; CGP-NEXT: v_cmp_ge_u32_e32 vcc, v0, v1
789 ; CGP-NEXT: v_cndmask_b32_e32 v0, v2, v3, vcc
790 ; CGP-NEXT: s_setpc_b64 s[30:31]
791 %num.mask = and i32 %num, 16777215
792 %den.mask = and i32 %den, 16777215
793 %result = sdiv i32 %num.mask, %den.mask
797 define <2 x i32> @v_sdiv_v2i32_24bit(<2 x i32> %num, <2 x i32> %den) {
798 ; GISEL-LABEL: v_sdiv_v2i32_24bit:
800 ; GISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
801 ; GISEL-NEXT: v_and_b32_e32 v0, 0xffffff, v0
802 ; GISEL-NEXT: v_and_b32_e32 v1, 0xffffff, v1
803 ; GISEL-NEXT: v_and_b32_e32 v2, 0xffffff, v2
804 ; GISEL-NEXT: v_and_b32_e32 v3, 0xffffff, v3
805 ; GISEL-NEXT: v_ashrrev_i32_e32 v4, 31, v0
806 ; GISEL-NEXT: v_ashrrev_i32_e32 v5, 31, v2
807 ; GISEL-NEXT: v_ashrrev_i32_e32 v6, 31, v1
808 ; GISEL-NEXT: v_ashrrev_i32_e32 v7, 31, v3
809 ; GISEL-NEXT: v_add_i32_e32 v0, vcc, v0, v4
810 ; GISEL-NEXT: v_add_i32_e32 v2, vcc, v2, v5
811 ; GISEL-NEXT: v_xor_b32_e32 v8, v4, v5
812 ; GISEL-NEXT: v_add_i32_e32 v1, vcc, v1, v6
813 ; GISEL-NEXT: v_add_i32_e32 v3, vcc, v3, v7
814 ; GISEL-NEXT: v_xor_b32_e32 v9, v6, v7
815 ; GISEL-NEXT: v_xor_b32_e32 v0, v0, v4
816 ; GISEL-NEXT: v_xor_b32_e32 v2, v2, v5
817 ; GISEL-NEXT: v_xor_b32_e32 v1, v1, v6
818 ; GISEL-NEXT: v_xor_b32_e32 v3, v3, v7
819 ; GISEL-NEXT: v_cvt_f32_u32_e32 v4, v2
820 ; GISEL-NEXT: v_sub_i32_e32 v5, vcc, 0, v2
821 ; GISEL-NEXT: v_cvt_f32_u32_e32 v6, v3
822 ; GISEL-NEXT: v_sub_i32_e32 v7, vcc, 0, v3
823 ; GISEL-NEXT: v_rcp_iflag_f32_e32 v4, v4
824 ; GISEL-NEXT: v_rcp_iflag_f32_e32 v6, v6
825 ; GISEL-NEXT: v_mul_f32_e32 v4, 0x4f7ffffe, v4
826 ; GISEL-NEXT: v_mul_f32_e32 v6, 0x4f7ffffe, v6
827 ; GISEL-NEXT: v_cvt_u32_f32_e32 v4, v4
828 ; GISEL-NEXT: v_cvt_u32_f32_e32 v6, v6
829 ; GISEL-NEXT: v_mul_lo_u32 v5, v5, v4
830 ; GISEL-NEXT: v_mul_lo_u32 v7, v7, v6
831 ; GISEL-NEXT: v_mul_hi_u32 v5, v4, v5
832 ; GISEL-NEXT: v_mul_hi_u32 v7, v6, v7
833 ; GISEL-NEXT: v_add_i32_e32 v4, vcc, v4, v5
834 ; GISEL-NEXT: v_add_i32_e32 v5, vcc, v6, v7
835 ; GISEL-NEXT: v_mul_hi_u32 v4, v0, v4
836 ; GISEL-NEXT: v_mul_hi_u32 v5, v1, v5
837 ; GISEL-NEXT: v_mul_lo_u32 v6, v4, v2
838 ; GISEL-NEXT: v_add_i32_e32 v7, vcc, 1, v4
839 ; GISEL-NEXT: v_mul_lo_u32 v10, v5, v3
840 ; GISEL-NEXT: v_add_i32_e32 v11, vcc, 1, v5
841 ; GISEL-NEXT: v_sub_i32_e32 v0, vcc, v0, v6
842 ; GISEL-NEXT: v_sub_i32_e32 v1, vcc, v1, v10
843 ; GISEL-NEXT: v_cmp_ge_u32_e32 vcc, v0, v2
844 ; GISEL-NEXT: v_cndmask_b32_e32 v4, v4, v7, vcc
845 ; GISEL-NEXT: v_sub_i32_e64 v6, s[4:5], v0, v2
846 ; GISEL-NEXT: v_cmp_ge_u32_e64 s[4:5], v1, v3
847 ; GISEL-NEXT: v_cndmask_b32_e64 v5, v5, v11, s[4:5]
848 ; GISEL-NEXT: v_sub_i32_e64 v7, s[6:7], v1, v3
849 ; GISEL-NEXT: v_cndmask_b32_e32 v0, v0, v6, vcc
850 ; GISEL-NEXT: v_add_i32_e32 v6, vcc, 1, v4
851 ; GISEL-NEXT: v_cndmask_b32_e64 v1, v1, v7, s[4:5]
852 ; GISEL-NEXT: v_add_i32_e32 v7, vcc, 1, v5
853 ; GISEL-NEXT: v_cmp_ge_u32_e32 vcc, v0, v2
854 ; GISEL-NEXT: v_cndmask_b32_e32 v0, v4, v6, vcc
855 ; GISEL-NEXT: v_cmp_ge_u32_e32 vcc, v1, v3
856 ; GISEL-NEXT: v_cndmask_b32_e32 v1, v5, v7, vcc
857 ; GISEL-NEXT: v_xor_b32_e32 v0, v0, v8
858 ; GISEL-NEXT: v_xor_b32_e32 v1, v1, v9
859 ; GISEL-NEXT: v_sub_i32_e32 v0, vcc, v0, v8
860 ; GISEL-NEXT: v_sub_i32_e32 v1, vcc, v1, v9
861 ; GISEL-NEXT: s_setpc_b64 s[30:31]
863 ; CGP-LABEL: v_sdiv_v2i32_24bit:
865 ; CGP-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
866 ; CGP-NEXT: v_and_b32_e32 v0, 0xffffff, v0
867 ; CGP-NEXT: v_and_b32_e32 v1, 0xffffff, v1
868 ; CGP-NEXT: v_and_b32_e32 v2, 0xffffff, v2
869 ; CGP-NEXT: v_and_b32_e32 v3, 0xffffff, v3
870 ; CGP-NEXT: v_cvt_f32_u32_e32 v4, v2
871 ; CGP-NEXT: v_sub_i32_e32 v5, vcc, 0, v2
872 ; CGP-NEXT: v_cvt_f32_u32_e32 v6, v3
873 ; CGP-NEXT: v_sub_i32_e32 v7, vcc, 0, v3
874 ; CGP-NEXT: v_rcp_f32_e32 v4, v4
875 ; CGP-NEXT: v_rcp_f32_e32 v6, v6
876 ; CGP-NEXT: v_mul_f32_e32 v4, 0x4f7ffffe, v4
877 ; CGP-NEXT: v_mul_f32_e32 v6, 0x4f7ffffe, v6
878 ; CGP-NEXT: v_cvt_u32_f32_e32 v4, v4
879 ; CGP-NEXT: v_cvt_u32_f32_e32 v6, v6
880 ; CGP-NEXT: v_mul_lo_u32 v5, v5, v4
881 ; CGP-NEXT: v_mul_lo_u32 v7, v7, v6
882 ; CGP-NEXT: v_mul_hi_u32 v5, v4, v5
883 ; CGP-NEXT: v_mul_hi_u32 v7, v6, v7
884 ; CGP-NEXT: v_add_i32_e32 v4, vcc, v4, v5
885 ; CGP-NEXT: v_add_i32_e32 v5, vcc, v6, v7
886 ; CGP-NEXT: v_mul_hi_u32 v4, v0, v4
887 ; CGP-NEXT: v_mul_hi_u32 v5, v1, v5
888 ; CGP-NEXT: v_mul_lo_u32 v6, v4, v2
889 ; CGP-NEXT: v_add_i32_e32 v7, vcc, 1, v4
890 ; CGP-NEXT: v_mul_lo_u32 v8, v5, v3
891 ; CGP-NEXT: v_add_i32_e32 v9, vcc, 1, v5
892 ; CGP-NEXT: v_sub_i32_e32 v0, vcc, v0, v6
893 ; CGP-NEXT: v_sub_i32_e32 v1, vcc, v1, v8
894 ; CGP-NEXT: v_cmp_ge_u32_e32 vcc, v0, v2
895 ; CGP-NEXT: v_cndmask_b32_e32 v4, v4, v7, vcc
896 ; CGP-NEXT: v_sub_i32_e64 v6, s[4:5], v0, v2
897 ; CGP-NEXT: v_cmp_ge_u32_e64 s[4:5], v1, v3
898 ; CGP-NEXT: v_cndmask_b32_e64 v5, v5, v9, s[4:5]
899 ; CGP-NEXT: v_sub_i32_e64 v7, s[6:7], v1, v3
900 ; CGP-NEXT: v_cndmask_b32_e32 v0, v0, v6, vcc
901 ; CGP-NEXT: v_add_i32_e32 v6, vcc, 1, v4
902 ; CGP-NEXT: v_cndmask_b32_e64 v1, v1, v7, s[4:5]
903 ; CGP-NEXT: v_add_i32_e32 v7, vcc, 1, v5
904 ; CGP-NEXT: v_cmp_ge_u32_e32 vcc, v0, v2
905 ; CGP-NEXT: v_cndmask_b32_e32 v0, v4, v6, vcc
906 ; CGP-NEXT: v_cmp_ge_u32_e32 vcc, v1, v3
907 ; CGP-NEXT: v_cndmask_b32_e32 v1, v5, v7, vcc
908 ; CGP-NEXT: s_setpc_b64 s[30:31]
909 %num.mask = and <2 x i32> %num, <i32 16777215, i32 16777215>
910 %den.mask = and <2 x i32> %den, <i32 16777215, i32 16777215>
911 %result = sdiv <2 x i32> %num.mask, %den.mask
912 ret <2 x i32> %result