1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -march=amdgcn -verify-machineinstrs < %s | FileCheck -check-prefixes=SI %s
3 ; RUN: llc -march=amdgcn -mcpu=tonga -mattr=-flat-for-global -verify-machineinstrs < %s | FileCheck -check-prefixes=VI %s
4 ; RUN: llc -march=amdgcn -mcpu=gfx900 -mattr=-flat-for-global -verify-machineinstrs < %s | FileCheck -check-prefixes=GFX9 %s
5 ; RUN: llc -march=r600 -mcpu=redwood < %s | FileCheck -check-prefix=EG %s
6 ; RUN: llc -march=r600 -mcpu=cayman < %s | FileCheck -check-prefix=CM %s
8 ; Signed 24-bit multiply is not supported on pre-Cayman GPUs.
9 define amdgpu_kernel void @test_smul24_i32(ptr addrspace(1) %out, i32 %a, i32 %b) #0 {
10 ; SI-LABEL: test_smul24_i32:
11 ; SI: ; %bb.0: ; %entry
12 ; SI-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x9
13 ; SI-NEXT: s_mov_b32 s7, 0xf000
14 ; SI-NEXT: s_waitcnt lgkmcnt(0)
15 ; SI-NEXT: s_bfe_i32 s2, s2, 0x180000
16 ; SI-NEXT: s_bfe_i32 s3, s3, 0x180000
17 ; SI-NEXT: s_mul_i32 s2, s2, s3
18 ; SI-NEXT: s_mov_b32 s6, -1
19 ; SI-NEXT: s_mov_b32 s4, s0
20 ; SI-NEXT: s_mov_b32 s5, s1
21 ; SI-NEXT: v_mov_b32_e32 v0, s2
22 ; SI-NEXT: buffer_store_dword v0, off, s[4:7], 0
25 ; VI-LABEL: test_smul24_i32:
26 ; VI: ; %bb.0: ; %entry
27 ; VI-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x24
28 ; VI-NEXT: s_mov_b32 s7, 0xf000
29 ; VI-NEXT: s_mov_b32 s6, -1
30 ; VI-NEXT: s_waitcnt lgkmcnt(0)
31 ; VI-NEXT: s_mov_b32 s4, s0
32 ; VI-NEXT: s_mov_b32 s5, s1
33 ; VI-NEXT: s_bfe_i32 s0, s2, 0x180000
34 ; VI-NEXT: s_bfe_i32 s1, s3, 0x180000
35 ; VI-NEXT: s_mul_i32 s0, s0, s1
36 ; VI-NEXT: v_mov_b32_e32 v0, s0
37 ; VI-NEXT: buffer_store_dword v0, off, s[4:7], 0
40 ; GFX9-LABEL: test_smul24_i32:
41 ; GFX9: ; %bb.0: ; %entry
42 ; GFX9-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x24
43 ; GFX9-NEXT: s_mov_b32 s7, 0xf000
44 ; GFX9-NEXT: s_mov_b32 s6, -1
45 ; GFX9-NEXT: s_waitcnt lgkmcnt(0)
46 ; GFX9-NEXT: s_mov_b32 s4, s0
47 ; GFX9-NEXT: s_mov_b32 s5, s1
48 ; GFX9-NEXT: s_bfe_i32 s0, s2, 0x180000
49 ; GFX9-NEXT: s_bfe_i32 s1, s3, 0x180000
50 ; GFX9-NEXT: s_mul_i32 s0, s0, s1
51 ; GFX9-NEXT: v_mov_b32_e32 v0, s0
52 ; GFX9-NEXT: buffer_store_dword v0, off, s[4:7], 0
55 ; EG-LABEL: test_smul24_i32:
56 ; EG: ; %bb.0: ; %entry
57 ; EG-NEXT: ALU 8, @4, KC0[CB0:0-32], KC1[]
58 ; EG-NEXT: MEM_RAT_CACHELESS STORE_RAW T1.X, T0.X, 1
61 ; EG-NEXT: ALU clause starting at 4:
62 ; EG-NEXT: LSHL T0.W, KC0[2].Z, literal.x,
63 ; EG-NEXT: LSHL * T1.W, KC0[2].W, literal.x,
64 ; EG-NEXT: 8(1.121039e-44), 0(0.000000e+00)
65 ; EG-NEXT: ASHR T1.W, PS, literal.x,
66 ; EG-NEXT: ASHR * T0.W, PV.W, literal.x,
67 ; EG-NEXT: 8(1.121039e-44), 0(0.000000e+00)
68 ; EG-NEXT: LSHR T0.X, KC0[2].Y, literal.x,
69 ; EG-NEXT: MULLO_INT * T1.X, PS, PV.W,
70 ; EG-NEXT: 2(2.802597e-45), 0(0.000000e+00)
72 ; CM-LABEL: test_smul24_i32:
73 ; CM: ; %bb.0: ; %entry
74 ; CM-NEXT: ALU 10, @4, KC0[CB0:0-32], KC1[]
75 ; CM-NEXT: MEM_RAT_CACHELESS STORE_DWORD T1.X, T0.X
78 ; CM-NEXT: ALU clause starting at 4:
79 ; CM-NEXT: LSHL T0.Z, KC0[2].Z, literal.x,
80 ; CM-NEXT: LSHL * T0.W, KC0[2].W, literal.x,
81 ; CM-NEXT: 8(1.121039e-44), 0(0.000000e+00)
82 ; CM-NEXT: LSHR T0.X, KC0[2].Y, literal.x,
83 ; CM-NEXT: ASHR T1.Z, PV.W, literal.y,
84 ; CM-NEXT: ASHR * T0.W, PV.Z, literal.y,
85 ; CM-NEXT: 2(2.802597e-45), 8(1.121039e-44)
86 ; CM-NEXT: MULLO_INT T1.X, T0.W, T1.Z,
87 ; CM-NEXT: MULLO_INT T1.Y (MASKED), T0.W, T1.Z,
88 ; CM-NEXT: MULLO_INT T1.Z (MASKED), T0.W, T1.Z,
89 ; CM-NEXT: MULLO_INT * T1.W (MASKED), T0.W, T1.Z,
91 %a.shl = shl i32 %a, 8
92 %a.24 = ashr i32 %a.shl, 8
93 %b.shl = shl i32 %b, 8
94 %b.24 = ashr i32 %b.shl, 8
95 %mul24 = mul i32 %a.24, %b.24
96 store i32 %mul24, ptr addrspace(1) %out
100 define amdgpu_kernel void @test_smulhi24_i64(ptr addrspace(1) %out, i32 %a, i32 %b) #0 {
101 ; SI-LABEL: test_smulhi24_i64:
102 ; SI: ; %bb.0: ; %entry
103 ; SI-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x9
104 ; SI-NEXT: s_mov_b32 s7, 0xf000
105 ; SI-NEXT: s_mov_b32 s6, -1
106 ; SI-NEXT: s_waitcnt lgkmcnt(0)
107 ; SI-NEXT: s_mov_b32 s4, s0
108 ; SI-NEXT: s_mov_b32 s5, s1
109 ; SI-NEXT: v_mov_b32_e32 v0, s3
110 ; SI-NEXT: v_mul_hi_i32_i24_e32 v0, s2, v0
111 ; SI-NEXT: buffer_store_dword v0, off, s[4:7], 0
114 ; VI-LABEL: test_smulhi24_i64:
115 ; VI: ; %bb.0: ; %entry
116 ; VI-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x24
117 ; VI-NEXT: s_mov_b32 s7, 0xf000
118 ; VI-NEXT: s_mov_b32 s6, -1
119 ; VI-NEXT: s_waitcnt lgkmcnt(0)
120 ; VI-NEXT: v_mov_b32_e32 v0, s3
121 ; VI-NEXT: s_mov_b32 s4, s0
122 ; VI-NEXT: s_mov_b32 s5, s1
123 ; VI-NEXT: v_mul_hi_i32_i24_e32 v0, s2, v0
124 ; VI-NEXT: buffer_store_dword v0, off, s[4:7], 0
127 ; GFX9-LABEL: test_smulhi24_i64:
128 ; GFX9: ; %bb.0: ; %entry
129 ; GFX9-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x24
130 ; GFX9-NEXT: s_mov_b32 s7, 0xf000
131 ; GFX9-NEXT: s_mov_b32 s6, -1
132 ; GFX9-NEXT: s_waitcnt lgkmcnt(0)
133 ; GFX9-NEXT: s_mov_b32 s4, s0
134 ; GFX9-NEXT: s_mov_b32 s5, s1
135 ; GFX9-NEXT: s_bfe_i32 s0, s2, 0x180000
136 ; GFX9-NEXT: s_bfe_i32 s1, s3, 0x180000
137 ; GFX9-NEXT: s_mul_hi_i32 s0, s0, s1
138 ; GFX9-NEXT: v_mov_b32_e32 v0, s0
139 ; GFX9-NEXT: buffer_store_dword v0, off, s[4:7], 0
140 ; GFX9-NEXT: s_endpgm
142 ; EG-LABEL: test_smulhi24_i64:
143 ; EG: ; %bb.0: ; %entry
144 ; EG-NEXT: ALU 8, @4, KC0[CB0:0-32], KC1[]
145 ; EG-NEXT: MEM_RAT_CACHELESS STORE_RAW T1.X, T0.X, 1
148 ; EG-NEXT: ALU clause starting at 4:
149 ; EG-NEXT: LSHL T0.W, KC0[2].Z, literal.x,
150 ; EG-NEXT: LSHL * T1.W, KC0[2].W, literal.x,
151 ; EG-NEXT: 8(1.121039e-44), 0(0.000000e+00)
152 ; EG-NEXT: ASHR T1.W, PS, literal.x,
153 ; EG-NEXT: ASHR * T0.W, PV.W, literal.x,
154 ; EG-NEXT: 8(1.121039e-44), 0(0.000000e+00)
155 ; EG-NEXT: LSHR T0.X, KC0[2].Y, literal.x,
156 ; EG-NEXT: MULHI_INT * T1.X, PS, PV.W,
157 ; EG-NEXT: 2(2.802597e-45), 0(0.000000e+00)
159 ; CM-LABEL: test_smulhi24_i64:
160 ; CM: ; %bb.0: ; %entry
161 ; CM-NEXT: ALU 5, @4, KC0[CB0:0-32], KC1[]
162 ; CM-NEXT: MEM_RAT_CACHELESS STORE_DWORD T1.X, T0.X
165 ; CM-NEXT: ALU clause starting at 4:
166 ; CM-NEXT: LSHR * T0.X, KC0[2].Y, literal.x,
167 ; CM-NEXT: 2(2.802597e-45), 0(0.000000e+00)
168 ; CM-NEXT: MULHI_INT24 T1.X, KC0[2].Z, KC0[2].W,
169 ; CM-NEXT: MULHI_INT24 T1.Y (MASKED), KC0[2].Z, KC0[2].W,
170 ; CM-NEXT: MULHI_INT24 T1.Z (MASKED), KC0[2].Z, KC0[2].W,
171 ; CM-NEXT: MULHI_INT24 * T1.W (MASKED), KC0[2].Z, KC0[2].W,
173 %a.shl = shl i32 %a, 8
174 %a.24 = ashr i32 %a.shl, 8
175 %b.shl = shl i32 %b, 8
176 %b.24 = ashr i32 %b.shl, 8
177 %a.24.i64 = sext i32 %a.24 to i64
178 %b.24.i64 = sext i32 %b.24 to i64
179 %mul48 = mul i64 %a.24.i64, %b.24.i64
180 %mul48.hi = lshr i64 %mul48, 32
181 %mul24hi = trunc i64 %mul48.hi to i32
182 store i32 %mul24hi, ptr addrspace(1) %out
186 define i64 @test_smul48_i64(i64 %lhs, i64 %rhs) {
187 ; SI-LABEL: test_smul48_i64:
189 ; SI-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
190 ; SI-NEXT: v_mul_i32_i24_e32 v3, v0, v2
191 ; SI-NEXT: v_mul_hi_i32_i24_e32 v1, v0, v2
192 ; SI-NEXT: v_mov_b32_e32 v0, v3
193 ; SI-NEXT: s_setpc_b64 s[30:31]
195 ; VI-LABEL: test_smul48_i64:
197 ; VI-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
198 ; VI-NEXT: v_mul_i32_i24_e32 v3, v0, v2
199 ; VI-NEXT: v_mul_hi_i32_i24_e32 v1, v0, v2
200 ; VI-NEXT: v_mov_b32_e32 v0, v3
201 ; VI-NEXT: s_setpc_b64 s[30:31]
203 ; GFX9-LABEL: test_smul48_i64:
205 ; GFX9-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
206 ; GFX9-NEXT: v_mul_i32_i24_e32 v3, v0, v2
207 ; GFX9-NEXT: v_mul_hi_i32_i24_e32 v1, v0, v2
208 ; GFX9-NEXT: v_mov_b32_e32 v0, v3
209 ; GFX9-NEXT: s_setpc_b64 s[30:31]
211 ; EG-LABEL: test_smul48_i64:
216 ; CM-LABEL: test_smul48_i64:
220 %shl.lhs = shl i64 %lhs, 40
221 %lhs24 = ashr i64 %shl.lhs, 40
222 %shl.rhs = shl i64 %rhs, 40
223 %rhs24 = ashr i64 %shl.rhs, 40
224 %mul = mul i64 %lhs24, %rhs24
228 define <2 x i64> @test_smul48_v2i64(<2 x i64> %lhs, <2 x i64> %rhs) {
229 ; SI-LABEL: test_smul48_v2i64:
231 ; SI-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
232 ; SI-NEXT: v_lshlrev_b32_e32 v1, 8, v2
233 ; SI-NEXT: v_lshlrev_b32_e32 v2, 8, v0
234 ; SI-NEXT: v_lshlrev_b32_e32 v3, 8, v6
235 ; SI-NEXT: v_lshlrev_b32_e32 v4, 8, v4
236 ; SI-NEXT: v_ashr_i64 v[5:6], v[0:1], 40
237 ; SI-NEXT: v_ashr_i64 v[1:2], v[1:2], 40
238 ; SI-NEXT: v_ashr_i64 v[6:7], v[2:3], 40
239 ; SI-NEXT: v_ashr_i64 v[2:3], v[3:4], 40
240 ; SI-NEXT: v_mul_i32_i24_e32 v0, v1, v2
241 ; SI-NEXT: v_mul_hi_i32_i24_e32 v1, v1, v2
242 ; SI-NEXT: v_mul_i32_i24_e32 v2, v5, v6
243 ; SI-NEXT: v_mul_hi_i32_i24_e32 v3, v5, v6
244 ; SI-NEXT: s_setpc_b64 s[30:31]
246 ; VI-LABEL: test_smul48_v2i64:
248 ; VI-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
249 ; VI-NEXT: v_lshlrev_b32_e32 v1, 8, v2
250 ; VI-NEXT: v_ashrrev_i64 v[7:8], 40, v[0:1]
251 ; VI-NEXT: v_lshlrev_b32_e32 v1, 8, v0
252 ; VI-NEXT: v_ashrrev_i64 v[1:2], 40, v[0:1]
253 ; VI-NEXT: v_lshlrev_b32_e32 v2, 8, v6
254 ; VI-NEXT: v_lshlrev_b32_e32 v3, 8, v4
255 ; VI-NEXT: v_ashrrev_i64 v[3:4], 40, v[2:3]
256 ; VI-NEXT: v_ashrrev_i64 v[4:5], 40, v[1:2]
257 ; VI-NEXT: v_mul_i32_i24_e32 v0, v1, v3
258 ; VI-NEXT: v_mul_hi_i32_i24_e32 v1, v1, v3
259 ; VI-NEXT: v_mul_i32_i24_e32 v2, v7, v4
260 ; VI-NEXT: v_mul_hi_i32_i24_e32 v3, v7, v4
261 ; VI-NEXT: s_setpc_b64 s[30:31]
263 ; GFX9-LABEL: test_smul48_v2i64:
265 ; GFX9-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
266 ; GFX9-NEXT: v_lshlrev_b32_e32 v1, 8, v2
267 ; GFX9-NEXT: v_ashrrev_i64 v[7:8], 40, v[0:1]
268 ; GFX9-NEXT: v_lshlrev_b32_e32 v1, 8, v0
269 ; GFX9-NEXT: v_ashrrev_i64 v[1:2], 40, v[0:1]
270 ; GFX9-NEXT: v_lshlrev_b32_e32 v2, 8, v6
271 ; GFX9-NEXT: v_lshlrev_b32_e32 v3, 8, v4
272 ; GFX9-NEXT: v_ashrrev_i64 v[3:4], 40, v[2:3]
273 ; GFX9-NEXT: v_ashrrev_i64 v[4:5], 40, v[1:2]
274 ; GFX9-NEXT: v_mul_i32_i24_e32 v0, v1, v3
275 ; GFX9-NEXT: v_mul_hi_i32_i24_e32 v1, v1, v3
276 ; GFX9-NEXT: v_mul_i32_i24_e32 v2, v7, v4
277 ; GFX9-NEXT: v_mul_hi_i32_i24_e32 v3, v7, v4
278 ; GFX9-NEXT: s_setpc_b64 s[30:31]
280 ; EG-LABEL: test_smul48_v2i64:
285 ; CM-LABEL: test_smul48_v2i64:
289 %shl.lhs = shl <2 x i64> %lhs, <i64 40, i64 40>
290 %lhs24 = ashr <2 x i64> %shl.lhs, <i64 40, i64 40>
291 %shl.rhs = shl <2 x i64> %rhs, <i64 40, i64 40>
292 %rhs24 = ashr <2 x i64> %shl.rhs, <i64 40, i64 40>
293 %mul = mul <2 x i64> %lhs24, %rhs24
297 ; This requires handling of the original 64-bit mul node to eliminate
298 ; unnecessary extension instructions because after legalization they
299 ; will not be removed by SimplifyDemandedBits because there are
300 ; multiple uses by the separate mul and mulhi.
301 define amdgpu_kernel void @test_smul24_i64(ptr addrspace(1) %out, [8 x i32], i32 %a, [8 x i32], i32 %b) #0 {
302 ; SI-LABEL: test_smul24_i64:
304 ; SI-NEXT: s_load_dwordx2 s[4:5], s[0:1], 0x9
305 ; SI-NEXT: s_load_dword s2, s[0:1], 0x13
306 ; SI-NEXT: s_load_dword s0, s[0:1], 0x1c
307 ; SI-NEXT: s_mov_b32 s7, 0xf000
308 ; SI-NEXT: s_mov_b32 s6, -1
309 ; SI-NEXT: s_waitcnt lgkmcnt(0)
310 ; SI-NEXT: s_bfe_i32 s1, s2, 0x180000
311 ; SI-NEXT: s_bfe_i32 s0, s0, 0x180000
312 ; SI-NEXT: v_mov_b32_e32 v0, s1
313 ; SI-NEXT: s_mul_i32 s1, s0, s1
314 ; SI-NEXT: v_mul_hi_i32_i24_e32 v1, s0, v0
315 ; SI-NEXT: v_mov_b32_e32 v0, s1
316 ; SI-NEXT: buffer_store_dwordx2 v[0:1], off, s[4:7], 0
319 ; VI-LABEL: test_smul24_i64:
321 ; VI-NEXT: s_load_dword s4, s[0:1], 0x4c
322 ; VI-NEXT: s_load_dword s5, s[0:1], 0x70
323 ; VI-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x24
324 ; VI-NEXT: s_mov_b32 s3, 0xf000
325 ; VI-NEXT: s_mov_b32 s2, -1
326 ; VI-NEXT: s_waitcnt lgkmcnt(0)
327 ; VI-NEXT: s_bfe_i32 s4, s4, 0x180000
328 ; VI-NEXT: s_bfe_i32 s5, s5, 0x180000
329 ; VI-NEXT: v_mov_b32_e32 v0, s4
330 ; VI-NEXT: v_mul_hi_i32_i24_e32 v1, s5, v0
331 ; VI-NEXT: v_mul_i32_i24_e32 v0, s5, v0
332 ; VI-NEXT: buffer_store_dwordx2 v[0:1], off, s[0:3], 0
335 ; GFX9-LABEL: test_smul24_i64:
337 ; GFX9-NEXT: s_load_dword s2, s[0:1], 0x4c
338 ; GFX9-NEXT: s_load_dword s3, s[0:1], 0x70
339 ; GFX9-NEXT: s_load_dwordx2 s[4:5], s[0:1], 0x24
340 ; GFX9-NEXT: s_mov_b32 s7, 0xf000
341 ; GFX9-NEXT: s_mov_b32 s6, -1
342 ; GFX9-NEXT: s_waitcnt lgkmcnt(0)
343 ; GFX9-NEXT: s_bfe_i32 s0, s2, 0x180000
344 ; GFX9-NEXT: s_bfe_i32 s1, s3, 0x180000
345 ; GFX9-NEXT: s_mul_hi_i32 s2, s1, s0
346 ; GFX9-NEXT: s_mul_i32 s1, s1, s0
347 ; GFX9-NEXT: v_mov_b32_e32 v0, s1
348 ; GFX9-NEXT: v_mov_b32_e32 v1, s2
349 ; GFX9-NEXT: buffer_store_dwordx2 v[0:1], off, s[4:7], 0
350 ; GFX9-NEXT: s_endpgm
352 ; EG-LABEL: test_smul24_i64:
354 ; EG-NEXT: ALU 9, @4, KC0[CB0:0-32], KC1[]
355 ; EG-NEXT: MEM_RAT_CACHELESS STORE_RAW T0.XY, T1.X, 1
358 ; EG-NEXT: ALU clause starting at 4:
359 ; EG-NEXT: LSHL T0.W, KC0[4].Z, literal.x,
360 ; EG-NEXT: LSHL * T1.W, KC0[6].W, literal.x,
361 ; EG-NEXT: 8(1.121039e-44), 0(0.000000e+00)
362 ; EG-NEXT: ASHR T1.W, PS, literal.x,
363 ; EG-NEXT: ASHR * T0.W, PV.W, literal.x,
364 ; EG-NEXT: 8(1.121039e-44), 0(0.000000e+00)
365 ; EG-NEXT: MULHI_INT * T0.Y, PV.W, PS,
366 ; EG-NEXT: LSHR T1.X, KC0[2].Y, literal.x,
367 ; EG-NEXT: MULLO_INT * T0.X, T1.W, T0.W,
368 ; EG-NEXT: 2(2.802597e-45), 0(0.000000e+00)
370 ; CM-LABEL: test_smul24_i64:
372 ; CM-NEXT: ALU 14, @4, KC0[CB0:0-32], KC1[]
373 ; CM-NEXT: MEM_RAT_CACHELESS STORE_DWORD T1, T0.X
376 ; CM-NEXT: ALU clause starting at 4:
377 ; CM-NEXT: LSHL T0.Z, KC0[4].Z, literal.x,
378 ; CM-NEXT: LSHL * T0.W, KC0[6].W, literal.x,
379 ; CM-NEXT: 8(1.121039e-44), 0(0.000000e+00)
380 ; CM-NEXT: LSHR T0.X, KC0[2].Y, literal.x,
381 ; CM-NEXT: ASHR T1.Z, PV.W, literal.y,
382 ; CM-NEXT: ASHR * T0.W, PV.Z, literal.y,
383 ; CM-NEXT: 2(2.802597e-45), 8(1.121039e-44)
384 ; CM-NEXT: MULLO_INT T1.X, T1.Z, T0.W,
385 ; CM-NEXT: MULLO_INT T1.Y (MASKED), T1.Z, T0.W,
386 ; CM-NEXT: MULLO_INT T1.Z (MASKED), T1.Z, T0.W,
387 ; CM-NEXT: MULLO_INT * T1.W (MASKED), T1.Z, T0.W,
388 ; CM-NEXT: MULHI_INT24 T1.X (MASKED), KC0[6].W, KC0[4].Z,
389 ; CM-NEXT: MULHI_INT24 T1.Y, KC0[6].W, KC0[4].Z,
390 ; CM-NEXT: MULHI_INT24 T1.Z (MASKED), KC0[6].W, KC0[4].Z,
391 ; CM-NEXT: MULHI_INT24 * T1.W (MASKED), KC0[6].W, KC0[4].Z,
392 %shl.i = shl i32 %a, 8
393 %shr.i = ashr i32 %shl.i, 8
394 %conv.i = sext i32 %shr.i to i64
395 %shl1.i = shl i32 %b, 8
396 %shr2.i = ashr i32 %shl1.i, 8
397 %conv3.i = sext i32 %shr2.i to i64
398 %mul.i = mul i64 %conv3.i, %conv.i
399 store i64 %mul.i, ptr addrspace(1) %out
403 define amdgpu_kernel void @test_smul24_i64_square(ptr addrspace(1) %out, i32 %a, i32 %b) #0 {
404 ; SI-LABEL: test_smul24_i64_square:
406 ; SI-NEXT: s_load_dword s4, s[0:1], 0xb
407 ; SI-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x9
408 ; SI-NEXT: s_mov_b32 s3, 0xf000
409 ; SI-NEXT: s_mov_b32 s2, -1
410 ; SI-NEXT: s_waitcnt lgkmcnt(0)
411 ; SI-NEXT: s_bfe_i32 s4, s4, 0x180000
412 ; SI-NEXT: s_mul_i32 s5, s4, s4
413 ; SI-NEXT: v_mul_hi_i32_i24_e64 v1, s4, s4
414 ; SI-NEXT: v_mov_b32_e32 v0, s5
415 ; SI-NEXT: buffer_store_dwordx2 v[0:1], off, s[0:3], 0
418 ; VI-LABEL: test_smul24_i64_square:
420 ; VI-NEXT: s_load_dword s4, s[0:1], 0x2c
421 ; VI-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x24
422 ; VI-NEXT: s_mov_b32 s3, 0xf000
423 ; VI-NEXT: s_mov_b32 s2, -1
424 ; VI-NEXT: s_waitcnt lgkmcnt(0)
425 ; VI-NEXT: s_bfe_i32 s4, s4, 0x180000
426 ; VI-NEXT: v_mul_hi_i32_i24_e64 v1, s4, s4
427 ; VI-NEXT: v_mul_i32_i24_e64 v0, s4, s4
428 ; VI-NEXT: buffer_store_dwordx2 v[0:1], off, s[0:3], 0
431 ; GFX9-LABEL: test_smul24_i64_square:
433 ; GFX9-NEXT: s_load_dword s2, s[0:1], 0x2c
434 ; GFX9-NEXT: s_load_dwordx2 s[4:5], s[0:1], 0x24
435 ; GFX9-NEXT: s_mov_b32 s7, 0xf000
436 ; GFX9-NEXT: s_mov_b32 s6, -1
437 ; GFX9-NEXT: s_waitcnt lgkmcnt(0)
438 ; GFX9-NEXT: s_bfe_i32 s0, s2, 0x180000
439 ; GFX9-NEXT: s_mul_hi_i32 s1, s0, s0
440 ; GFX9-NEXT: s_mul_i32 s0, s0, s0
441 ; GFX9-NEXT: v_mov_b32_e32 v0, s0
442 ; GFX9-NEXT: v_mov_b32_e32 v1, s1
443 ; GFX9-NEXT: buffer_store_dwordx2 v[0:1], off, s[4:7], 0
444 ; GFX9-NEXT: s_endpgm
446 ; EG-LABEL: test_smul24_i64_square:
448 ; EG-NEXT: ALU 7, @4, KC0[CB0:0-32], KC1[]
449 ; EG-NEXT: MEM_RAT_CACHELESS STORE_RAW T0.XY, T1.X, 1
452 ; EG-NEXT: ALU clause starting at 4:
453 ; EG-NEXT: LSHL * T0.W, KC0[2].Z, literal.x,
454 ; EG-NEXT: 8(1.121039e-44), 0(0.000000e+00)
455 ; EG-NEXT: ASHR * T0.W, PV.W, literal.x,
456 ; EG-NEXT: 8(1.121039e-44), 0(0.000000e+00)
457 ; EG-NEXT: MULHI_INT * T0.Y, PV.W, PV.W,
458 ; EG-NEXT: LSHR T1.X, KC0[2].Y, literal.x,
459 ; EG-NEXT: MULLO_INT * T0.X, T0.W, T0.W,
460 ; EG-NEXT: 2(2.802597e-45), 0(0.000000e+00)
462 ; CM-LABEL: test_smul24_i64_square:
464 ; CM-NEXT: ALU 12, @4, KC0[CB0:0-32], KC1[]
465 ; CM-NEXT: MEM_RAT_CACHELESS STORE_DWORD T1, T0.X
468 ; CM-NEXT: ALU clause starting at 4:
469 ; CM-NEXT: LSHL * T0.W, KC0[2].Z, literal.x,
470 ; CM-NEXT: 8(1.121039e-44), 0(0.000000e+00)
471 ; CM-NEXT: LSHR T0.X, KC0[2].Y, literal.x,
472 ; CM-NEXT: ASHR * T0.W, PV.W, literal.y,
473 ; CM-NEXT: 2(2.802597e-45), 8(1.121039e-44)
474 ; CM-NEXT: MULLO_INT T1.X, T0.W, T0.W,
475 ; CM-NEXT: MULLO_INT T1.Y (MASKED), T0.W, T0.W,
476 ; CM-NEXT: MULLO_INT T1.Z (MASKED), T0.W, T0.W,
477 ; CM-NEXT: MULLO_INT * T1.W (MASKED), T0.W, T0.W,
478 ; CM-NEXT: MULHI_INT24 T1.X (MASKED), KC0[2].Z, KC0[2].Z,
479 ; CM-NEXT: MULHI_INT24 T1.Y, KC0[2].Z, KC0[2].Z,
480 ; CM-NEXT: MULHI_INT24 T1.Z (MASKED), KC0[2].Z, KC0[2].Z,
481 ; CM-NEXT: MULHI_INT24 * T1.W (MASKED), KC0[2].Z, KC0[2].Z,
482 %shl.i = shl i32 %a, 8
483 %shr.i = ashr i32 %shl.i, 8
484 %conv.i = sext i32 %shr.i to i64
485 %mul.i = mul i64 %conv.i, %conv.i
486 store i64 %mul.i, ptr addrspace(1) %out
490 define amdgpu_kernel void @test_smul24_i33(ptr addrspace(1) %out, i33 %a, i33 %b) #0 {
491 ; SI-LABEL: test_smul24_i33:
492 ; SI: ; %bb.0: ; %entry
493 ; SI-NEXT: s_load_dwordx2 s[4:5], s[0:1], 0x9
494 ; SI-NEXT: s_load_dword s2, s[0:1], 0xb
495 ; SI-NEXT: s_load_dword s0, s[0:1], 0xd
496 ; SI-NEXT: s_mov_b32 s7, 0xf000
497 ; SI-NEXT: s_mov_b32 s6, -1
498 ; SI-NEXT: s_waitcnt lgkmcnt(0)
499 ; SI-NEXT: s_lshl_b32 s1, s2, 8
500 ; SI-NEXT: s_lshl_b32 s3, s0, 8
501 ; SI-NEXT: s_ashr_i64 s[2:3], s[2:3], 40
502 ; SI-NEXT: s_ashr_i64 s[0:1], s[0:1], 40
503 ; SI-NEXT: v_mov_b32_e32 v0, s2
504 ; SI-NEXT: s_mul_i32 s1, s0, s2
505 ; SI-NEXT: v_mul_hi_i32_i24_e32 v1, s0, v0
506 ; SI-NEXT: v_mov_b32_e32 v0, s1
507 ; SI-NEXT: v_lshl_b64 v[0:1], v[0:1], 31
508 ; SI-NEXT: v_ashr_i64 v[0:1], v[0:1], 31
509 ; SI-NEXT: buffer_store_dwordx2 v[0:1], off, s[4:7], 0
512 ; VI-LABEL: test_smul24_i33:
513 ; VI: ; %bb.0: ; %entry
514 ; VI-NEXT: s_load_dword s2, s[0:1], 0x2c
515 ; VI-NEXT: s_load_dword s4, s[0:1], 0x34
516 ; VI-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x24
517 ; VI-NEXT: s_waitcnt lgkmcnt(0)
518 ; VI-NEXT: s_lshl_b32 s3, s2, 8
519 ; VI-NEXT: s_lshl_b32 s5, s4, 8
520 ; VI-NEXT: s_ashr_i64 s[4:5], s[4:5], 40
521 ; VI-NEXT: s_ashr_i64 s[2:3], s[2:3], 40
522 ; VI-NEXT: v_mov_b32_e32 v0, s4
523 ; VI-NEXT: v_mul_hi_i32_i24_e32 v1, s2, v0
524 ; VI-NEXT: v_mul_i32_i24_e32 v0, s2, v0
525 ; VI-NEXT: v_lshlrev_b64 v[0:1], 31, v[0:1]
526 ; VI-NEXT: s_mov_b32 s3, 0xf000
527 ; VI-NEXT: v_ashrrev_i64 v[0:1], 31, v[0:1]
528 ; VI-NEXT: s_mov_b32 s2, -1
529 ; VI-NEXT: buffer_store_dwordx2 v[0:1], off, s[0:3], 0
532 ; GFX9-LABEL: test_smul24_i33:
533 ; GFX9: ; %bb.0: ; %entry
534 ; GFX9-NEXT: s_load_dword s2, s[0:1], 0x2c
535 ; GFX9-NEXT: s_load_dwordx2 s[4:5], s[0:1], 0x24
536 ; GFX9-NEXT: s_load_dword s3, s[0:1], 0x34
537 ; GFX9-NEXT: s_mov_b32 s7, 0xf000
538 ; GFX9-NEXT: s_mov_b32 s6, -1
539 ; GFX9-NEXT: s_waitcnt lgkmcnt(0)
540 ; GFX9-NEXT: s_lshl_b32 s1, s2, 8
541 ; GFX9-NEXT: s_ashr_i64 s[0:1], s[0:1], 40
542 ; GFX9-NEXT: s_lshl_b32 s1, s3, 8
543 ; GFX9-NEXT: s_ashr_i64 s[2:3], s[0:1], 40
544 ; GFX9-NEXT: s_mul_hi_i32 s1, s0, s2
545 ; GFX9-NEXT: s_mul_i32 s0, s0, s2
546 ; GFX9-NEXT: s_lshl_b64 s[0:1], s[0:1], 31
547 ; GFX9-NEXT: s_ashr_i64 s[0:1], s[0:1], 31
548 ; GFX9-NEXT: v_mov_b32_e32 v0, s0
549 ; GFX9-NEXT: v_mov_b32_e32 v1, s1
550 ; GFX9-NEXT: buffer_store_dwordx2 v[0:1], off, s[4:7], 0
551 ; GFX9-NEXT: s_endpgm
553 ; EG-LABEL: test_smul24_i33:
554 ; EG: ; %bb.0: ; %entry
555 ; EG-NEXT: ALU 10, @4, KC0[CB0:0-32], KC1[]
556 ; EG-NEXT: MEM_RAT_CACHELESS STORE_RAW T1.XY, T2.X, 1
559 ; EG-NEXT: ALU clause starting at 4:
560 ; EG-NEXT: LSHL T0.W, KC0[2].W, literal.x,
561 ; EG-NEXT: LSHL * T1.W, KC0[3].Y, literal.x,
562 ; EG-NEXT: 8(1.121039e-44), 0(0.000000e+00)
563 ; EG-NEXT: ASHR T1.W, PS, literal.x,
564 ; EG-NEXT: ASHR * T0.W, PV.W, literal.x,
565 ; EG-NEXT: 8(1.121039e-44), 0(0.000000e+00)
566 ; EG-NEXT: MULHI_INT * T0.X, PS, PV.W,
567 ; EG-NEXT: MULLO_INT * T1.X, T0.W, T1.W,
568 ; EG-NEXT: LSHR T2.X, KC0[2].Y, literal.x,
569 ; EG-NEXT: BFE_INT * T1.Y, T0.X, 0.0, 1,
570 ; EG-NEXT: 2(2.802597e-45), 0(0.000000e+00)
572 ; CM-LABEL: test_smul24_i33:
573 ; CM: ; %bb.0: ; %entry
574 ; CM-NEXT: ALU 16, @4, KC0[CB0:0-32], KC1[]
575 ; CM-NEXT: MEM_RAT_CACHELESS STORE_DWORD T1, T2.X
578 ; CM-NEXT: ALU clause starting at 4:
579 ; CM-NEXT: LSHL T0.Z, KC0[2].W, literal.x,
580 ; CM-NEXT: LSHL * T0.W, KC0[3].Y, literal.x,
581 ; CM-NEXT: 8(1.121039e-44), 0(0.000000e+00)
582 ; CM-NEXT: ASHR T1.Z, PV.W, literal.x,
583 ; CM-NEXT: ASHR * T0.W, PV.Z, literal.x,
584 ; CM-NEXT: 8(1.121039e-44), 0(0.000000e+00)
585 ; CM-NEXT: MULHI_INT24 T0.X, KC0[2].W, KC0[3].Y,
586 ; CM-NEXT: MULHI_INT24 T0.Y (MASKED), KC0[2].W, KC0[3].Y,
587 ; CM-NEXT: MULHI_INT24 T0.Z (MASKED), KC0[2].W, KC0[3].Y,
588 ; CM-NEXT: MULHI_INT24 * T0.W (MASKED), KC0[2].W, KC0[3].Y,
589 ; CM-NEXT: MULLO_INT T1.X, T0.W, T1.Z,
590 ; CM-NEXT: MULLO_INT T1.Y (MASKED), T0.W, T1.Z,
591 ; CM-NEXT: MULLO_INT T1.Z (MASKED), T0.W, T1.Z,
592 ; CM-NEXT: MULLO_INT * T1.W (MASKED), T0.W, T1.Z,
593 ; CM-NEXT: LSHR T2.X, KC0[2].Y, literal.x,
594 ; CM-NEXT: BFE_INT * T1.Y, T0.X, 0.0, 1,
595 ; CM-NEXT: 2(2.802597e-45), 0(0.000000e+00)
597 %a.shl = shl i33 %a, 9
598 %a.24 = ashr i33 %a.shl, 9
599 %b.shl = shl i33 %b, 9
600 %b.24 = ashr i33 %b.shl, 9
601 %mul24 = mul i33 %a.24, %b.24
602 %ext = sext i33 %mul24 to i64
603 store i64 %ext, ptr addrspace(1) %out
607 define amdgpu_kernel void @test_smulhi24_i33(ptr addrspace(1) %out, i33 %a, i33 %b) {
608 ; SI-LABEL: test_smulhi24_i33:
609 ; SI: ; %bb.0: ; %entry
610 ; SI-NEXT: s_load_dword s4, s[0:1], 0xd
611 ; SI-NEXT: s_load_dword s5, s[0:1], 0xb
612 ; SI-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x9
613 ; SI-NEXT: s_mov_b32 s3, 0xf000
614 ; SI-NEXT: s_mov_b32 s2, -1
615 ; SI-NEXT: s_waitcnt lgkmcnt(0)
616 ; SI-NEXT: v_mov_b32_e32 v0, s4
617 ; SI-NEXT: v_mul_hi_i32_i24_e32 v0, s5, v0
618 ; SI-NEXT: v_and_b32_e32 v0, 1, v0
619 ; SI-NEXT: buffer_store_dword v0, off, s[0:3], 0
622 ; VI-LABEL: test_smulhi24_i33:
623 ; VI: ; %bb.0: ; %entry
624 ; VI-NEXT: s_load_dword s4, s[0:1], 0x34
625 ; VI-NEXT: s_load_dword s5, s[0:1], 0x2c
626 ; VI-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x24
627 ; VI-NEXT: s_mov_b32 s3, 0xf000
628 ; VI-NEXT: s_mov_b32 s2, -1
629 ; VI-NEXT: s_waitcnt lgkmcnt(0)
630 ; VI-NEXT: v_mov_b32_e32 v0, s4
631 ; VI-NEXT: v_mul_hi_i32_i24_e32 v0, s5, v0
632 ; VI-NEXT: v_and_b32_e32 v0, 1, v0
633 ; VI-NEXT: buffer_store_dword v0, off, s[0:3], 0
636 ; GFX9-LABEL: test_smulhi24_i33:
637 ; GFX9: ; %bb.0: ; %entry
638 ; GFX9-NEXT: s_load_dword s2, s[0:1], 0x2c
639 ; GFX9-NEXT: s_load_dwordx2 s[4:5], s[0:1], 0x24
640 ; GFX9-NEXT: s_load_dword s3, s[0:1], 0x34
641 ; GFX9-NEXT: s_mov_b32 s7, 0xf000
642 ; GFX9-NEXT: s_mov_b32 s6, -1
643 ; GFX9-NEXT: s_waitcnt lgkmcnt(0)
644 ; GFX9-NEXT: s_lshl_b32 s1, s2, 8
645 ; GFX9-NEXT: s_ashr_i64 s[0:1], s[0:1], 40
646 ; GFX9-NEXT: s_lshl_b32 s1, s3, 8
647 ; GFX9-NEXT: s_ashr_i64 s[2:3], s[0:1], 40
648 ; GFX9-NEXT: s_mul_hi_i32 s0, s0, s2
649 ; GFX9-NEXT: s_and_b32 s0, s0, 1
650 ; GFX9-NEXT: v_mov_b32_e32 v0, s0
651 ; GFX9-NEXT: buffer_store_dword v0, off, s[4:7], 0
652 ; GFX9-NEXT: s_endpgm
654 ; EG-LABEL: test_smulhi24_i33:
655 ; EG: ; %bb.0: ; %entry
656 ; EG-NEXT: ALU 9, @4, KC0[CB0:0-32], KC1[]
657 ; EG-NEXT: MEM_RAT_CACHELESS STORE_RAW T0.X, T1.X, 1
660 ; EG-NEXT: ALU clause starting at 4:
661 ; EG-NEXT: LSHL T0.W, KC0[2].W, literal.x,
662 ; EG-NEXT: LSHL * T1.W, KC0[3].Y, literal.x,
663 ; EG-NEXT: 8(1.121039e-44), 0(0.000000e+00)
664 ; EG-NEXT: ASHR T1.W, PS, literal.x,
665 ; EG-NEXT: ASHR * T0.W, PV.W, literal.x,
666 ; EG-NEXT: 8(1.121039e-44), 0(0.000000e+00)
667 ; EG-NEXT: MULHI_INT * T0.X, PS, PV.W,
668 ; EG-NEXT: AND_INT T0.X, PS, 1,
669 ; EG-NEXT: LSHR * T1.X, KC0[2].Y, literal.x,
670 ; EG-NEXT: 2(2.802597e-45), 0(0.000000e+00)
672 ; CM-LABEL: test_smulhi24_i33:
673 ; CM: ; %bb.0: ; %entry
674 ; CM-NEXT: ALU 6, @4, KC0[CB0:0-32], KC1[]
675 ; CM-NEXT: MEM_RAT_CACHELESS STORE_DWORD T0.X, T1.X
678 ; CM-NEXT: ALU clause starting at 4:
679 ; CM-NEXT: MULHI_INT24 T0.X, KC0[2].W, KC0[3].Y,
680 ; CM-NEXT: MULHI_INT24 T0.Y (MASKED), KC0[2].W, KC0[3].Y,
681 ; CM-NEXT: MULHI_INT24 T0.Z (MASKED), KC0[2].W, KC0[3].Y,
682 ; CM-NEXT: MULHI_INT24 * T0.W (MASKED), KC0[2].W, KC0[3].Y,
683 ; CM-NEXT: AND_INT * T0.X, PV.X, 1,
684 ; CM-NEXT: LSHR * T1.X, KC0[2].Y, literal.x,
685 ; CM-NEXT: 2(2.802597e-45), 0(0.000000e+00)
687 %tmp0 = shl i33 %a, 9
688 %a_24 = ashr i33 %tmp0, 9
689 %tmp1 = shl i33 %b, 9
690 %b_24 = ashr i33 %tmp1, 9
691 %tmp2 = mul i33 %a_24, %b_24
692 %hi = lshr i33 %tmp2, 32
693 %trunc = trunc i33 %hi to i32
695 store i32 %trunc, ptr addrspace(1) %out
699 define amdgpu_kernel void @simplify_i24_crash(ptr addrspace(1) %out, i32 %arg0, <2 x i32> %arg1, <2 x i32> %arg2) {
700 ; SI-LABEL: simplify_i24_crash:
702 ; SI-NEXT: s_load_dword s2, s[0:1], 0xb
703 ; SI-NEXT: s_waitcnt lgkmcnt(0)
704 ; SI-NEXT: s_cmp_lg_u32 s2, 0
705 ; SI-NEXT: s_cbranch_scc0 .LBB8_2
706 ; SI-NEXT: ; %bb.1: ; %bb7
708 ; SI-NEXT: .LBB8_2: ; %bb11
709 ; SI-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0xd
710 ; SI-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x9
711 ; SI-NEXT: s_mov_b32 s3, 0xf000
712 ; SI-NEXT: s_waitcnt lgkmcnt(0)
713 ; SI-NEXT: s_bfe_i32 s2, s4, 0x180000
714 ; SI-NEXT: s_bfe_i32 s4, s6, 0x180000
715 ; SI-NEXT: s_mul_i32 s4, s2, s4
716 ; SI-NEXT: s_mov_b32 s2, -1
717 ; SI-NEXT: v_mov_b32_e32 v0, s4
718 ; SI-NEXT: v_mov_b32_e32 v1, s4
719 ; SI-NEXT: buffer_store_dwordx2 v[0:1], off, s[0:3], 0
722 ; VI-LABEL: simplify_i24_crash:
724 ; VI-NEXT: s_load_dword s2, s[0:1], 0x2c
725 ; VI-NEXT: s_waitcnt lgkmcnt(0)
726 ; VI-NEXT: s_cmp_lg_u32 s2, 0
727 ; VI-NEXT: s_cbranch_scc0 .LBB8_2
728 ; VI-NEXT: ; %bb.1: ; %bb7
730 ; VI-NEXT: .LBB8_2: ; %bb11
731 ; VI-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x34
732 ; VI-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x24
733 ; VI-NEXT: s_mov_b32 s3, 0xf000
734 ; VI-NEXT: s_mov_b32 s2, -1
735 ; VI-NEXT: s_waitcnt lgkmcnt(0)
736 ; VI-NEXT: s_bfe_i32 s4, s4, 0x180000
737 ; VI-NEXT: s_bfe_i32 s5, s6, 0x180000
738 ; VI-NEXT: s_mul_i32 s4, s4, s5
739 ; VI-NEXT: v_mov_b32_e32 v0, s4
740 ; VI-NEXT: v_mov_b32_e32 v1, s4
741 ; VI-NEXT: buffer_store_dwordx2 v[0:1], off, s[0:3], 0
744 ; GFX9-LABEL: simplify_i24_crash:
745 ; GFX9: ; %bb.0: ; %bb
746 ; GFX9-NEXT: s_load_dword s2, s[0:1], 0x2c
747 ; GFX9-NEXT: s_waitcnt lgkmcnt(0)
748 ; GFX9-NEXT: s_cmp_lg_u32 s2, 0
749 ; GFX9-NEXT: s_cbranch_scc0 .LBB8_2
750 ; GFX9-NEXT: ; %bb.1: ; %bb7
751 ; GFX9-NEXT: s_endpgm
752 ; GFX9-NEXT: .LBB8_2: ; %bb11
753 ; GFX9-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x34
754 ; GFX9-NEXT: s_load_dwordx2 s[8:9], s[0:1], 0x24
755 ; GFX9-NEXT: s_mov_b32 s11, 0xf000
756 ; GFX9-NEXT: s_mov_b32 s10, -1
757 ; GFX9-NEXT: s_waitcnt lgkmcnt(0)
758 ; GFX9-NEXT: s_bfe_i32 s0, s4, 0x180000
759 ; GFX9-NEXT: s_bfe_i32 s1, s6, 0x180000
760 ; GFX9-NEXT: s_mul_i32 s0, s0, s1
761 ; GFX9-NEXT: v_mov_b32_e32 v0, s0
762 ; GFX9-NEXT: v_mov_b32_e32 v1, s0
763 ; GFX9-NEXT: buffer_store_dwordx2 v[0:1], off, s[8:11], 0
764 ; GFX9-NEXT: s_endpgm
766 ; EG-LABEL: simplify_i24_crash:
768 ; EG-NEXT: ALU_PUSH_BEFORE 1, @6, KC0[CB0:0-32], KC1[]
769 ; EG-NEXT: JUMP @5 POP:1
770 ; EG-NEXT: ALU 14, @8, KC0[CB0:0-32], KC1[]
771 ; EG-NEXT: MEM_RAT_CACHELESS STORE_RAW T0.XY, T1.X, 0
772 ; EG-NEXT: POP @5 POP:1
774 ; EG-NEXT: ALU clause starting at 6:
775 ; EG-NEXT: SETNE_INT * T0.W, KC0[2].Z, 0.0,
776 ; EG-NEXT: PRED_SETE_INT * ExecMask,PredicateBit (MASKED), PV.W, 0.0,
777 ; EG-NEXT: ALU clause starting at 8:
778 ; EG-NEXT: MOV T0.X, KC0[3].Y,
779 ; EG-NEXT: MOV * T1.X, KC0[2].W,
780 ; EG-NEXT: LSHL T0.W, PS, literal.x,
781 ; EG-NEXT: LSHL * T1.W, PV.X, literal.x,
782 ; EG-NEXT: 8(1.121039e-44), 0(0.000000e+00)
783 ; EG-NEXT: ASHR T1.W, PS, literal.x,
784 ; EG-NEXT: ASHR * T0.W, PV.W, literal.x,
785 ; EG-NEXT: 8(1.121039e-44), 0(0.000000e+00)
786 ; EG-NEXT: MOV T2.W, KC0[2].Y,
787 ; EG-NEXT: MULLO_INT * T0.X, PS, PV.W,
788 ; EG-NEXT: LSHR T1.X, PV.W, literal.x,
789 ; EG-NEXT: MOV T0.Y, PS,
790 ; EG-NEXT: MOV T0.W, KC0[3].X,
791 ; EG-NEXT: MOV * T0.W, KC0[3].Z,
792 ; EG-NEXT: 2(2.802597e-45), 0(0.000000e+00)
794 ; CM-LABEL: simplify_i24_crash:
796 ; CM-NEXT: ALU_PUSH_BEFORE 1, @6, KC0[CB0:0-32], KC1[]
797 ; CM-NEXT: JUMP @5 POP:1
798 ; CM-NEXT: ALU 17, @8, KC0[CB0:0-32], KC1[]
799 ; CM-NEXT: MEM_RAT_CACHELESS STORE_DWORD T0, T1.X
800 ; CM-NEXT: POP @5 POP:1
802 ; CM-NEXT: ALU clause starting at 6:
803 ; CM-NEXT: SETNE_INT * T0.W, KC0[2].Z, 0.0,
804 ; CM-NEXT: PRED_SETE_INT * ExecMask,PredicateBit (MASKED), PV.W, 0.0,
805 ; CM-NEXT: ALU clause starting at 8:
806 ; CM-NEXT: MOV * T0.X, KC0[3].Y,
807 ; CM-NEXT: MOV * T1.X, KC0[2].W,
808 ; CM-NEXT: LSHL T0.Z, PV.X, literal.x,
809 ; CM-NEXT: LSHL * T0.W, T0.X, literal.x,
810 ; CM-NEXT: 8(1.121039e-44), 0(0.000000e+00)
811 ; CM-NEXT: MOV T0.Y, KC0[2].Y,
812 ; CM-NEXT: ASHR T1.Z, PV.W, literal.x,
813 ; CM-NEXT: ASHR * T0.W, PV.Z, literal.x,
814 ; CM-NEXT: 8(1.121039e-44), 0(0.000000e+00)
815 ; CM-NEXT: MULLO_INT T0.X, T0.W, T1.Z,
816 ; CM-NEXT: MULLO_INT T0.Y (MASKED), T0.W, T1.Z,
817 ; CM-NEXT: MULLO_INT T0.Z (MASKED), T0.W, T1.Z,
818 ; CM-NEXT: MULLO_INT * T0.W (MASKED), T0.W, T1.Z,
819 ; CM-NEXT: LSHR T1.X, T0.Y, literal.x,
820 ; CM-NEXT: MOV T0.Y, PV.X,
821 ; CM-NEXT: MOV T0.Z, KC0[3].X,
822 ; CM-NEXT: MOV * T0.W, KC0[3].Z,
823 ; CM-NEXT: 2(2.802597e-45), 0(0.000000e+00)
825 %cmp = icmp eq i32 %arg0, 0
826 br i1 %cmp, label %bb11, label %bb7
829 %tmp14 = shufflevector <2 x i32> %arg1, <2 x i32> undef, <2 x i32> zeroinitializer
830 %tmp16 = shufflevector <2 x i32> %arg2, <2 x i32> undef, <2 x i32> zeroinitializer
831 %tmp17 = shl <2 x i32> %tmp14, <i32 8, i32 8>
832 %tmp18 = ashr <2 x i32> %tmp17, <i32 8, i32 8>
833 %tmp19 = shl <2 x i32> %tmp16, <i32 8, i32 8>
834 %tmp20 = ashr <2 x i32> %tmp19, <i32 8, i32 8>
835 %tmp21 = mul <2 x i32> %tmp18, %tmp20
836 store <2 x i32> %tmp21, ptr addrspace(1) %out
843 attributes #0 = { nounwind }