1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=amdgcn -mcpu=gfx700 -verify-machineinstrs < %s | FileCheck -check-prefixes=GFX7 %s
3 ; RUN: llc -mtriple=amdgcn -mcpu=gfx803 -verify-machineinstrs < %s | FileCheck -check-prefixes=GFX8 %s
4 ; RUN: llc -mtriple=amdgcn -mcpu=gfx900 -verify-machineinstrs < %s | FileCheck -check-prefixes=GFX9-NODL %s
5 ; RUN: llc -mtriple=amdgcn -mcpu=gfx906 -verify-machineinstrs < %s | FileCheck -check-prefixes=GFX9-DL %s
6 ; RUN: llc -mtriple=amdgcn -mcpu=gfx1011 -verify-machineinstrs < %s | FileCheck -check-prefixes=GFX10-DL %s
7 ; RUN: llc -mtriple=amdgcn -mcpu=gfx1012 -verify-machineinstrs < %s | FileCheck -check-prefixes=GFX10-DL %s
8 ; RUN: llc -mtriple=amdgcn -mcpu=gfx1100 -verify-machineinstrs < %s | FileCheck -check-prefixes=GFX11-DL %s
10 define amdgpu_kernel void @idot4_acc32(ptr addrspace(1) %src1,
11 ; GFX7-LABEL: idot4_acc32:
12 ; GFX7: ; %bb.0: ; %entry
13 ; GFX7-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x9
14 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0xd
15 ; GFX7-NEXT: s_mov_b32 s3, 0xf000
16 ; GFX7-NEXT: s_mov_b32 s10, 0
17 ; GFX7-NEXT: s_mov_b32 s11, s3
18 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
19 ; GFX7-NEXT: s_mov_b64 s[8:9], s[4:5]
20 ; GFX7-NEXT: v_lshlrev_b32_e32 v0, 2, v0
21 ; GFX7-NEXT: v_mov_b32_e32 v1, 0
22 ; GFX7-NEXT: buffer_load_dword v2, v[0:1], s[8:11], 0 addr64
23 ; GFX7-NEXT: s_mov_b64 s[8:9], s[6:7]
24 ; GFX7-NEXT: buffer_load_dword v0, v[0:1], s[8:11], 0 addr64
25 ; GFX7-NEXT: s_load_dword s4, s[0:1], 0x0
26 ; GFX7-NEXT: s_mov_b32 s2, -1
27 ; GFX7-NEXT: s_waitcnt vmcnt(1)
28 ; GFX7-NEXT: v_bfe_i32 v1, v2, 0, 8
29 ; GFX7-NEXT: v_bfe_i32 v3, v2, 8, 8
30 ; GFX7-NEXT: s_waitcnt vmcnt(0)
31 ; GFX7-NEXT: v_bfe_i32 v5, v0, 0, 8
32 ; GFX7-NEXT: v_bfe_i32 v6, v0, 8, 8
33 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
34 ; GFX7-NEXT: v_mad_i32_i24 v1, v1, v5, s4
35 ; GFX7-NEXT: v_bfe_i32 v4, v2, 16, 8
36 ; GFX7-NEXT: v_bfe_i32 v7, v0, 16, 8
37 ; GFX7-NEXT: v_mad_i32_i24 v1, v3, v6, v1
38 ; GFX7-NEXT: v_ashrrev_i32_e32 v2, 24, v2
39 ; GFX7-NEXT: v_ashrrev_i32_e32 v0, 24, v0
40 ; GFX7-NEXT: v_mad_i32_i24 v1, v4, v7, v1
41 ; GFX7-NEXT: v_mad_i32_i24 v0, v2, v0, v1
42 ; GFX7-NEXT: buffer_store_dword v0, off, s[0:3], 0
45 ; GFX8-LABEL: idot4_acc32:
46 ; GFX8: ; %bb.0: ; %entry
47 ; GFX8-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x24
48 ; GFX8-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x34
49 ; GFX8-NEXT: v_lshlrev_b32_e32 v2, 2, v0
50 ; GFX8-NEXT: s_waitcnt lgkmcnt(0)
51 ; GFX8-NEXT: v_mov_b32_e32 v1, s5
52 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, s4, v2
53 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
54 ; GFX8-NEXT: flat_load_dword v3, v[0:1]
55 ; GFX8-NEXT: v_mov_b32_e32 v1, s7
56 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, s6, v2
57 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
58 ; GFX8-NEXT: flat_load_dword v0, v[0:1]
59 ; GFX8-NEXT: s_load_dword s2, s[0:1], 0x0
60 ; GFX8-NEXT: s_waitcnt vmcnt(1)
61 ; GFX8-NEXT: v_bfe_i32 v1, v3, 0, 8
62 ; GFX8-NEXT: v_bfe_i32 v4, v3, 8, 8
63 ; GFX8-NEXT: v_bfe_i32 v6, v3, 16, 8
64 ; GFX8-NEXT: v_ashrrev_i32_e32 v3, 24, v3
65 ; GFX8-NEXT: s_waitcnt vmcnt(0)
66 ; GFX8-NEXT: v_bfe_i32 v2, v0, 0, 8
67 ; GFX8-NEXT: v_bfe_i32 v5, v0, 8, 8
68 ; GFX8-NEXT: s_waitcnt lgkmcnt(0)
69 ; GFX8-NEXT: v_mad_i32_i24 v1, v1, v2, s2
70 ; GFX8-NEXT: v_bfe_i32 v7, v0, 16, 8
71 ; GFX8-NEXT: v_mad_i32_i24 v1, v4, v5, v1
72 ; GFX8-NEXT: v_ashrrev_i32_e32 v0, 24, v0
73 ; GFX8-NEXT: v_mad_i32_i24 v1, v6, v7, v1
74 ; GFX8-NEXT: v_mad_i32_i24 v2, v3, v0, v1
75 ; GFX8-NEXT: v_mov_b32_e32 v0, s0
76 ; GFX8-NEXT: v_mov_b32_e32 v1, s1
77 ; GFX8-NEXT: flat_store_dword v[0:1], v2
80 ; GFX9-NODL-LABEL: idot4_acc32:
81 ; GFX9-NODL: ; %bb.0: ; %entry
82 ; GFX9-NODL-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x24
83 ; GFX9-NODL-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x34
84 ; GFX9-NODL-NEXT: v_lshlrev_b32_e32 v0, 2, v0
85 ; GFX9-NODL-NEXT: s_waitcnt lgkmcnt(0)
86 ; GFX9-NODL-NEXT: global_load_dword v1, v0, s[4:5]
87 ; GFX9-NODL-NEXT: global_load_dword v2, v0, s[6:7]
88 ; GFX9-NODL-NEXT: s_load_dword s0, s[2:3], 0x0
89 ; GFX9-NODL-NEXT: v_mov_b32_e32 v0, 0
90 ; GFX9-NODL-NEXT: s_waitcnt vmcnt(0)
91 ; GFX9-NODL-NEXT: v_mul_i32_i24_sdwa v3, sext(v1), sext(v2) dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:BYTE_0
92 ; GFX9-NODL-NEXT: v_mul_i32_i24_sdwa v4, sext(v1), sext(v2) dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_1 src1_sel:BYTE_1
93 ; GFX9-NODL-NEXT: v_mul_i32_i24_sdwa v5, sext(v1), sext(v2) dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_2 src1_sel:BYTE_2
94 ; GFX9-NODL-NEXT: v_mul_i32_i24_sdwa v1, sext(v1), sext(v2) dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_3 src1_sel:BYTE_3
95 ; GFX9-NODL-NEXT: s_waitcnt lgkmcnt(0)
96 ; GFX9-NODL-NEXT: v_add3_u32 v2, v3, s0, v4
97 ; GFX9-NODL-NEXT: v_add3_u32 v1, v2, v5, v1
98 ; GFX9-NODL-NEXT: global_store_dword v0, v1, s[2:3]
99 ; GFX9-NODL-NEXT: s_endpgm
101 ; GFX9-DL-LABEL: idot4_acc32:
102 ; GFX9-DL: ; %bb.0: ; %entry
103 ; GFX9-DL-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x24
104 ; GFX9-DL-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x34
105 ; GFX9-DL-NEXT: v_lshlrev_b32_e32 v0, 2, v0
106 ; GFX9-DL-NEXT: s_waitcnt lgkmcnt(0)
107 ; GFX9-DL-NEXT: global_load_dword v1, v0, s[4:5]
108 ; GFX9-DL-NEXT: global_load_dword v2, v0, s[6:7]
109 ; GFX9-DL-NEXT: s_load_dword s0, s[2:3], 0x0
110 ; GFX9-DL-NEXT: v_mov_b32_e32 v0, 0
111 ; GFX9-DL-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
112 ; GFX9-DL-NEXT: v_dot4_i32_i8 v1, v1, v2, s0
113 ; GFX9-DL-NEXT: global_store_dword v0, v1, s[2:3]
114 ; GFX9-DL-NEXT: s_endpgm
116 ; GFX10-DL-LABEL: idot4_acc32:
117 ; GFX10-DL: ; %bb.0: ; %entry
118 ; GFX10-DL-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x24
119 ; GFX10-DL-NEXT: v_lshlrev_b32_e32 v0, 2, v0
120 ; GFX10-DL-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x34
121 ; GFX10-DL-NEXT: v_mov_b32_e32 v3, 0
122 ; GFX10-DL-NEXT: s_waitcnt lgkmcnt(0)
123 ; GFX10-DL-NEXT: s_clause 0x1
124 ; GFX10-DL-NEXT: global_load_dword v1, v0, s[4:5]
125 ; GFX10-DL-NEXT: global_load_dword v2, v0, s[6:7]
126 ; GFX10-DL-NEXT: s_load_dword s2, s[0:1], 0x0
127 ; GFX10-DL-NEXT: s_waitcnt lgkmcnt(0)
128 ; GFX10-DL-NEXT: v_mov_b32_e32 v0, s2
129 ; GFX10-DL-NEXT: s_waitcnt vmcnt(0)
130 ; GFX10-DL-NEXT: v_dot4c_i32_i8_e32 v0, v1, v2
131 ; GFX10-DL-NEXT: global_store_dword v3, v0, s[0:1]
132 ; GFX10-DL-NEXT: s_endpgm
134 ; GFX11-DL-LABEL: idot4_acc32:
135 ; GFX11-DL: ; %bb.0: ; %entry
136 ; GFX11-DL-NEXT: s_load_b128 s[4:7], s[0:1], 0x24
137 ; GFX11-DL-NEXT: v_lshlrev_b32_e32 v0, 2, v0
138 ; GFX11-DL-NEXT: s_load_b64 s[0:1], s[0:1], 0x34
139 ; GFX11-DL-NEXT: v_mov_b32_e32 v2, 0
140 ; GFX11-DL-NEXT: s_waitcnt lgkmcnt(0)
141 ; GFX11-DL-NEXT: s_clause 0x1
142 ; GFX11-DL-NEXT: global_load_b32 v1, v0, s[4:5]
143 ; GFX11-DL-NEXT: global_load_b32 v0, v0, s[6:7]
144 ; GFX11-DL-NEXT: s_load_b32 s2, s[0:1], 0x0
145 ; GFX11-DL-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
146 ; GFX11-DL-NEXT: v_dot4_i32_iu8 v0, v1, v0, s2 neg_lo:[1,1,0]
147 ; GFX11-DL-NEXT: global_store_b32 v2, v0, s[0:1]
148 ; GFX11-DL-NEXT: s_nop 0
149 ; GFX11-DL-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
150 ; GFX11-DL-NEXT: s_endpgm
151 ptr addrspace(1) %src2,
152 ptr addrspace(1) nocapture %dst) {
154 %idx = call i32 @llvm.amdgcn.workitem.id.x()
155 %gep1 = getelementptr <4 x i8>, ptr addrspace(1) %src1, i32 %idx
156 %vec1 = load <4 x i8>, ptr addrspace(1) %gep1
157 %gep2 = getelementptr <4 x i8>, ptr addrspace(1) %src2, i32 %idx
158 %vec2 = load <4 x i8>, ptr addrspace(1) %gep2
160 %v1e0 = extractelement <4 x i8> %vec1, i64 0
161 %cv1e0 = sext i8 %v1e0 to i32
162 %v2e0 = extractelement <4 x i8> %vec2, i64 0
163 %cv2e0 = sext i8 %v2e0 to i32
164 %mul1 = mul nuw nsw i32 %cv1e0, %cv2e0
166 %v1e1 = extractelement <4 x i8> %vec1, i64 1
167 %cv1e1 = sext i8 %v1e1 to i32
168 %v2e1 = extractelement <4 x i8> %vec2, i64 1
169 %cv2e1 = sext i8 %v2e1 to i32
170 %mul2 = mul nuw nsw i32 %cv1e1, %cv2e1
172 %v1e2 = extractelement <4 x i8> %vec1, i64 2
173 %cv1e2 = sext i8 %v1e2 to i32
174 %v2e2 = extractelement <4 x i8> %vec2, i64 2
175 %cv2e2 = sext i8 %v2e2 to i32
176 %mul3 = mul nuw nsw i32 %cv1e2, %cv2e2
178 %v1e3 = extractelement <4 x i8> %vec1, i64 3
179 %cv1e3 = sext i8 %v1e3 to i32
180 %v2e3 = extractelement <4 x i8> %vec2, i64 3
181 %cv2e3 = sext i8 %v2e3 to i32
182 %mul4 = mul nuw nsw i32 %cv1e3, %cv2e3
184 %acc = load i32, ptr addrspace(1) %dst, align 4
185 %add1 = add i32 %mul1, %acc
186 %add2 = add i32 %add1, %mul2
187 %add3 = add i32 %add2, %mul3
188 %add4 = add i32 %add3, %mul4
189 store i32 %add4, ptr addrspace(1) %dst, align 4
193 define amdgpu_kernel void @idot4_acc16(ptr addrspace(1) %src1,
194 ; GFX7-LABEL: idot4_acc16:
195 ; GFX7: ; %bb.0: ; %entry
196 ; GFX7-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x9
197 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0xd
198 ; GFX7-NEXT: s_mov_b32 s3, 0xf000
199 ; GFX7-NEXT: s_mov_b32 s10, 0
200 ; GFX7-NEXT: s_mov_b32 s11, s3
201 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
202 ; GFX7-NEXT: s_mov_b64 s[8:9], s[4:5]
203 ; GFX7-NEXT: v_lshlrev_b32_e32 v0, 2, v0
204 ; GFX7-NEXT: v_mov_b32_e32 v1, 0
205 ; GFX7-NEXT: buffer_load_dword v2, v[0:1], s[8:11], 0 addr64
206 ; GFX7-NEXT: s_mov_b64 s[8:9], s[6:7]
207 ; GFX7-NEXT: buffer_load_dword v0, v[0:1], s[8:11], 0 addr64
208 ; GFX7-NEXT: s_mov_b32 s2, -1
209 ; GFX7-NEXT: buffer_load_ushort v1, off, s[0:3], 0
210 ; GFX7-NEXT: s_waitcnt vmcnt(2)
211 ; GFX7-NEXT: v_bfe_i32 v3, v2, 0, 8
212 ; GFX7-NEXT: v_bfe_i32 v4, v2, 8, 8
213 ; GFX7-NEXT: s_waitcnt vmcnt(1)
214 ; GFX7-NEXT: v_bfe_i32 v6, v0, 0, 8
215 ; GFX7-NEXT: v_and_b32_e32 v3, 0xffff, v3
216 ; GFX7-NEXT: v_bfe_i32 v7, v0, 8, 8
217 ; GFX7-NEXT: v_and_b32_e32 v6, 0xffff, v6
218 ; GFX7-NEXT: v_bfe_i32 v5, v2, 16, 8
219 ; GFX7-NEXT: v_and_b32_e32 v4, 0xffff, v4
220 ; GFX7-NEXT: v_bfe_i32 v8, v0, 16, 8
221 ; GFX7-NEXT: v_and_b32_e32 v7, 0xffff, v7
222 ; GFX7-NEXT: s_waitcnt vmcnt(0)
223 ; GFX7-NEXT: v_mad_u32_u24 v1, v3, v6, v1
224 ; GFX7-NEXT: v_ashrrev_i32_e32 v2, 24, v2
225 ; GFX7-NEXT: v_and_b32_e32 v5, 0xffff, v5
226 ; GFX7-NEXT: v_ashrrev_i32_e32 v0, 24, v0
227 ; GFX7-NEXT: v_and_b32_e32 v8, 0xffff, v8
228 ; GFX7-NEXT: v_mad_u32_u24 v1, v4, v7, v1
229 ; GFX7-NEXT: v_and_b32_e32 v2, 0xffff, v2
230 ; GFX7-NEXT: v_and_b32_e32 v0, 0xffff, v0
231 ; GFX7-NEXT: v_mad_u32_u24 v1, v5, v8, v1
232 ; GFX7-NEXT: v_mad_u32_u24 v0, v2, v0, v1
233 ; GFX7-NEXT: buffer_store_short v0, off, s[0:3], 0
234 ; GFX7-NEXT: s_endpgm
236 ; GFX8-LABEL: idot4_acc16:
237 ; GFX8: ; %bb.0: ; %entry
238 ; GFX8-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x24
239 ; GFX8-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x34
240 ; GFX8-NEXT: v_lshlrev_b32_e32 v2, 2, v0
241 ; GFX8-NEXT: s_waitcnt lgkmcnt(0)
242 ; GFX8-NEXT: v_mov_b32_e32 v1, s5
243 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, s4, v2
244 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
245 ; GFX8-NEXT: flat_load_dword v3, v[0:1]
246 ; GFX8-NEXT: v_mov_b32_e32 v1, s7
247 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, s6, v2
248 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
249 ; GFX8-NEXT: flat_load_dword v2, v[0:1]
250 ; GFX8-NEXT: v_mov_b32_e32 v0, s0
251 ; GFX8-NEXT: v_mov_b32_e32 v1, s1
252 ; GFX8-NEXT: flat_load_ushort v4, v[0:1]
253 ; GFX8-NEXT: s_waitcnt vmcnt(2)
254 ; GFX8-NEXT: v_bfe_i32 v7, v3, 0, 8
255 ; GFX8-NEXT: v_lshrrev_b32_e32 v9, 8, v3
256 ; GFX8-NEXT: v_lshrrev_b32_e32 v5, 16, v3
257 ; GFX8-NEXT: v_bfe_i32 v9, v9, 0, 8
258 ; GFX8-NEXT: v_lshrrev_b32_e32 v3, 24, v3
259 ; GFX8-NEXT: v_bfe_i32 v5, v5, 0, 8
260 ; GFX8-NEXT: s_waitcnt vmcnt(1)
261 ; GFX8-NEXT: v_bfe_i32 v8, v2, 0, 8
262 ; GFX8-NEXT: v_lshrrev_b32_e32 v10, 8, v2
263 ; GFX8-NEXT: v_lshrrev_b32_e32 v6, 16, v2
264 ; GFX8-NEXT: v_bfe_i32 v10, v10, 0, 8
265 ; GFX8-NEXT: s_waitcnt vmcnt(0)
266 ; GFX8-NEXT: v_mad_u16 v4, v7, v8, v4
267 ; GFX8-NEXT: v_lshrrev_b32_e32 v2, 24, v2
268 ; GFX8-NEXT: v_bfe_i32 v6, v6, 0, 8
269 ; GFX8-NEXT: v_mad_u16 v4, v9, v10, v4
270 ; GFX8-NEXT: v_bfe_i32 v3, v3, 0, 8
271 ; GFX8-NEXT: v_bfe_i32 v2, v2, 0, 8
272 ; GFX8-NEXT: v_mad_u16 v4, v5, v6, v4
273 ; GFX8-NEXT: v_mad_u16 v2, v3, v2, v4
274 ; GFX8-NEXT: flat_store_short v[0:1], v2
275 ; GFX8-NEXT: s_endpgm
277 ; GFX9-NODL-LABEL: idot4_acc16:
278 ; GFX9-NODL: ; %bb.0: ; %entry
279 ; GFX9-NODL-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x24
280 ; GFX9-NODL-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x34
281 ; GFX9-NODL-NEXT: v_lshlrev_b32_e32 v0, 2, v0
282 ; GFX9-NODL-NEXT: s_waitcnt lgkmcnt(0)
283 ; GFX9-NODL-NEXT: global_load_dword v1, v0, s[4:5]
284 ; GFX9-NODL-NEXT: global_load_dword v2, v0, s[6:7]
285 ; GFX9-NODL-NEXT: v_mov_b32_e32 v0, 0
286 ; GFX9-NODL-NEXT: global_load_ushort v3, v0, s[2:3]
287 ; GFX9-NODL-NEXT: s_waitcnt vmcnt(2)
288 ; GFX9-NODL-NEXT: v_bfe_i32 v6, v1, 0, 8
289 ; GFX9-NODL-NEXT: s_waitcnt vmcnt(1)
290 ; GFX9-NODL-NEXT: v_bfe_i32 v7, v2, 0, 8
291 ; GFX9-NODL-NEXT: v_lshrrev_b32_e32 v8, 8, v1
292 ; GFX9-NODL-NEXT: v_lshrrev_b32_e32 v9, 8, v2
293 ; GFX9-NODL-NEXT: v_lshrrev_b32_e32 v4, 16, v1
294 ; GFX9-NODL-NEXT: v_lshrrev_b32_e32 v5, 16, v2
295 ; GFX9-NODL-NEXT: v_bfe_i32 v8, v8, 0, 8
296 ; GFX9-NODL-NEXT: v_bfe_i32 v9, v9, 0, 8
297 ; GFX9-NODL-NEXT: s_waitcnt vmcnt(0)
298 ; GFX9-NODL-NEXT: v_mad_legacy_u16 v3, v6, v7, v3
299 ; GFX9-NODL-NEXT: v_lshrrev_b32_e32 v1, 24, v1
300 ; GFX9-NODL-NEXT: v_lshrrev_b32_e32 v2, 24, v2
301 ; GFX9-NODL-NEXT: v_bfe_i32 v4, v4, 0, 8
302 ; GFX9-NODL-NEXT: v_bfe_i32 v5, v5, 0, 8
303 ; GFX9-NODL-NEXT: v_mad_legacy_u16 v3, v8, v9, v3
304 ; GFX9-NODL-NEXT: v_bfe_i32 v1, v1, 0, 8
305 ; GFX9-NODL-NEXT: v_bfe_i32 v2, v2, 0, 8
306 ; GFX9-NODL-NEXT: v_mad_legacy_u16 v3, v4, v5, v3
307 ; GFX9-NODL-NEXT: v_mad_legacy_u16 v1, v1, v2, v3
308 ; GFX9-NODL-NEXT: global_store_short v0, v1, s[2:3]
309 ; GFX9-NODL-NEXT: s_endpgm
311 ; GFX9-DL-LABEL: idot4_acc16:
312 ; GFX9-DL: ; %bb.0: ; %entry
313 ; GFX9-DL-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x24
314 ; GFX9-DL-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x34
315 ; GFX9-DL-NEXT: v_lshlrev_b32_e32 v0, 2, v0
316 ; GFX9-DL-NEXT: v_mov_b32_e32 v1, 0
317 ; GFX9-DL-NEXT: s_waitcnt lgkmcnt(0)
318 ; GFX9-DL-NEXT: global_load_dword v2, v0, s[4:5]
319 ; GFX9-DL-NEXT: global_load_dword v3, v0, s[6:7]
320 ; GFX9-DL-NEXT: global_load_sshort v4, v1, s[2:3]
321 ; GFX9-DL-NEXT: s_waitcnt vmcnt(0)
322 ; GFX9-DL-NEXT: v_dot4_i32_i8 v0, v2, v3, v4
323 ; GFX9-DL-NEXT: global_store_short v1, v0, s[2:3]
324 ; GFX9-DL-NEXT: s_endpgm
326 ; GFX10-DL-LABEL: idot4_acc16:
327 ; GFX10-DL: ; %bb.0: ; %entry
328 ; GFX10-DL-NEXT: s_clause 0x1
329 ; GFX10-DL-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x24
330 ; GFX10-DL-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x34
331 ; GFX10-DL-NEXT: v_lshlrev_b32_e32 v0, 2, v0
332 ; GFX10-DL-NEXT: v_mov_b32_e32 v1, 0
333 ; GFX10-DL-NEXT: s_waitcnt lgkmcnt(0)
334 ; GFX10-DL-NEXT: s_clause 0x1
335 ; GFX10-DL-NEXT: global_load_dword v2, v0, s[4:5]
336 ; GFX10-DL-NEXT: global_load_dword v3, v0, s[6:7]
337 ; GFX10-DL-NEXT: global_load_sshort v4, v1, s[2:3]
338 ; GFX10-DL-NEXT: s_waitcnt vmcnt(0)
339 ; GFX10-DL-NEXT: v_dot4c_i32_i8_e32 v4, v2, v3
340 ; GFX10-DL-NEXT: global_store_short v1, v4, s[2:3]
341 ; GFX10-DL-NEXT: s_endpgm
343 ; GFX11-DL-LABEL: idot4_acc16:
344 ; GFX11-DL: ; %bb.0: ; %entry
345 ; GFX11-DL-NEXT: s_clause 0x1
346 ; GFX11-DL-NEXT: s_load_b128 s[4:7], s[0:1], 0x24
347 ; GFX11-DL-NEXT: s_load_b64 s[0:1], s[0:1], 0x34
348 ; GFX11-DL-NEXT: v_dual_mov_b32 v1, 0 :: v_dual_lshlrev_b32 v0, 2, v0
349 ; GFX11-DL-NEXT: s_waitcnt lgkmcnt(0)
350 ; GFX11-DL-NEXT: s_clause 0x1
351 ; GFX11-DL-NEXT: global_load_b32 v2, v0, s[4:5]
352 ; GFX11-DL-NEXT: global_load_b32 v0, v0, s[6:7]
353 ; GFX11-DL-NEXT: global_load_i16 v3, v1, s[0:1]
354 ; GFX11-DL-NEXT: s_waitcnt vmcnt(0)
355 ; GFX11-DL-NEXT: v_dot4_i32_iu8 v0, v2, v0, v3 neg_lo:[1,1,0]
356 ; GFX11-DL-NEXT: global_store_b16 v1, v0, s[0:1]
357 ; GFX11-DL-NEXT: s_nop 0
358 ; GFX11-DL-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
359 ; GFX11-DL-NEXT: s_endpgm
360 ptr addrspace(1) %src2,
361 ptr addrspace(1) nocapture %dst) {
363 %idx = call i32 @llvm.amdgcn.workitem.id.x()
364 %gep1 = getelementptr <4 x i8>, ptr addrspace(1) %src1, i32 %idx
365 %vec1 = load <4 x i8>, ptr addrspace(1) %gep1
366 %gep2 = getelementptr <4 x i8>, ptr addrspace(1) %src2, i32 %idx
367 %vec2 = load <4 x i8>, ptr addrspace(1) %gep2
369 %v1e0 = extractelement <4 x i8> %vec1, i64 0
370 %cv1e0 = sext i8 %v1e0 to i16
371 %v2e0 = extractelement <4 x i8> %vec2, i64 0
372 %cv2e0 = sext i8 %v2e0 to i16
373 %mul1 = mul nsw i16 %cv1e0, %cv2e0
375 %v1e1 = extractelement <4 x i8> %vec1, i64 1
376 %cv1e1 = sext i8 %v1e1 to i16
377 %v2e1 = extractelement <4 x i8> %vec2, i64 1
378 %cv2e1 = sext i8 %v2e1 to i16
379 %mul2 = mul nsw i16 %cv1e1, %cv2e1
381 %v1e2 = extractelement <4 x i8> %vec1, i64 2
382 %cv1e2 = sext i8 %v1e2 to i16
383 %v2e2 = extractelement <4 x i8> %vec2, i64 2
384 %cv2e2 = sext i8 %v2e2 to i16
385 %mul3 = mul nsw i16 %cv1e2, %cv2e2
387 %v1e3 = extractelement <4 x i8> %vec1, i64 3
388 %cv1e3 = sext i8 %v1e3 to i16
389 %v2e3 = extractelement <4 x i8> %vec2, i64 3
390 %cv2e3 = sext i8 %v2e3 to i16
391 %mul4 = mul nsw i16 %cv1e3, %cv2e3
393 %acc = load i16, ptr addrspace(1) %dst, align 2
394 %add1 = add i16 %mul1, %acc
395 %add2 = add i16 %add1, %mul2
396 %add3 = add i16 %add2, %mul3
397 %add4 = add i16 %add3, %mul4
398 store i16 %add4, ptr addrspace(1) %dst, align 2
402 define amdgpu_kernel void @idot4_acc8(ptr addrspace(1) %src1,
403 ; GFX7-LABEL: idot4_acc8:
404 ; GFX7: ; %bb.0: ; %entry
405 ; GFX7-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x9
406 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0xd
407 ; GFX7-NEXT: s_mov_b32 s3, 0xf000
408 ; GFX7-NEXT: s_mov_b32 s10, 0
409 ; GFX7-NEXT: s_mov_b32 s11, s3
410 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
411 ; GFX7-NEXT: s_mov_b64 s[8:9], s[4:5]
412 ; GFX7-NEXT: v_lshlrev_b32_e32 v0, 2, v0
413 ; GFX7-NEXT: v_mov_b32_e32 v1, 0
414 ; GFX7-NEXT: buffer_load_dword v2, v[0:1], s[8:11], 0 addr64
415 ; GFX7-NEXT: s_mov_b64 s[8:9], s[6:7]
416 ; GFX7-NEXT: buffer_load_dword v0, v[0:1], s[8:11], 0 addr64
417 ; GFX7-NEXT: s_mov_b32 s2, -1
418 ; GFX7-NEXT: buffer_load_ubyte v1, off, s[0:3], 0
419 ; GFX7-NEXT: s_waitcnt vmcnt(2)
420 ; GFX7-NEXT: v_and_b32_e32 v3, 0xff, v2
421 ; GFX7-NEXT: v_bfe_u32 v4, v2, 8, 8
422 ; GFX7-NEXT: s_waitcnt vmcnt(1)
423 ; GFX7-NEXT: v_and_b32_e32 v6, 0xff, v0
424 ; GFX7-NEXT: v_bfe_u32 v7, v0, 8, 8
425 ; GFX7-NEXT: s_waitcnt vmcnt(0)
426 ; GFX7-NEXT: v_mad_u32_u24 v1, v3, v6, v1
427 ; GFX7-NEXT: v_bfe_u32 v5, v2, 16, 8
428 ; GFX7-NEXT: v_bfe_u32 v8, v0, 16, 8
429 ; GFX7-NEXT: v_mad_u32_u24 v1, v4, v7, v1
430 ; GFX7-NEXT: v_lshrrev_b32_e32 v2, 24, v2
431 ; GFX7-NEXT: v_lshrrev_b32_e32 v0, 24, v0
432 ; GFX7-NEXT: v_mad_u32_u24 v1, v5, v8, v1
433 ; GFX7-NEXT: v_mad_u32_u24 v0, v2, v0, v1
434 ; GFX7-NEXT: buffer_store_byte v0, off, s[0:3], 0
435 ; GFX7-NEXT: s_endpgm
437 ; GFX8-LABEL: idot4_acc8:
438 ; GFX8: ; %bb.0: ; %entry
439 ; GFX8-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x24
440 ; GFX8-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x34
441 ; GFX8-NEXT: v_lshlrev_b32_e32 v2, 2, v0
442 ; GFX8-NEXT: s_waitcnt lgkmcnt(0)
443 ; GFX8-NEXT: v_mov_b32_e32 v1, s5
444 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, s4, v2
445 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
446 ; GFX8-NEXT: flat_load_dword v3, v[0:1]
447 ; GFX8-NEXT: v_mov_b32_e32 v1, s7
448 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, s6, v2
449 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
450 ; GFX8-NEXT: flat_load_dword v2, v[0:1]
451 ; GFX8-NEXT: v_mov_b32_e32 v0, s0
452 ; GFX8-NEXT: v_mov_b32_e32 v1, s1
453 ; GFX8-NEXT: flat_load_ubyte v4, v[0:1]
454 ; GFX8-NEXT: s_waitcnt vmcnt(2)
455 ; GFX8-NEXT: v_lshrrev_b32_e32 v7, 8, v3
456 ; GFX8-NEXT: v_lshrrev_b32_e32 v5, 16, v3
457 ; GFX8-NEXT: v_lshrrev_b32_e32 v9, 24, v3
458 ; GFX8-NEXT: s_waitcnt vmcnt(1)
459 ; GFX8-NEXT: v_lshrrev_b32_e32 v6, 16, v2
460 ; GFX8-NEXT: v_lshrrev_b32_e32 v8, 8, v2
461 ; GFX8-NEXT: v_lshrrev_b32_e32 v10, 24, v2
462 ; GFX8-NEXT: s_waitcnt vmcnt(0)
463 ; GFX8-NEXT: v_mad_u16 v2, v3, v2, v4
464 ; GFX8-NEXT: v_mad_u16 v2, v7, v8, v2
465 ; GFX8-NEXT: v_mad_u16 v2, v5, v6, v2
466 ; GFX8-NEXT: v_mad_u16 v2, v9, v10, v2
467 ; GFX8-NEXT: flat_store_byte v[0:1], v2
468 ; GFX8-NEXT: s_endpgm
470 ; GFX9-NODL-LABEL: idot4_acc8:
471 ; GFX9-NODL: ; %bb.0: ; %entry
472 ; GFX9-NODL-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x24
473 ; GFX9-NODL-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x34
474 ; GFX9-NODL-NEXT: v_lshlrev_b32_e32 v0, 2, v0
475 ; GFX9-NODL-NEXT: s_waitcnt lgkmcnt(0)
476 ; GFX9-NODL-NEXT: global_load_dword v1, v0, s[4:5]
477 ; GFX9-NODL-NEXT: global_load_dword v2, v0, s[6:7]
478 ; GFX9-NODL-NEXT: v_mov_b32_e32 v0, 0
479 ; GFX9-NODL-NEXT: global_load_ubyte v3, v0, s[2:3]
480 ; GFX9-NODL-NEXT: s_waitcnt vmcnt(2)
481 ; GFX9-NODL-NEXT: v_lshrrev_b32_e32 v4, 16, v1
482 ; GFX9-NODL-NEXT: v_lshrrev_b32_e32 v6, 8, v1
483 ; GFX9-NODL-NEXT: s_waitcnt vmcnt(1)
484 ; GFX9-NODL-NEXT: v_lshrrev_b32_e32 v7, 8, v2
485 ; GFX9-NODL-NEXT: v_lshrrev_b32_e32 v8, 24, v1
486 ; GFX9-NODL-NEXT: s_waitcnt vmcnt(0)
487 ; GFX9-NODL-NEXT: v_mad_legacy_u16 v1, v1, v2, v3
488 ; GFX9-NODL-NEXT: v_lshrrev_b32_e32 v5, 16, v2
489 ; GFX9-NODL-NEXT: v_mad_legacy_u16 v1, v6, v7, v1
490 ; GFX9-NODL-NEXT: v_lshrrev_b32_e32 v9, 24, v2
491 ; GFX9-NODL-NEXT: v_mad_legacy_u16 v1, v4, v5, v1
492 ; GFX9-NODL-NEXT: v_mad_legacy_u16 v1, v8, v9, v1
493 ; GFX9-NODL-NEXT: global_store_byte v0, v1, s[2:3]
494 ; GFX9-NODL-NEXT: s_endpgm
496 ; GFX9-DL-LABEL: idot4_acc8:
497 ; GFX9-DL: ; %bb.0: ; %entry
498 ; GFX9-DL-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x24
499 ; GFX9-DL-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x34
500 ; GFX9-DL-NEXT: v_lshlrev_b32_e32 v0, 2, v0
501 ; GFX9-DL-NEXT: v_mov_b32_e32 v1, 0
502 ; GFX9-DL-NEXT: s_waitcnt lgkmcnt(0)
503 ; GFX9-DL-NEXT: global_load_dword v2, v0, s[4:5]
504 ; GFX9-DL-NEXT: global_load_dword v3, v0, s[6:7]
505 ; GFX9-DL-NEXT: global_load_ubyte v4, v1, s[2:3]
506 ; GFX9-DL-NEXT: s_waitcnt vmcnt(0)
507 ; GFX9-DL-NEXT: v_dot4_u32_u8 v0, v2, v3, v4
508 ; GFX9-DL-NEXT: global_store_byte v1, v0, s[2:3]
509 ; GFX9-DL-NEXT: s_endpgm
511 ; GFX10-DL-LABEL: idot4_acc8:
512 ; GFX10-DL: ; %bb.0: ; %entry
513 ; GFX10-DL-NEXT: s_clause 0x1
514 ; GFX10-DL-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x24
515 ; GFX10-DL-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x34
516 ; GFX10-DL-NEXT: v_lshlrev_b32_e32 v0, 2, v0
517 ; GFX10-DL-NEXT: v_mov_b32_e32 v1, 0
518 ; GFX10-DL-NEXT: s_waitcnt lgkmcnt(0)
519 ; GFX10-DL-NEXT: s_clause 0x1
520 ; GFX10-DL-NEXT: global_load_dword v2, v0, s[4:5]
521 ; GFX10-DL-NEXT: global_load_dword v3, v0, s[6:7]
522 ; GFX10-DL-NEXT: global_load_ubyte v4, v1, s[2:3]
523 ; GFX10-DL-NEXT: s_waitcnt vmcnt(0)
524 ; GFX10-DL-NEXT: v_dot4_u32_u8 v0, v2, v3, v4
525 ; GFX10-DL-NEXT: global_store_byte v1, v0, s[2:3]
526 ; GFX10-DL-NEXT: s_endpgm
528 ; GFX11-DL-LABEL: idot4_acc8:
529 ; GFX11-DL: ; %bb.0: ; %entry
530 ; GFX11-DL-NEXT: s_clause 0x1
531 ; GFX11-DL-NEXT: s_load_b128 s[4:7], s[0:1], 0x24
532 ; GFX11-DL-NEXT: s_load_b64 s[0:1], s[0:1], 0x34
533 ; GFX11-DL-NEXT: v_dual_mov_b32 v1, 0 :: v_dual_lshlrev_b32 v0, 2, v0
534 ; GFX11-DL-NEXT: s_waitcnt lgkmcnt(0)
535 ; GFX11-DL-NEXT: s_clause 0x1
536 ; GFX11-DL-NEXT: global_load_b32 v2, v0, s[4:5]
537 ; GFX11-DL-NEXT: global_load_b32 v0, v0, s[6:7]
538 ; GFX11-DL-NEXT: global_load_u8 v3, v1, s[0:1]
539 ; GFX11-DL-NEXT: s_waitcnt vmcnt(0)
540 ; GFX11-DL-NEXT: v_dot4_u32_u8 v0, v2, v0, v3
541 ; GFX11-DL-NEXT: global_store_b8 v1, v0, s[0:1]
542 ; GFX11-DL-NEXT: s_nop 0
543 ; GFX11-DL-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
544 ; GFX11-DL-NEXT: s_endpgm
545 ptr addrspace(1) %src2,
546 ptr addrspace(1) nocapture %dst) {
548 %idx = call i32 @llvm.amdgcn.workitem.id.x()
549 %gep1 = getelementptr <4 x i8>, ptr addrspace(1) %src1, i32 %idx
550 %vec1 = load <4 x i8>, ptr addrspace(1) %gep1
551 %gep2 = getelementptr <4 x i8>, ptr addrspace(1) %src2, i32 %idx
552 %vec2 = load <4 x i8>, ptr addrspace(1) %gep2
554 %v1e0 = extractelement <4 x i8> %vec1, i64 0
555 %v2e0 = extractelement <4 x i8> %vec2, i64 0
556 %mul1 = mul i8 %v1e0, %v2e0
558 %v1e1 = extractelement <4 x i8> %vec1, i64 1
559 %v2e1 = extractelement <4 x i8> %vec2, i64 1
560 %mul2 = mul i8 %v1e1, %v2e1
562 %v1e2 = extractelement <4 x i8> %vec1, i64 2
563 %v2e2 = extractelement <4 x i8> %vec2, i64 2
564 %mul3 = mul i8 %v1e2, %v2e2
566 %v1e3 = extractelement <4 x i8> %vec1, i64 3
567 %v2e3 = extractelement <4 x i8> %vec2, i64 3
568 %mul4 = mul i8 %v1e3, %v2e3
570 %acc = load i8, ptr addrspace(1) %dst, align 2
571 %add1 = add i8 %mul1, %acc
572 %add2 = add i8 %add1, %mul2
573 %add3 = add i8 %add2, %mul3
574 %add4 = add nsw i8 %add3, %mul4
575 store i8 %add4, ptr addrspace(1) %dst, align 2
579 define amdgpu_kernel void @idot4_multiuse_mul1(ptr addrspace(1) %src1,
580 ; GFX7-LABEL: idot4_multiuse_mul1:
581 ; GFX7: ; %bb.0: ; %entry
582 ; GFX7-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x9
583 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0xd
584 ; GFX7-NEXT: s_mov_b32 s3, 0xf000
585 ; GFX7-NEXT: s_mov_b32 s10, 0
586 ; GFX7-NEXT: s_mov_b32 s11, s3
587 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
588 ; GFX7-NEXT: s_mov_b64 s[8:9], s[4:5]
589 ; GFX7-NEXT: v_lshlrev_b32_e32 v0, 2, v0
590 ; GFX7-NEXT: v_mov_b32_e32 v1, 0
591 ; GFX7-NEXT: buffer_load_dword v2, v[0:1], s[8:11], 0 addr64
592 ; GFX7-NEXT: s_mov_b64 s[8:9], s[6:7]
593 ; GFX7-NEXT: buffer_load_dword v0, v[0:1], s[8:11], 0 addr64
594 ; GFX7-NEXT: s_load_dword s4, s[0:1], 0x0
595 ; GFX7-NEXT: s_mov_b32 s2, -1
596 ; GFX7-NEXT: s_waitcnt vmcnt(1)
597 ; GFX7-NEXT: v_bfe_i32 v1, v2, 0, 8
598 ; GFX7-NEXT: v_bfe_i32 v3, v2, 8, 8
599 ; GFX7-NEXT: s_waitcnt vmcnt(0)
600 ; GFX7-NEXT: v_bfe_i32 v5, v0, 0, 8
601 ; GFX7-NEXT: v_bfe_i32 v6, v0, 8, 8
602 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
603 ; GFX7-NEXT: v_mad_i32_i24 v8, v1, v5, s4
604 ; GFX7-NEXT: v_mad_i32_i24 v3, v3, v6, v8
605 ; GFX7-NEXT: v_bfe_i32 v4, v2, 16, 8
606 ; GFX7-NEXT: v_bfe_i32 v7, v0, 16, 8
607 ; GFX7-NEXT: v_mad_i32_i24 v1, v1, v5, v3
608 ; GFX7-NEXT: v_ashrrev_i32_e32 v2, 24, v2
609 ; GFX7-NEXT: v_ashrrev_i32_e32 v0, 24, v0
610 ; GFX7-NEXT: v_mad_i32_i24 v1, v4, v7, v1
611 ; GFX7-NEXT: v_mad_i32_i24 v0, v2, v0, v1
612 ; GFX7-NEXT: buffer_store_dword v0, off, s[0:3], 0
613 ; GFX7-NEXT: s_endpgm
615 ; GFX8-LABEL: idot4_multiuse_mul1:
616 ; GFX8: ; %bb.0: ; %entry
617 ; GFX8-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x24
618 ; GFX8-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x34
619 ; GFX8-NEXT: v_lshlrev_b32_e32 v2, 2, v0
620 ; GFX8-NEXT: s_waitcnt lgkmcnt(0)
621 ; GFX8-NEXT: v_mov_b32_e32 v1, s5
622 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, s4, v2
623 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
624 ; GFX8-NEXT: flat_load_dword v3, v[0:1]
625 ; GFX8-NEXT: v_mov_b32_e32 v1, s7
626 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, s6, v2
627 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
628 ; GFX8-NEXT: flat_load_dword v0, v[0:1]
629 ; GFX8-NEXT: s_load_dword s2, s[0:1], 0x0
630 ; GFX8-NEXT: s_waitcnt vmcnt(1)
631 ; GFX8-NEXT: v_bfe_i32 v1, v3, 0, 8
632 ; GFX8-NEXT: v_bfe_i32 v4, v3, 8, 8
633 ; GFX8-NEXT: v_bfe_i32 v6, v3, 16, 8
634 ; GFX8-NEXT: v_ashrrev_i32_e32 v3, 24, v3
635 ; GFX8-NEXT: s_waitcnt vmcnt(0)
636 ; GFX8-NEXT: v_bfe_i32 v2, v0, 0, 8
637 ; GFX8-NEXT: v_bfe_i32 v5, v0, 8, 8
638 ; GFX8-NEXT: s_waitcnt lgkmcnt(0)
639 ; GFX8-NEXT: v_mad_i32_i24 v8, v1, v2, s2
640 ; GFX8-NEXT: v_mad_i32_i24 v4, v4, v5, v8
641 ; GFX8-NEXT: v_bfe_i32 v7, v0, 16, 8
642 ; GFX8-NEXT: v_mad_i32_i24 v1, v1, v2, v4
643 ; GFX8-NEXT: v_ashrrev_i32_e32 v0, 24, v0
644 ; GFX8-NEXT: v_mad_i32_i24 v1, v6, v7, v1
645 ; GFX8-NEXT: v_mad_i32_i24 v2, v3, v0, v1
646 ; GFX8-NEXT: v_mov_b32_e32 v0, s0
647 ; GFX8-NEXT: v_mov_b32_e32 v1, s1
648 ; GFX8-NEXT: flat_store_dword v[0:1], v2
649 ; GFX8-NEXT: s_endpgm
651 ; GFX9-NODL-LABEL: idot4_multiuse_mul1:
652 ; GFX9-NODL: ; %bb.0: ; %entry
653 ; GFX9-NODL-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x24
654 ; GFX9-NODL-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x34
655 ; GFX9-NODL-NEXT: v_lshlrev_b32_e32 v0, 2, v0
656 ; GFX9-NODL-NEXT: s_waitcnt lgkmcnt(0)
657 ; GFX9-NODL-NEXT: global_load_dword v1, v0, s[4:5]
658 ; GFX9-NODL-NEXT: global_load_dword v2, v0, s[6:7]
659 ; GFX9-NODL-NEXT: s_load_dword s0, s[2:3], 0x0
660 ; GFX9-NODL-NEXT: v_mov_b32_e32 v0, 0
661 ; GFX9-NODL-NEXT: s_waitcnt vmcnt(1)
662 ; GFX9-NODL-NEXT: v_bfe_i32 v3, v1, 0, 8
663 ; GFX9-NODL-NEXT: s_waitcnt vmcnt(0)
664 ; GFX9-NODL-NEXT: v_bfe_i32 v4, v2, 0, 8
665 ; GFX9-NODL-NEXT: v_mul_i32_i24_sdwa v5, sext(v1), sext(v2) dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_1 src1_sel:BYTE_1
666 ; GFX9-NODL-NEXT: v_mul_i32_i24_sdwa v6, sext(v1), sext(v2) dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_2 src1_sel:BYTE_2
667 ; GFX9-NODL-NEXT: v_mul_i32_i24_sdwa v1, sext(v1), sext(v2) dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_3 src1_sel:BYTE_3
668 ; GFX9-NODL-NEXT: v_mul_i32_i24_e32 v2, v3, v4
669 ; GFX9-NODL-NEXT: s_waitcnt lgkmcnt(0)
670 ; GFX9-NODL-NEXT: v_mad_i32_i24 v3, v3, v4, s0
671 ; GFX9-NODL-NEXT: v_add3_u32 v2, v5, v3, v2
672 ; GFX9-NODL-NEXT: v_add3_u32 v1, v2, v6, v1
673 ; GFX9-NODL-NEXT: global_store_dword v0, v1, s[2:3]
674 ; GFX9-NODL-NEXT: s_endpgm
676 ; GFX9-DL-LABEL: idot4_multiuse_mul1:
677 ; GFX9-DL: ; %bb.0: ; %entry
678 ; GFX9-DL-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x24
679 ; GFX9-DL-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x34
680 ; GFX9-DL-NEXT: v_lshlrev_b32_e32 v0, 2, v0
681 ; GFX9-DL-NEXT: s_waitcnt lgkmcnt(0)
682 ; GFX9-DL-NEXT: global_load_dword v1, v0, s[4:5]
683 ; GFX9-DL-NEXT: global_load_dword v2, v0, s[6:7]
684 ; GFX9-DL-NEXT: s_load_dword s0, s[2:3], 0x0
685 ; GFX9-DL-NEXT: v_mov_b32_e32 v0, 0
686 ; GFX9-DL-NEXT: s_waitcnt vmcnt(1)
687 ; GFX9-DL-NEXT: v_bfe_i32 v3, v1, 0, 8
688 ; GFX9-DL-NEXT: s_waitcnt vmcnt(0)
689 ; GFX9-DL-NEXT: v_bfe_i32 v4, v2, 0, 8
690 ; GFX9-DL-NEXT: s_waitcnt lgkmcnt(0)
691 ; GFX9-DL-NEXT: v_mad_i32_i24 v3, v3, v4, s0
692 ; GFX9-DL-NEXT: v_dot4_i32_i8 v1, v1, v2, v3
693 ; GFX9-DL-NEXT: global_store_dword v0, v1, s[2:3]
694 ; GFX9-DL-NEXT: s_endpgm
696 ; GFX10-DL-LABEL: idot4_multiuse_mul1:
697 ; GFX10-DL: ; %bb.0: ; %entry
698 ; GFX10-DL-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x24
699 ; GFX10-DL-NEXT: v_lshlrev_b32_e32 v0, 2, v0
700 ; GFX10-DL-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x34
701 ; GFX10-DL-NEXT: s_waitcnt lgkmcnt(0)
702 ; GFX10-DL-NEXT: s_clause 0x1
703 ; GFX10-DL-NEXT: global_load_dword v1, v0, s[4:5]
704 ; GFX10-DL-NEXT: global_load_dword v2, v0, s[6:7]
705 ; GFX10-DL-NEXT: s_load_dword s2, s[0:1], 0x0
706 ; GFX10-DL-NEXT: s_waitcnt vmcnt(1)
707 ; GFX10-DL-NEXT: v_bfe_i32 v0, v1, 0, 8
708 ; GFX10-DL-NEXT: s_waitcnt vmcnt(0)
709 ; GFX10-DL-NEXT: v_bfe_i32 v3, v2, 0, 8
710 ; GFX10-DL-NEXT: s_waitcnt lgkmcnt(0)
711 ; GFX10-DL-NEXT: v_mad_i32_i24 v0, v0, v3, s2
712 ; GFX10-DL-NEXT: v_mov_b32_e32 v3, 0
713 ; GFX10-DL-NEXT: v_dot4c_i32_i8_e32 v0, v1, v2
714 ; GFX10-DL-NEXT: global_store_dword v3, v0, s[0:1]
715 ; GFX10-DL-NEXT: s_endpgm
717 ; GFX11-DL-LABEL: idot4_multiuse_mul1:
718 ; GFX11-DL: ; %bb.0: ; %entry
719 ; GFX11-DL-NEXT: s_load_b128 s[4:7], s[0:1], 0x24
720 ; GFX11-DL-NEXT: v_lshlrev_b32_e32 v0, 2, v0
721 ; GFX11-DL-NEXT: s_load_b64 s[0:1], s[0:1], 0x34
722 ; GFX11-DL-NEXT: s_waitcnt lgkmcnt(0)
723 ; GFX11-DL-NEXT: s_clause 0x1
724 ; GFX11-DL-NEXT: global_load_b32 v1, v0, s[4:5]
725 ; GFX11-DL-NEXT: global_load_b32 v0, v0, s[6:7]
726 ; GFX11-DL-NEXT: s_load_b32 s2, s[0:1], 0x0
727 ; GFX11-DL-NEXT: s_waitcnt vmcnt(1)
728 ; GFX11-DL-NEXT: v_bfe_i32 v2, v1, 0, 8
729 ; GFX11-DL-NEXT: s_waitcnt vmcnt(0)
730 ; GFX11-DL-NEXT: v_bfe_i32 v3, v0, 0, 8
731 ; GFX11-DL-NEXT: s_waitcnt lgkmcnt(0)
732 ; GFX11-DL-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
733 ; GFX11-DL-NEXT: v_mad_i32_i24 v2, v2, v3, s2
734 ; GFX11-DL-NEXT: v_mov_b32_e32 v3, 0
735 ; GFX11-DL-NEXT: v_dot4_i32_iu8 v0, v1, v0, v2 neg_lo:[1,1,0]
736 ; GFX11-DL-NEXT: global_store_b32 v3, v0, s[0:1]
737 ; GFX11-DL-NEXT: s_nop 0
738 ; GFX11-DL-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
739 ; GFX11-DL-NEXT: s_endpgm
740 ptr addrspace(1) %src2,
741 ptr addrspace(1) nocapture %dst) {
743 %idx = call i32 @llvm.amdgcn.workitem.id.x()
744 %gep1 = getelementptr <4 x i8>, ptr addrspace(1) %src1, i32 %idx
745 %vec1 = load <4 x i8>, ptr addrspace(1) %gep1
746 %gep2 = getelementptr <4 x i8>, ptr addrspace(1) %src2, i32 %idx
747 %vec2 = load <4 x i8>, ptr addrspace(1) %gep2
749 %v1e0 = extractelement <4 x i8> %vec1, i64 0
750 %cv1e0 = sext i8 %v1e0 to i32
751 %v2e0 = extractelement <4 x i8> %vec2, i64 0
752 %cv2e0 = sext i8 %v2e0 to i32
753 %mul1 = mul nuw nsw i32 %cv1e0, %cv2e0
755 %v1e1 = extractelement <4 x i8> %vec1, i64 1
756 %cv1e1 = sext i8 %v1e1 to i32
757 %v2e1 = extractelement <4 x i8> %vec2, i64 1
758 %cv2e1 = sext i8 %v2e1 to i32
759 %mul2 = mul nuw nsw i32 %cv1e1, %cv2e1
761 %v1e2 = extractelement <4 x i8> %vec1, i64 2
762 %cv1e2 = sext i8 %v1e2 to i32
763 %v2e2 = extractelement <4 x i8> %vec2, i64 2
764 %cv2e2 = sext i8 %v2e2 to i32
765 %mul3 = mul nuw nsw i32 %cv1e2, %cv2e2
767 %v1e3 = extractelement <4 x i8> %vec1, i64 3
768 %cv1e3 = sext i8 %v1e3 to i32
769 %v2e3 = extractelement <4 x i8> %vec2, i64 3
770 %cv2e3 = sext i8 %v2e3 to i32
771 %mul4 = mul nuw nsw i32 %cv1e3, %cv2e3
773 %acc = load i32, ptr addrspace(1) %dst, align 4
774 %add = add i32 %mul1, %acc
775 %add1 = add i32 %mul2, %add
776 %add2 = add i32 %add1, %mul1
777 %add3 = add i32 %add2, %mul3
778 %add4 = add i32 %add3, %mul4
780 store i32 %add4, ptr addrspace(1) %dst, align 4
784 define amdgpu_kernel void @idot4_acc32_vecMul(ptr addrspace(1) %src1,
785 ; GFX7-LABEL: idot4_acc32_vecMul:
786 ; GFX7: ; %bb.0: ; %entry
787 ; GFX7-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x9
788 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0xd
789 ; GFX7-NEXT: s_mov_b32 s3, 0xf000
790 ; GFX7-NEXT: s_mov_b32 s10, 0
791 ; GFX7-NEXT: s_mov_b32 s11, s3
792 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
793 ; GFX7-NEXT: s_mov_b64 s[8:9], s[4:5]
794 ; GFX7-NEXT: v_lshlrev_b32_e32 v0, 2, v0
795 ; GFX7-NEXT: v_mov_b32_e32 v1, 0
796 ; GFX7-NEXT: buffer_load_dword v2, v[0:1], s[8:11], 0 addr64
797 ; GFX7-NEXT: s_mov_b64 s[8:9], s[6:7]
798 ; GFX7-NEXT: buffer_load_dword v0, v[0:1], s[8:11], 0 addr64
799 ; GFX7-NEXT: s_load_dword s4, s[0:1], 0x0
800 ; GFX7-NEXT: s_mov_b32 s2, -1
801 ; GFX7-NEXT: s_waitcnt vmcnt(1)
802 ; GFX7-NEXT: v_ashrrev_i32_e32 v1, 24, v2
803 ; GFX7-NEXT: v_bfe_i32 v3, v2, 16, 8
804 ; GFX7-NEXT: v_bfe_i32 v4, v2, 8, 8
805 ; GFX7-NEXT: v_bfe_i32 v2, v2, 0, 8
806 ; GFX7-NEXT: s_waitcnt vmcnt(0)
807 ; GFX7-NEXT: v_ashrrev_i32_e32 v5, 24, v0
808 ; GFX7-NEXT: v_bfe_i32 v6, v0, 16, 8
809 ; GFX7-NEXT: v_bfe_i32 v7, v0, 8, 8
810 ; GFX7-NEXT: v_bfe_i32 v0, v0, 0, 8
811 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
812 ; GFX7-NEXT: v_mad_i32_i24 v0, v2, v0, s4
813 ; GFX7-NEXT: v_mad_i32_i24 v0, v4, v7, v0
814 ; GFX7-NEXT: v_mad_i32_i24 v0, v3, v6, v0
815 ; GFX7-NEXT: v_mad_i32_i24 v0, v1, v5, v0
816 ; GFX7-NEXT: buffer_store_dword v0, off, s[0:3], 0
817 ; GFX7-NEXT: s_endpgm
819 ; GFX8-LABEL: idot4_acc32_vecMul:
820 ; GFX8: ; %bb.0: ; %entry
821 ; GFX8-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x24
822 ; GFX8-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x34
823 ; GFX8-NEXT: v_lshlrev_b32_e32 v2, 2, v0
824 ; GFX8-NEXT: s_waitcnt lgkmcnt(0)
825 ; GFX8-NEXT: v_mov_b32_e32 v1, s5
826 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, s4, v2
827 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
828 ; GFX8-NEXT: flat_load_dword v3, v[0:1]
829 ; GFX8-NEXT: v_mov_b32_e32 v1, s7
830 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, s6, v2
831 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
832 ; GFX8-NEXT: flat_load_dword v0, v[0:1]
833 ; GFX8-NEXT: s_load_dword s2, s[0:1], 0x0
834 ; GFX8-NEXT: s_waitcnt vmcnt(1)
835 ; GFX8-NEXT: v_lshrrev_b16_e32 v1, 8, v3
836 ; GFX8-NEXT: v_ashrrev_i32_e32 v4, 24, v3
837 ; GFX8-NEXT: v_bfe_i32 v5, v3, 16, 8
838 ; GFX8-NEXT: v_bfe_i32 v3, v3, 0, 8
839 ; GFX8-NEXT: v_bfe_i32 v1, v1, 0, 8
840 ; GFX8-NEXT: s_waitcnt vmcnt(0)
841 ; GFX8-NEXT: v_lshrrev_b16_e32 v2, 8, v0
842 ; GFX8-NEXT: v_ashrrev_i32_e32 v6, 24, v0
843 ; GFX8-NEXT: v_bfe_i32 v7, v0, 16, 8
844 ; GFX8-NEXT: v_bfe_i32 v0, v0, 0, 8
845 ; GFX8-NEXT: v_bfe_i32 v2, v2, 0, 8
846 ; GFX8-NEXT: s_waitcnt lgkmcnt(0)
847 ; GFX8-NEXT: v_mad_i32_i24 v0, v3, v0, s2
848 ; GFX8-NEXT: v_mad_i32_i24 v0, v1, v2, v0
849 ; GFX8-NEXT: v_mad_i32_i24 v0, v5, v7, v0
850 ; GFX8-NEXT: v_mad_i32_i24 v2, v4, v6, v0
851 ; GFX8-NEXT: v_mov_b32_e32 v0, s0
852 ; GFX8-NEXT: v_mov_b32_e32 v1, s1
853 ; GFX8-NEXT: flat_store_dword v[0:1], v2
854 ; GFX8-NEXT: s_endpgm
856 ; GFX9-NODL-LABEL: idot4_acc32_vecMul:
857 ; GFX9-NODL: ; %bb.0: ; %entry
858 ; GFX9-NODL-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x24
859 ; GFX9-NODL-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x34
860 ; GFX9-NODL-NEXT: v_lshlrev_b32_e32 v0, 2, v0
861 ; GFX9-NODL-NEXT: s_waitcnt lgkmcnt(0)
862 ; GFX9-NODL-NEXT: global_load_dword v1, v0, s[4:5]
863 ; GFX9-NODL-NEXT: global_load_dword v2, v0, s[6:7]
864 ; GFX9-NODL-NEXT: s_load_dword s0, s[2:3], 0x0
865 ; GFX9-NODL-NEXT: v_mov_b32_e32 v0, 0
866 ; GFX9-NODL-NEXT: s_waitcnt vmcnt(1)
867 ; GFX9-NODL-NEXT: v_lshrrev_b16_e32 v3, 8, v1
868 ; GFX9-NODL-NEXT: s_waitcnt vmcnt(0)
869 ; GFX9-NODL-NEXT: v_lshrrev_b16_e32 v4, 8, v2
870 ; GFX9-NODL-NEXT: v_mul_i32_i24_sdwa v5, sext(v1), sext(v2) dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:BYTE_0
871 ; GFX9-NODL-NEXT: v_mul_i32_i24_sdwa v3, sext(v3), sext(v4) dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:BYTE_0
872 ; GFX9-NODL-NEXT: v_mul_i32_i24_sdwa v6, sext(v1), sext(v2) dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_2 src1_sel:BYTE_2
873 ; GFX9-NODL-NEXT: v_mul_i32_i24_sdwa v1, sext(v1), sext(v2) dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_3 src1_sel:BYTE_3
874 ; GFX9-NODL-NEXT: s_waitcnt lgkmcnt(0)
875 ; GFX9-NODL-NEXT: v_add3_u32 v2, v5, s0, v3
876 ; GFX9-NODL-NEXT: v_add3_u32 v1, v2, v6, v1
877 ; GFX9-NODL-NEXT: global_store_dword v0, v1, s[2:3]
878 ; GFX9-NODL-NEXT: s_endpgm
880 ; GFX9-DL-LABEL: idot4_acc32_vecMul:
881 ; GFX9-DL: ; %bb.0: ; %entry
882 ; GFX9-DL-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x24
883 ; GFX9-DL-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x34
884 ; GFX9-DL-NEXT: v_lshlrev_b32_e32 v0, 2, v0
885 ; GFX9-DL-NEXT: s_waitcnt lgkmcnt(0)
886 ; GFX9-DL-NEXT: global_load_dword v1, v0, s[4:5]
887 ; GFX9-DL-NEXT: global_load_dword v2, v0, s[6:7]
888 ; GFX9-DL-NEXT: s_load_dword s0, s[2:3], 0x0
889 ; GFX9-DL-NEXT: v_mov_b32_e32 v0, 0
890 ; GFX9-DL-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
891 ; GFX9-DL-NEXT: v_dot4_i32_i8 v1, v1, v2, s0
892 ; GFX9-DL-NEXT: global_store_dword v0, v1, s[2:3]
893 ; GFX9-DL-NEXT: s_endpgm
895 ; GFX10-DL-LABEL: idot4_acc32_vecMul:
896 ; GFX10-DL: ; %bb.0: ; %entry
897 ; GFX10-DL-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x24
898 ; GFX10-DL-NEXT: v_lshlrev_b32_e32 v0, 2, v0
899 ; GFX10-DL-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x34
900 ; GFX10-DL-NEXT: v_mov_b32_e32 v3, 0
901 ; GFX10-DL-NEXT: s_waitcnt lgkmcnt(0)
902 ; GFX10-DL-NEXT: s_clause 0x1
903 ; GFX10-DL-NEXT: global_load_dword v1, v0, s[4:5]
904 ; GFX10-DL-NEXT: global_load_dword v2, v0, s[6:7]
905 ; GFX10-DL-NEXT: s_load_dword s2, s[0:1], 0x0
906 ; GFX10-DL-NEXT: s_waitcnt lgkmcnt(0)
907 ; GFX10-DL-NEXT: v_mov_b32_e32 v0, s2
908 ; GFX10-DL-NEXT: s_waitcnt vmcnt(0)
909 ; GFX10-DL-NEXT: v_dot4c_i32_i8_e32 v0, v1, v2
910 ; GFX10-DL-NEXT: global_store_dword v3, v0, s[0:1]
911 ; GFX10-DL-NEXT: s_endpgm
913 ; GFX11-DL-LABEL: idot4_acc32_vecMul:
914 ; GFX11-DL: ; %bb.0: ; %entry
915 ; GFX11-DL-NEXT: s_load_b128 s[4:7], s[0:1], 0x24
916 ; GFX11-DL-NEXT: v_lshlrev_b32_e32 v0, 2, v0
917 ; GFX11-DL-NEXT: s_load_b64 s[0:1], s[0:1], 0x34
918 ; GFX11-DL-NEXT: v_mov_b32_e32 v2, 0
919 ; GFX11-DL-NEXT: s_waitcnt lgkmcnt(0)
920 ; GFX11-DL-NEXT: s_clause 0x1
921 ; GFX11-DL-NEXT: global_load_b32 v1, v0, s[4:5]
922 ; GFX11-DL-NEXT: global_load_b32 v0, v0, s[6:7]
923 ; GFX11-DL-NEXT: s_load_b32 s2, s[0:1], 0x0
924 ; GFX11-DL-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
925 ; GFX11-DL-NEXT: v_dot4_i32_iu8 v0, v1, v0, s2 neg_lo:[1,1,0]
926 ; GFX11-DL-NEXT: global_store_b32 v2, v0, s[0:1]
927 ; GFX11-DL-NEXT: s_nop 0
928 ; GFX11-DL-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
929 ; GFX11-DL-NEXT: s_endpgm
930 ptr addrspace(1) %src2,
931 ptr addrspace(1) nocapture %dst) {
933 %idx = call i32 @llvm.amdgcn.workitem.id.x()
934 %gep1 = getelementptr <4 x i8>, ptr addrspace(1) %src1, i32 %idx
935 %vec1 = load <4 x i8>, ptr addrspace(1) %gep1
936 %gep2 = getelementptr <4 x i8>, ptr addrspace(1) %src2, i32 %idx
937 %vec2 = load <4 x i8>, ptr addrspace(1) %gep2
939 %cvec1 = sext <4 x i8> %vec1 to <4 x i32>
940 %cvec2 = sext <4 x i8> %vec2 to <4 x i32>
942 %mul = mul <4 x i32> %cvec1, %cvec2
943 %mul0 = extractelement <4 x i32> %mul, i64 0
944 %mul1 = extractelement <4 x i32> %mul, i64 1
945 %mul2 = extractelement <4 x i32> %mul, i64 2
946 %mul3 = extractelement <4 x i32> %mul, i64 3
948 %acc = load i32, ptr addrspace(1) %dst, align 4
949 %add1 = add i32 %mul0, %acc
950 %add2 = add i32 %add1, %mul1
951 %add3 = add i32 %add2, %mul2
952 %add4 = add i32 %add3, %mul3
954 store i32 %add4, ptr addrspace(1) %dst, align 4
958 define amdgpu_kernel void @idot4_acc16_vecMul(ptr addrspace(1) %src1,
959 ; GFX7-LABEL: idot4_acc16_vecMul:
960 ; GFX7: ; %bb.0: ; %entry
961 ; GFX7-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x9
962 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0xd
963 ; GFX7-NEXT: s_mov_b32 s3, 0xf000
964 ; GFX7-NEXT: s_mov_b32 s10, 0
965 ; GFX7-NEXT: s_mov_b32 s11, s3
966 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
967 ; GFX7-NEXT: s_mov_b64 s[8:9], s[4:5]
968 ; GFX7-NEXT: v_lshlrev_b32_e32 v0, 2, v0
969 ; GFX7-NEXT: v_mov_b32_e32 v1, 0
970 ; GFX7-NEXT: buffer_load_dword v2, v[0:1], s[8:11], 0 addr64
971 ; GFX7-NEXT: s_mov_b64 s[8:9], s[6:7]
972 ; GFX7-NEXT: buffer_load_dword v0, v[0:1], s[8:11], 0 addr64
973 ; GFX7-NEXT: s_mov_b32 s2, -1
974 ; GFX7-NEXT: buffer_load_ushort v1, off, s[0:3], 0
975 ; GFX7-NEXT: s_waitcnt vmcnt(2)
976 ; GFX7-NEXT: v_bfe_i32 v4, v2, 0, 8
977 ; GFX7-NEXT: v_bfe_i32 v3, v2, 16, 8
978 ; GFX7-NEXT: s_waitcnt vmcnt(1)
979 ; GFX7-NEXT: v_bfe_i32 v7, v0, 0, 8
980 ; GFX7-NEXT: v_ashrrev_i32_e32 v5, 24, v2
981 ; GFX7-NEXT: v_bfe_i32 v2, v2, 8, 8
982 ; GFX7-NEXT: v_and_b32_e32 v4, 0xffff, v4
983 ; GFX7-NEXT: v_bfe_i32 v6, v0, 16, 8
984 ; GFX7-NEXT: v_ashrrev_i32_e32 v8, 24, v0
985 ; GFX7-NEXT: v_bfe_i32 v0, v0, 8, 8
986 ; GFX7-NEXT: v_and_b32_e32 v7, 0xffff, v7
987 ; GFX7-NEXT: v_and_b32_e32 v2, 0xffff, v2
988 ; GFX7-NEXT: v_and_b32_e32 v0, 0xffff, v0
989 ; GFX7-NEXT: s_waitcnt vmcnt(0)
990 ; GFX7-NEXT: v_mad_u32_u24 v1, v4, v7, v1
991 ; GFX7-NEXT: v_and_b32_e32 v3, 0xffff, v3
992 ; GFX7-NEXT: v_and_b32_e32 v6, 0xffff, v6
993 ; GFX7-NEXT: v_mad_u32_u24 v0, v2, v0, v1
994 ; GFX7-NEXT: v_and_b32_e32 v5, 0xffff, v5
995 ; GFX7-NEXT: v_and_b32_e32 v8, 0xffff, v8
996 ; GFX7-NEXT: v_mad_u32_u24 v0, v3, v6, v0
997 ; GFX7-NEXT: v_mad_u32_u24 v0, v5, v8, v0
998 ; GFX7-NEXT: buffer_store_short v0, off, s[0:3], 0
999 ; GFX7-NEXT: s_endpgm
1001 ; GFX8-LABEL: idot4_acc16_vecMul:
1002 ; GFX8: ; %bb.0: ; %entry
1003 ; GFX8-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x24
1004 ; GFX8-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x34
1005 ; GFX8-NEXT: v_lshlrev_b32_e32 v2, 2, v0
1006 ; GFX8-NEXT: s_waitcnt lgkmcnt(0)
1007 ; GFX8-NEXT: v_mov_b32_e32 v1, s5
1008 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, s4, v2
1009 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
1010 ; GFX8-NEXT: flat_load_dword v3, v[0:1]
1011 ; GFX8-NEXT: v_mov_b32_e32 v1, s7
1012 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, s6, v2
1013 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
1014 ; GFX8-NEXT: flat_load_dword v2, v[0:1]
1015 ; GFX8-NEXT: v_mov_b32_e32 v0, s0
1016 ; GFX8-NEXT: v_mov_b32_e32 v1, s1
1017 ; GFX8-NEXT: flat_load_ushort v4, v[0:1]
1018 ; GFX8-NEXT: s_waitcnt vmcnt(2)
1019 ; GFX8-NEXT: v_lshrrev_b32_e32 v5, 16, v3
1020 ; GFX8-NEXT: v_ashrrev_i16_e32 v7, 8, v3
1021 ; GFX8-NEXT: v_bfe_i32 v3, v3, 0, 8
1022 ; GFX8-NEXT: v_ashrrev_i16_e32 v9, 8, v5
1023 ; GFX8-NEXT: v_bfe_i32 v5, v5, 0, 8
1024 ; GFX8-NEXT: s_waitcnt vmcnt(1)
1025 ; GFX8-NEXT: v_lshrrev_b32_e32 v6, 16, v2
1026 ; GFX8-NEXT: v_ashrrev_i16_e32 v8, 8, v2
1027 ; GFX8-NEXT: v_bfe_i32 v2, v2, 0, 8
1028 ; GFX8-NEXT: s_waitcnt vmcnt(0)
1029 ; GFX8-NEXT: v_mad_u16 v2, v3, v2, v4
1030 ; GFX8-NEXT: v_ashrrev_i16_e32 v10, 8, v6
1031 ; GFX8-NEXT: v_bfe_i32 v6, v6, 0, 8
1032 ; GFX8-NEXT: v_mad_u16 v2, v7, v8, v2
1033 ; GFX8-NEXT: v_mad_u16 v2, v5, v6, v2
1034 ; GFX8-NEXT: v_mad_u16 v2, v9, v10, v2
1035 ; GFX8-NEXT: flat_store_short v[0:1], v2
1036 ; GFX8-NEXT: s_endpgm
1038 ; GFX9-NODL-LABEL: idot4_acc16_vecMul:
1039 ; GFX9-NODL: ; %bb.0: ; %entry
1040 ; GFX9-NODL-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x24
1041 ; GFX9-NODL-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x34
1042 ; GFX9-NODL-NEXT: v_lshlrev_b32_e32 v0, 2, v0
1043 ; GFX9-NODL-NEXT: s_mov_b32 s0, 0x5040100
1044 ; GFX9-NODL-NEXT: s_waitcnt lgkmcnt(0)
1045 ; GFX9-NODL-NEXT: global_load_dword v1, v0, s[4:5]
1046 ; GFX9-NODL-NEXT: global_load_dword v2, v0, s[6:7]
1047 ; GFX9-NODL-NEXT: v_mov_b32_e32 v0, 0
1048 ; GFX9-NODL-NEXT: global_load_ushort v3, v0, s[2:3]
1049 ; GFX9-NODL-NEXT: s_waitcnt vmcnt(2)
1050 ; GFX9-NODL-NEXT: v_lshrrev_b32_e32 v4, 16, v1
1051 ; GFX9-NODL-NEXT: s_waitcnt vmcnt(1)
1052 ; GFX9-NODL-NEXT: v_lshrrev_b32_e32 v5, 16, v2
1053 ; GFX9-NODL-NEXT: v_ashrrev_i16_e32 v6, 8, v1
1054 ; GFX9-NODL-NEXT: v_bfe_i32 v1, v1, 0, 8
1055 ; GFX9-NODL-NEXT: v_ashrrev_i16_e32 v7, 8, v2
1056 ; GFX9-NODL-NEXT: v_bfe_i32 v2, v2, 0, 8
1057 ; GFX9-NODL-NEXT: v_perm_b32 v2, v7, v2, s0
1058 ; GFX9-NODL-NEXT: v_perm_b32 v1, v6, v1, s0
1059 ; GFX9-NODL-NEXT: v_ashrrev_i16_e32 v8, 8, v4
1060 ; GFX9-NODL-NEXT: v_bfe_i32 v4, v4, 0, 8
1061 ; GFX9-NODL-NEXT: v_ashrrev_i16_e32 v9, 8, v5
1062 ; GFX9-NODL-NEXT: v_bfe_i32 v5, v5, 0, 8
1063 ; GFX9-NODL-NEXT: v_pk_mul_lo_u16 v1, v1, v2
1064 ; GFX9-NODL-NEXT: v_perm_b32 v5, v9, v5, s0
1065 ; GFX9-NODL-NEXT: v_perm_b32 v4, v8, v4, s0
1066 ; GFX9-NODL-NEXT: s_waitcnt vmcnt(0)
1067 ; GFX9-NODL-NEXT: v_add_u16_e32 v3, v1, v3
1068 ; GFX9-NODL-NEXT: v_pk_mul_lo_u16 v2, v4, v5
1069 ; GFX9-NODL-NEXT: v_add_u16_sdwa v1, v3, v1 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
1070 ; GFX9-NODL-NEXT: v_add_u16_e32 v1, v1, v2
1071 ; GFX9-NODL-NEXT: v_add_u16_sdwa v1, v1, v2 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
1072 ; GFX9-NODL-NEXT: global_store_short v0, v1, s[2:3]
1073 ; GFX9-NODL-NEXT: s_endpgm
1075 ; GFX9-DL-LABEL: idot4_acc16_vecMul:
1076 ; GFX9-DL: ; %bb.0: ; %entry
1077 ; GFX9-DL-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x24
1078 ; GFX9-DL-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x34
1079 ; GFX9-DL-NEXT: v_lshlrev_b32_e32 v0, 2, v0
1080 ; GFX9-DL-NEXT: s_mov_b32 s0, 0x5040100
1081 ; GFX9-DL-NEXT: s_waitcnt lgkmcnt(0)
1082 ; GFX9-DL-NEXT: global_load_dword v1, v0, s[4:5]
1083 ; GFX9-DL-NEXT: global_load_dword v2, v0, s[6:7]
1084 ; GFX9-DL-NEXT: v_mov_b32_e32 v0, 0
1085 ; GFX9-DL-NEXT: global_load_ushort v3, v0, s[2:3]
1086 ; GFX9-DL-NEXT: s_waitcnt vmcnt(2)
1087 ; GFX9-DL-NEXT: v_lshrrev_b32_e32 v4, 16, v1
1088 ; GFX9-DL-NEXT: s_waitcnt vmcnt(1)
1089 ; GFX9-DL-NEXT: v_lshrrev_b32_e32 v5, 16, v2
1090 ; GFX9-DL-NEXT: v_ashrrev_i16_e32 v6, 8, v1
1091 ; GFX9-DL-NEXT: v_bfe_i32 v1, v1, 0, 8
1092 ; GFX9-DL-NEXT: v_ashrrev_i16_e32 v7, 8, v2
1093 ; GFX9-DL-NEXT: v_bfe_i32 v2, v2, 0, 8
1094 ; GFX9-DL-NEXT: v_perm_b32 v2, v7, v2, s0
1095 ; GFX9-DL-NEXT: v_perm_b32 v1, v6, v1, s0
1096 ; GFX9-DL-NEXT: v_ashrrev_i16_e32 v8, 8, v4
1097 ; GFX9-DL-NEXT: v_bfe_i32 v4, v4, 0, 8
1098 ; GFX9-DL-NEXT: v_ashrrev_i16_e32 v9, 8, v5
1099 ; GFX9-DL-NEXT: v_bfe_i32 v5, v5, 0, 8
1100 ; GFX9-DL-NEXT: v_pk_mul_lo_u16 v1, v1, v2
1101 ; GFX9-DL-NEXT: v_perm_b32 v5, v9, v5, s0
1102 ; GFX9-DL-NEXT: v_perm_b32 v4, v8, v4, s0
1103 ; GFX9-DL-NEXT: s_waitcnt vmcnt(0)
1104 ; GFX9-DL-NEXT: v_add_u16_e32 v3, v1, v3
1105 ; GFX9-DL-NEXT: v_pk_mul_lo_u16 v2, v4, v5
1106 ; GFX9-DL-NEXT: v_add_u16_sdwa v1, v3, v1 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
1107 ; GFX9-DL-NEXT: v_add_u16_e32 v1, v1, v2
1108 ; GFX9-DL-NEXT: v_add_u16_sdwa v1, v1, v2 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
1109 ; GFX9-DL-NEXT: global_store_short v0, v1, s[2:3]
1110 ; GFX9-DL-NEXT: s_endpgm
1112 ; GFX10-DL-LABEL: idot4_acc16_vecMul:
1113 ; GFX10-DL: ; %bb.0: ; %entry
1114 ; GFX10-DL-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x24
1115 ; GFX10-DL-NEXT: v_lshlrev_b32_e32 v0, 2, v0
1116 ; GFX10-DL-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x34
1117 ; GFX10-DL-NEXT: s_waitcnt lgkmcnt(0)
1118 ; GFX10-DL-NEXT: s_clause 0x1
1119 ; GFX10-DL-NEXT: global_load_dword v1, v0, s[4:5]
1120 ; GFX10-DL-NEXT: global_load_dword v2, v0, s[6:7]
1121 ; GFX10-DL-NEXT: v_mov_b32_e32 v0, 0
1122 ; GFX10-DL-NEXT: global_load_ushort v3, v0, s[0:1]
1123 ; GFX10-DL-NEXT: s_waitcnt vmcnt(2)
1124 ; GFX10-DL-NEXT: v_ashrrev_i16 v4, 8, v1
1125 ; GFX10-DL-NEXT: s_waitcnt vmcnt(1)
1126 ; GFX10-DL-NEXT: v_ashrrev_i16 v5, 8, v2
1127 ; GFX10-DL-NEXT: v_bfe_i32 v6, v2, 0, 8
1128 ; GFX10-DL-NEXT: v_bfe_i32 v7, v1, 0, 8
1129 ; GFX10-DL-NEXT: v_lshrrev_b32_e32 v1, 16, v1
1130 ; GFX10-DL-NEXT: v_lshrrev_b32_e32 v2, 16, v2
1131 ; GFX10-DL-NEXT: v_perm_b32 v5, v5, v6, 0x5040100
1132 ; GFX10-DL-NEXT: v_perm_b32 v4, v4, v7, 0x5040100
1133 ; GFX10-DL-NEXT: v_ashrrev_i16 v6, 8, v1
1134 ; GFX10-DL-NEXT: v_ashrrev_i16 v7, 8, v2
1135 ; GFX10-DL-NEXT: v_bfe_i32 v2, v2, 0, 8
1136 ; GFX10-DL-NEXT: v_bfe_i32 v1, v1, 0, 8
1137 ; GFX10-DL-NEXT: v_pk_mul_lo_u16 v4, v4, v5
1138 ; GFX10-DL-NEXT: v_perm_b32 v2, v7, v2, 0x5040100
1139 ; GFX10-DL-NEXT: v_perm_b32 v1, v6, v1, 0x5040100
1140 ; GFX10-DL-NEXT: v_lshrrev_b32_e32 v5, 16, v4
1141 ; GFX10-DL-NEXT: s_waitcnt vmcnt(0)
1142 ; GFX10-DL-NEXT: v_add_nc_u16 v3, v4, v3
1143 ; GFX10-DL-NEXT: v_pk_mul_lo_u16 v1, v1, v2
1144 ; GFX10-DL-NEXT: v_add_nc_u16 v2, v3, v5
1145 ; GFX10-DL-NEXT: v_lshrrev_b32_e32 v3, 16, v1
1146 ; GFX10-DL-NEXT: v_add_nc_u16 v1, v2, v1
1147 ; GFX10-DL-NEXT: v_add_nc_u16 v1, v1, v3
1148 ; GFX10-DL-NEXT: global_store_short v0, v1, s[0:1]
1149 ; GFX10-DL-NEXT: s_endpgm
1151 ; GFX11-DL-LABEL: idot4_acc16_vecMul:
1152 ; GFX11-DL: ; %bb.0: ; %entry
1153 ; GFX11-DL-NEXT: s_load_b128 s[4:7], s[0:1], 0x24
1154 ; GFX11-DL-NEXT: v_lshlrev_b32_e32 v0, 2, v0
1155 ; GFX11-DL-NEXT: s_load_b64 s[0:1], s[0:1], 0x34
1156 ; GFX11-DL-NEXT: v_mov_b32_e32 v2, 0
1157 ; GFX11-DL-NEXT: s_waitcnt lgkmcnt(0)
1158 ; GFX11-DL-NEXT: s_clause 0x1
1159 ; GFX11-DL-NEXT: global_load_b32 v1, v0, s[4:5]
1160 ; GFX11-DL-NEXT: global_load_b32 v0, v0, s[6:7]
1161 ; GFX11-DL-NEXT: global_load_u16 v3, v2, s[0:1]
1162 ; GFX11-DL-NEXT: s_waitcnt vmcnt(2)
1163 ; GFX11-DL-NEXT: v_ashrrev_i16 v4, 8, v1
1164 ; GFX11-DL-NEXT: s_waitcnt vmcnt(1)
1165 ; GFX11-DL-NEXT: v_ashrrev_i16 v5, 8, v0
1166 ; GFX11-DL-NEXT: v_bfe_i32 v6, v0, 0, 8
1167 ; GFX11-DL-NEXT: v_bfe_i32 v7, v1, 0, 8
1168 ; GFX11-DL-NEXT: v_lshrrev_b32_e32 v1, 16, v1
1169 ; GFX11-DL-NEXT: v_lshrrev_b32_e32 v0, 16, v0
1170 ; GFX11-DL-NEXT: s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_4)
1171 ; GFX11-DL-NEXT: v_perm_b32 v5, v5, v6, 0x5040100
1172 ; GFX11-DL-NEXT: v_perm_b32 v4, v4, v7, 0x5040100
1173 ; GFX11-DL-NEXT: s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_4)
1174 ; GFX11-DL-NEXT: v_ashrrev_i16 v6, 8, v1
1175 ; GFX11-DL-NEXT: v_ashrrev_i16 v7, 8, v0
1176 ; GFX11-DL-NEXT: v_bfe_i32 v0, v0, 0, 8
1177 ; GFX11-DL-NEXT: v_bfe_i32 v1, v1, 0, 8
1178 ; GFX11-DL-NEXT: v_pk_mul_lo_u16 v4, v4, v5
1179 ; GFX11-DL-NEXT: s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
1180 ; GFX11-DL-NEXT: v_perm_b32 v0, v7, v0, 0x5040100
1181 ; GFX11-DL-NEXT: v_perm_b32 v1, v6, v1, 0x5040100
1182 ; GFX11-DL-NEXT: s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_2) | instid1(VALU_DEP_3)
1183 ; GFX11-DL-NEXT: v_lshrrev_b32_e32 v5, 16, v4
1184 ; GFX11-DL-NEXT: s_waitcnt vmcnt(0)
1185 ; GFX11-DL-NEXT: v_add_nc_u16 v3, v4, v3
1186 ; GFX11-DL-NEXT: v_pk_mul_lo_u16 v0, v1, v0
1187 ; GFX11-DL-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
1188 ; GFX11-DL-NEXT: v_add_nc_u16 v1, v3, v5
1189 ; GFX11-DL-NEXT: v_lshrrev_b32_e32 v3, 16, v0
1190 ; GFX11-DL-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
1191 ; GFX11-DL-NEXT: v_add_nc_u16 v0, v1, v0
1192 ; GFX11-DL-NEXT: v_add_nc_u16 v0, v0, v3
1193 ; GFX11-DL-NEXT: global_store_b16 v2, v0, s[0:1]
1194 ; GFX11-DL-NEXT: s_nop 0
1195 ; GFX11-DL-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
1196 ; GFX11-DL-NEXT: s_endpgm
1197 ptr addrspace(1) %src2,
1198 ptr addrspace(1) nocapture %dst) {
1200 %idx = call i32 @llvm.amdgcn.workitem.id.x()
1201 %gep1 = getelementptr <4 x i8>, ptr addrspace(1) %src1, i32 %idx
1202 %vec1 = load <4 x i8>, ptr addrspace(1) %gep1
1203 %gep2 = getelementptr <4 x i8>, ptr addrspace(1) %src2, i32 %idx
1204 %vec2 = load <4 x i8>, ptr addrspace(1) %gep2
1206 %cvec1 = sext <4 x i8> %vec1 to <4 x i16>
1207 %cvec2 = sext <4 x i8> %vec2 to <4 x i16>
1209 %mul = mul <4 x i16> %cvec1, %cvec2
1210 %mul0 = extractelement <4 x i16> %mul, i64 0
1211 %mul1 = extractelement <4 x i16> %mul, i64 1
1212 %mul2 = extractelement <4 x i16> %mul, i64 2
1213 %mul3 = extractelement <4 x i16> %mul, i64 3
1215 %acc = load i16, ptr addrspace(1) %dst, align 4
1216 %add1 = add i16 %mul0, %acc
1217 %add2 = add i16 %add1, %mul1
1218 %add3 = add i16 %add2, %mul2
1219 %add4 = add i16 %add3, %mul3
1221 store i16 %add4, ptr addrspace(1) %dst, align 4
1225 define amdgpu_kernel void @idot4_acc32_2ele(ptr addrspace(1) %src1,
1226 ; GFX7-LABEL: idot4_acc32_2ele:
1227 ; GFX7: ; %bb.0: ; %entry
1228 ; GFX7-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x9
1229 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0xd
1230 ; GFX7-NEXT: s_mov_b32 s3, 0xf000
1231 ; GFX7-NEXT: s_mov_b32 s10, 0
1232 ; GFX7-NEXT: s_mov_b32 s11, s3
1233 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
1234 ; GFX7-NEXT: s_mov_b64 s[8:9], s[4:5]
1235 ; GFX7-NEXT: v_lshlrev_b32_e32 v0, 2, v0
1236 ; GFX7-NEXT: v_mov_b32_e32 v1, 0
1237 ; GFX7-NEXT: buffer_load_dword v2, v[0:1], s[8:11], 0 addr64
1238 ; GFX7-NEXT: s_mov_b64 s[8:9], s[6:7]
1239 ; GFX7-NEXT: buffer_load_dword v0, v[0:1], s[8:11], 0 addr64
1240 ; GFX7-NEXT: s_load_dword s4, s[0:1], 0x0
1241 ; GFX7-NEXT: s_mov_b32 s2, -1
1242 ; GFX7-NEXT: s_waitcnt vmcnt(1)
1243 ; GFX7-NEXT: v_bfe_i32 v1, v2, 0, 8
1244 ; GFX7-NEXT: v_bfe_i32 v2, v2, 8, 8
1245 ; GFX7-NEXT: s_waitcnt vmcnt(0)
1246 ; GFX7-NEXT: v_bfe_i32 v3, v0, 0, 8
1247 ; GFX7-NEXT: v_bfe_i32 v0, v0, 8, 8
1248 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
1249 ; GFX7-NEXT: v_mad_i32_i24 v1, v1, v3, s4
1250 ; GFX7-NEXT: v_mad_i32_i24 v0, v2, v0, v1
1251 ; GFX7-NEXT: buffer_store_dword v0, off, s[0:3], 0
1252 ; GFX7-NEXT: s_endpgm
1254 ; GFX8-LABEL: idot4_acc32_2ele:
1255 ; GFX8: ; %bb.0: ; %entry
1256 ; GFX8-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x24
1257 ; GFX8-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x34
1258 ; GFX8-NEXT: v_lshlrev_b32_e32 v2, 2, v0
1259 ; GFX8-NEXT: s_waitcnt lgkmcnt(0)
1260 ; GFX8-NEXT: v_mov_b32_e32 v1, s5
1261 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, s4, v2
1262 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
1263 ; GFX8-NEXT: flat_load_dword v3, v[0:1]
1264 ; GFX8-NEXT: v_mov_b32_e32 v1, s7
1265 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, s6, v2
1266 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
1267 ; GFX8-NEXT: flat_load_dword v0, v[0:1]
1268 ; GFX8-NEXT: s_load_dword s2, s[0:1], 0x0
1269 ; GFX8-NEXT: s_waitcnt vmcnt(1)
1270 ; GFX8-NEXT: v_bfe_i32 v1, v3, 0, 8
1271 ; GFX8-NEXT: v_bfe_i32 v3, v3, 8, 8
1272 ; GFX8-NEXT: s_waitcnt vmcnt(0)
1273 ; GFX8-NEXT: v_bfe_i32 v2, v0, 0, 8
1274 ; GFX8-NEXT: v_bfe_i32 v0, v0, 8, 8
1275 ; GFX8-NEXT: s_waitcnt lgkmcnt(0)
1276 ; GFX8-NEXT: v_mad_i32_i24 v1, v1, v2, s2
1277 ; GFX8-NEXT: v_mad_i32_i24 v2, v3, v0, v1
1278 ; GFX8-NEXT: v_mov_b32_e32 v0, s0
1279 ; GFX8-NEXT: v_mov_b32_e32 v1, s1
1280 ; GFX8-NEXT: flat_store_dword v[0:1], v2
1281 ; GFX8-NEXT: s_endpgm
1283 ; GFX9-NODL-LABEL: idot4_acc32_2ele:
1284 ; GFX9-NODL: ; %bb.0: ; %entry
1285 ; GFX9-NODL-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x24
1286 ; GFX9-NODL-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x34
1287 ; GFX9-NODL-NEXT: v_lshlrev_b32_e32 v0, 2, v0
1288 ; GFX9-NODL-NEXT: s_waitcnt lgkmcnt(0)
1289 ; GFX9-NODL-NEXT: global_load_dword v1, v0, s[4:5]
1290 ; GFX9-NODL-NEXT: global_load_dword v2, v0, s[6:7]
1291 ; GFX9-NODL-NEXT: s_load_dword s0, s[2:3], 0x0
1292 ; GFX9-NODL-NEXT: v_mov_b32_e32 v0, 0
1293 ; GFX9-NODL-NEXT: s_waitcnt vmcnt(0)
1294 ; GFX9-NODL-NEXT: v_mul_i32_i24_sdwa v3, sext(v1), sext(v2) dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:BYTE_0
1295 ; GFX9-NODL-NEXT: v_mul_i32_i24_sdwa v1, sext(v1), sext(v2) dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_1 src1_sel:BYTE_1
1296 ; GFX9-NODL-NEXT: s_waitcnt lgkmcnt(0)
1297 ; GFX9-NODL-NEXT: v_add3_u32 v1, v3, s0, v1
1298 ; GFX9-NODL-NEXT: global_store_dword v0, v1, s[2:3]
1299 ; GFX9-NODL-NEXT: s_endpgm
1301 ; GFX9-DL-LABEL: idot4_acc32_2ele:
1302 ; GFX9-DL: ; %bb.0: ; %entry
1303 ; GFX9-DL-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x24
1304 ; GFX9-DL-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x34
1305 ; GFX9-DL-NEXT: v_lshlrev_b32_e32 v0, 2, v0
1306 ; GFX9-DL-NEXT: s_mov_b32 s1, 0xc0c0100
1307 ; GFX9-DL-NEXT: s_waitcnt lgkmcnt(0)
1308 ; GFX9-DL-NEXT: global_load_dword v1, v0, s[6:7]
1309 ; GFX9-DL-NEXT: global_load_dword v2, v0, s[4:5]
1310 ; GFX9-DL-NEXT: s_load_dword s0, s[2:3], 0x0
1311 ; GFX9-DL-NEXT: v_mov_b32_e32 v0, 0
1312 ; GFX9-DL-NEXT: s_waitcnt vmcnt(1)
1313 ; GFX9-DL-NEXT: v_perm_b32 v1, v1, v1, s1
1314 ; GFX9-DL-NEXT: s_waitcnt vmcnt(0)
1315 ; GFX9-DL-NEXT: v_perm_b32 v2, v2, v2, s1
1316 ; GFX9-DL-NEXT: s_waitcnt lgkmcnt(0)
1317 ; GFX9-DL-NEXT: v_dot4_i32_i8 v1, v2, v1, s0
1318 ; GFX9-DL-NEXT: global_store_dword v0, v1, s[2:3]
1319 ; GFX9-DL-NEXT: s_endpgm
1321 ; GFX10-DL-LABEL: idot4_acc32_2ele:
1322 ; GFX10-DL: ; %bb.0: ; %entry
1323 ; GFX10-DL-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x24
1324 ; GFX10-DL-NEXT: v_lshlrev_b32_e32 v0, 2, v0
1325 ; GFX10-DL-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x34
1326 ; GFX10-DL-NEXT: v_mov_b32_e32 v3, 0
1327 ; GFX10-DL-NEXT: s_waitcnt lgkmcnt(0)
1328 ; GFX10-DL-NEXT: s_clause 0x1
1329 ; GFX10-DL-NEXT: global_load_dword v1, v0, s[6:7]
1330 ; GFX10-DL-NEXT: global_load_dword v2, v0, s[4:5]
1331 ; GFX10-DL-NEXT: s_load_dword s2, s[0:1], 0x0
1332 ; GFX10-DL-NEXT: s_waitcnt vmcnt(1)
1333 ; GFX10-DL-NEXT: v_perm_b32 v0, v1, v1, 0xc0c0100
1334 ; GFX10-DL-NEXT: s_waitcnt vmcnt(0)
1335 ; GFX10-DL-NEXT: v_perm_b32 v1, v2, v2, 0xc0c0100
1336 ; GFX10-DL-NEXT: s_waitcnt lgkmcnt(0)
1337 ; GFX10-DL-NEXT: v_mov_b32_e32 v2, s2
1338 ; GFX10-DL-NEXT: v_dot4c_i32_i8_e32 v2, v1, v0
1339 ; GFX10-DL-NEXT: global_store_dword v3, v2, s[0:1]
1340 ; GFX10-DL-NEXT: s_endpgm
1342 ; GFX11-DL-LABEL: idot4_acc32_2ele:
1343 ; GFX11-DL: ; %bb.0: ; %entry
1344 ; GFX11-DL-NEXT: s_load_b128 s[4:7], s[0:1], 0x24
1345 ; GFX11-DL-NEXT: v_lshlrev_b32_e32 v0, 2, v0
1346 ; GFX11-DL-NEXT: s_load_b64 s[0:1], s[0:1], 0x34
1347 ; GFX11-DL-NEXT: v_mov_b32_e32 v2, 0
1348 ; GFX11-DL-NEXT: s_waitcnt lgkmcnt(0)
1349 ; GFX11-DL-NEXT: s_clause 0x1
1350 ; GFX11-DL-NEXT: global_load_b32 v1, v0, s[6:7]
1351 ; GFX11-DL-NEXT: global_load_b32 v0, v0, s[4:5]
1352 ; GFX11-DL-NEXT: s_load_b32 s2, s[0:1], 0x0
1353 ; GFX11-DL-NEXT: s_waitcnt vmcnt(1)
1354 ; GFX11-DL-NEXT: v_perm_b32 v1, v1, v1, 0xc0c0100
1355 ; GFX11-DL-NEXT: s_waitcnt vmcnt(0)
1356 ; GFX11-DL-NEXT: v_perm_b32 v0, v0, v0, 0xc0c0100
1357 ; GFX11-DL-NEXT: s_waitcnt lgkmcnt(0)
1358 ; GFX11-DL-NEXT: s_delay_alu instid0(VALU_DEP_1)
1359 ; GFX11-DL-NEXT: v_dot4_i32_iu8 v0, v0, v1, s2 neg_lo:[1,1,0]
1360 ; GFX11-DL-NEXT: global_store_b32 v2, v0, s[0:1]
1361 ; GFX11-DL-NEXT: s_nop 0
1362 ; GFX11-DL-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
1363 ; GFX11-DL-NEXT: s_endpgm
1364 ptr addrspace(1) %src2,
1365 ptr addrspace(1) nocapture %dst) {
1367 %idx = call i32 @llvm.amdgcn.workitem.id.x()
1368 %gep1 = getelementptr <4 x i8>, ptr addrspace(1) %src1, i32 %idx
1369 %vec1 = load <4 x i8>, ptr addrspace(1) %gep1
1370 %gep2 = getelementptr <4 x i8>, ptr addrspace(1) %src2, i32 %idx
1371 %vec2 = load <4 x i8>, ptr addrspace(1) %gep2
1373 %v1e0 = extractelement <4 x i8> %vec1, i64 0
1374 %cv1e0 = sext i8 %v1e0 to i32
1375 %v2e0 = extractelement <4 x i8> %vec2, i64 0
1376 %cv2e0 = sext i8 %v2e0 to i32
1377 %mul1 = mul nuw nsw i32 %cv1e0, %cv2e0
1379 %v1e1 = extractelement <4 x i8> %vec1, i64 1
1380 %cv1e1 = sext i8 %v1e1 to i32
1381 %v2e1 = extractelement <4 x i8> %vec2, i64 1
1382 %cv2e1 = sext i8 %v2e1 to i32
1383 %mul2 = mul nuw nsw i32 %cv1e1, %cv2e1
1385 %acc = load i32, ptr addrspace(1) %dst, align 4
1386 %add1 = add i32 %mul1, %acc
1387 %add2 = add i32 %add1, %mul2
1388 store i32 %add2, ptr addrspace(1) %dst, align 4
1393 define amdgpu_kernel void @idot4_acc32_3ele(ptr addrspace(1) %src1,
1394 ; GFX7-LABEL: idot4_acc32_3ele:
1395 ; GFX7: ; %bb.0: ; %entry
1396 ; GFX7-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x9
1397 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0xd
1398 ; GFX7-NEXT: s_mov_b32 s3, 0xf000
1399 ; GFX7-NEXT: s_mov_b32 s10, 0
1400 ; GFX7-NEXT: s_mov_b32 s11, s3
1401 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
1402 ; GFX7-NEXT: s_mov_b64 s[8:9], s[4:5]
1403 ; GFX7-NEXT: v_lshlrev_b32_e32 v0, 2, v0
1404 ; GFX7-NEXT: v_mov_b32_e32 v1, 0
1405 ; GFX7-NEXT: buffer_load_dword v2, v[0:1], s[8:11], 0 addr64
1406 ; GFX7-NEXT: s_mov_b64 s[8:9], s[6:7]
1407 ; GFX7-NEXT: buffer_load_dword v0, v[0:1], s[8:11], 0 addr64
1408 ; GFX7-NEXT: s_load_dword s4, s[0:1], 0x0
1409 ; GFX7-NEXT: s_mov_b32 s2, -1
1410 ; GFX7-NEXT: s_waitcnt vmcnt(1)
1411 ; GFX7-NEXT: v_bfe_i32 v1, v2, 0, 8
1412 ; GFX7-NEXT: v_bfe_i32 v3, v2, 8, 8
1413 ; GFX7-NEXT: s_waitcnt vmcnt(0)
1414 ; GFX7-NEXT: v_bfe_i32 v4, v0, 0, 8
1415 ; GFX7-NEXT: v_bfe_i32 v5, v0, 8, 8
1416 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
1417 ; GFX7-NEXT: v_mad_i32_i24 v1, v1, v4, s4
1418 ; GFX7-NEXT: v_bfe_i32 v2, v2, 16, 8
1419 ; GFX7-NEXT: v_bfe_i32 v0, v0, 16, 8
1420 ; GFX7-NEXT: v_mad_i32_i24 v1, v3, v5, v1
1421 ; GFX7-NEXT: v_mad_i32_i24 v0, v2, v0, v1
1422 ; GFX7-NEXT: buffer_store_dword v0, off, s[0:3], 0
1423 ; GFX7-NEXT: s_endpgm
1425 ; GFX8-LABEL: idot4_acc32_3ele:
1426 ; GFX8: ; %bb.0: ; %entry
1427 ; GFX8-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x24
1428 ; GFX8-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x34
1429 ; GFX8-NEXT: v_lshlrev_b32_e32 v2, 2, v0
1430 ; GFX8-NEXT: s_waitcnt lgkmcnt(0)
1431 ; GFX8-NEXT: v_mov_b32_e32 v1, s5
1432 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, s4, v2
1433 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
1434 ; GFX8-NEXT: flat_load_dword v3, v[0:1]
1435 ; GFX8-NEXT: v_mov_b32_e32 v1, s7
1436 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, s6, v2
1437 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
1438 ; GFX8-NEXT: flat_load_dword v0, v[0:1]
1439 ; GFX8-NEXT: s_load_dword s2, s[0:1], 0x0
1440 ; GFX8-NEXT: s_waitcnt vmcnt(1)
1441 ; GFX8-NEXT: v_bfe_i32 v1, v3, 0, 8
1442 ; GFX8-NEXT: v_bfe_i32 v4, v3, 8, 8
1443 ; GFX8-NEXT: v_bfe_i32 v3, v3, 16, 8
1444 ; GFX8-NEXT: s_waitcnt vmcnt(0)
1445 ; GFX8-NEXT: v_bfe_i32 v2, v0, 0, 8
1446 ; GFX8-NEXT: v_bfe_i32 v5, v0, 8, 8
1447 ; GFX8-NEXT: s_waitcnt lgkmcnt(0)
1448 ; GFX8-NEXT: v_mad_i32_i24 v1, v1, v2, s2
1449 ; GFX8-NEXT: v_bfe_i32 v0, v0, 16, 8
1450 ; GFX8-NEXT: v_mad_i32_i24 v1, v4, v5, v1
1451 ; GFX8-NEXT: v_mad_i32_i24 v2, v3, v0, v1
1452 ; GFX8-NEXT: v_mov_b32_e32 v0, s0
1453 ; GFX8-NEXT: v_mov_b32_e32 v1, s1
1454 ; GFX8-NEXT: flat_store_dword v[0:1], v2
1455 ; GFX8-NEXT: s_endpgm
1457 ; GFX9-NODL-LABEL: idot4_acc32_3ele:
1458 ; GFX9-NODL: ; %bb.0: ; %entry
1459 ; GFX9-NODL-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x24
1460 ; GFX9-NODL-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x34
1461 ; GFX9-NODL-NEXT: v_lshlrev_b32_e32 v0, 2, v0
1462 ; GFX9-NODL-NEXT: s_waitcnt lgkmcnt(0)
1463 ; GFX9-NODL-NEXT: global_load_dword v1, v0, s[4:5]
1464 ; GFX9-NODL-NEXT: global_load_dword v2, v0, s[6:7]
1465 ; GFX9-NODL-NEXT: s_load_dword s0, s[2:3], 0x0
1466 ; GFX9-NODL-NEXT: v_mov_b32_e32 v0, 0
1467 ; GFX9-NODL-NEXT: s_waitcnt vmcnt(1)
1468 ; GFX9-NODL-NEXT: v_bfe_i32 v3, v1, 0, 8
1469 ; GFX9-NODL-NEXT: s_waitcnt vmcnt(0)
1470 ; GFX9-NODL-NEXT: v_bfe_i32 v4, v2, 0, 8
1471 ; GFX9-NODL-NEXT: v_mul_i32_i24_sdwa v5, sext(v1), sext(v2) dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_1 src1_sel:BYTE_1
1472 ; GFX9-NODL-NEXT: v_mul_i32_i24_sdwa v1, sext(v1), sext(v2) dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_2 src1_sel:BYTE_2
1473 ; GFX9-NODL-NEXT: s_waitcnt lgkmcnt(0)
1474 ; GFX9-NODL-NEXT: v_mad_i32_i24 v2, v3, v4, s0
1475 ; GFX9-NODL-NEXT: v_add3_u32 v1, v2, v5, v1
1476 ; GFX9-NODL-NEXT: global_store_dword v0, v1, s[2:3]
1477 ; GFX9-NODL-NEXT: s_endpgm
1479 ; GFX9-DL-LABEL: idot4_acc32_3ele:
1480 ; GFX9-DL: ; %bb.0: ; %entry
1481 ; GFX9-DL-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x24
1482 ; GFX9-DL-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x34
1483 ; GFX9-DL-NEXT: v_lshlrev_b32_e32 v0, 2, v0
1484 ; GFX9-DL-NEXT: s_mov_b32 s1, 0xc020100
1485 ; GFX9-DL-NEXT: s_waitcnt lgkmcnt(0)
1486 ; GFX9-DL-NEXT: global_load_dword v1, v0, s[6:7]
1487 ; GFX9-DL-NEXT: global_load_dword v2, v0, s[4:5]
1488 ; GFX9-DL-NEXT: s_load_dword s0, s[2:3], 0x0
1489 ; GFX9-DL-NEXT: v_mov_b32_e32 v0, 0
1490 ; GFX9-DL-NEXT: s_waitcnt vmcnt(1)
1491 ; GFX9-DL-NEXT: v_perm_b32 v1, v1, v1, s1
1492 ; GFX9-DL-NEXT: s_waitcnt vmcnt(0)
1493 ; GFX9-DL-NEXT: v_perm_b32 v2, v2, v2, s1
1494 ; GFX9-DL-NEXT: s_waitcnt lgkmcnt(0)
1495 ; GFX9-DL-NEXT: v_dot4_i32_i8 v1, v2, v1, s0
1496 ; GFX9-DL-NEXT: global_store_dword v0, v1, s[2:3]
1497 ; GFX9-DL-NEXT: s_endpgm
1499 ; GFX10-DL-LABEL: idot4_acc32_3ele:
1500 ; GFX10-DL: ; %bb.0: ; %entry
1501 ; GFX10-DL-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x24
1502 ; GFX10-DL-NEXT: v_lshlrev_b32_e32 v0, 2, v0
1503 ; GFX10-DL-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x34
1504 ; GFX10-DL-NEXT: v_mov_b32_e32 v3, 0
1505 ; GFX10-DL-NEXT: s_waitcnt lgkmcnt(0)
1506 ; GFX10-DL-NEXT: s_clause 0x1
1507 ; GFX10-DL-NEXT: global_load_dword v1, v0, s[6:7]
1508 ; GFX10-DL-NEXT: global_load_dword v2, v0, s[4:5]
1509 ; GFX10-DL-NEXT: s_load_dword s2, s[0:1], 0x0
1510 ; GFX10-DL-NEXT: s_waitcnt vmcnt(1)
1511 ; GFX10-DL-NEXT: v_perm_b32 v0, v1, v1, 0xc020100
1512 ; GFX10-DL-NEXT: s_waitcnt vmcnt(0)
1513 ; GFX10-DL-NEXT: v_perm_b32 v1, v2, v2, 0xc020100
1514 ; GFX10-DL-NEXT: s_waitcnt lgkmcnt(0)
1515 ; GFX10-DL-NEXT: v_mov_b32_e32 v2, s2
1516 ; GFX10-DL-NEXT: v_dot4c_i32_i8_e32 v2, v1, v0
1517 ; GFX10-DL-NEXT: global_store_dword v3, v2, s[0:1]
1518 ; GFX10-DL-NEXT: s_endpgm
1520 ; GFX11-DL-LABEL: idot4_acc32_3ele:
1521 ; GFX11-DL: ; %bb.0: ; %entry
1522 ; GFX11-DL-NEXT: s_load_b128 s[4:7], s[0:1], 0x24
1523 ; GFX11-DL-NEXT: v_lshlrev_b32_e32 v0, 2, v0
1524 ; GFX11-DL-NEXT: s_load_b64 s[0:1], s[0:1], 0x34
1525 ; GFX11-DL-NEXT: v_mov_b32_e32 v2, 0
1526 ; GFX11-DL-NEXT: s_waitcnt lgkmcnt(0)
1527 ; GFX11-DL-NEXT: s_clause 0x1
1528 ; GFX11-DL-NEXT: global_load_b32 v1, v0, s[6:7]
1529 ; GFX11-DL-NEXT: global_load_b32 v0, v0, s[4:5]
1530 ; GFX11-DL-NEXT: s_load_b32 s2, s[0:1], 0x0
1531 ; GFX11-DL-NEXT: s_waitcnt vmcnt(1)
1532 ; GFX11-DL-NEXT: v_perm_b32 v1, v1, v1, 0xc020100
1533 ; GFX11-DL-NEXT: s_waitcnt vmcnt(0)
1534 ; GFX11-DL-NEXT: v_perm_b32 v0, v0, v0, 0xc020100
1535 ; GFX11-DL-NEXT: s_waitcnt lgkmcnt(0)
1536 ; GFX11-DL-NEXT: s_delay_alu instid0(VALU_DEP_1)
1537 ; GFX11-DL-NEXT: v_dot4_i32_iu8 v0, v0, v1, s2 neg_lo:[1,1,0]
1538 ; GFX11-DL-NEXT: global_store_b32 v2, v0, s[0:1]
1539 ; GFX11-DL-NEXT: s_nop 0
1540 ; GFX11-DL-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
1541 ; GFX11-DL-NEXT: s_endpgm
1542 ptr addrspace(1) %src2,
1543 ptr addrspace(1) nocapture %dst) {
1545 %idx = call i32 @llvm.amdgcn.workitem.id.x()
1546 %gep1 = getelementptr <4 x i8>, ptr addrspace(1) %src1, i32 %idx
1547 %vec1 = load <4 x i8>, ptr addrspace(1) %gep1
1548 %gep2 = getelementptr <4 x i8>, ptr addrspace(1) %src2, i32 %idx
1549 %vec2 = load <4 x i8>, ptr addrspace(1) %gep2
1551 %v1e0 = extractelement <4 x i8> %vec1, i64 0
1552 %cv1e0 = sext i8 %v1e0 to i32
1553 %v2e0 = extractelement <4 x i8> %vec2, i64 0
1554 %cv2e0 = sext i8 %v2e0 to i32
1555 %mul1 = mul nuw nsw i32 %cv1e0, %cv2e0
1557 %v1e1 = extractelement <4 x i8> %vec1, i64 1
1558 %cv1e1 = sext i8 %v1e1 to i32
1559 %v2e1 = extractelement <4 x i8> %vec2, i64 1
1560 %cv2e1 = sext i8 %v2e1 to i32
1561 %mul2 = mul nuw nsw i32 %cv1e1, %cv2e1
1563 %v1e2 = extractelement <4 x i8> %vec1, i64 2
1564 %cv1e2 = sext i8 %v1e2 to i32
1565 %v2e2 = extractelement <4 x i8> %vec2, i64 2
1566 %cv2e2 = sext i8 %v2e2 to i32
1567 %mul3 = mul nuw nsw i32 %cv1e2, %cv2e2
1569 %acc = load i32, ptr addrspace(1) %dst, align 4
1570 %add1 = add i32 %mul1, %acc
1571 %add2 = add i32 %add1, %mul2
1572 %add3 = add i32 %add2, %mul3
1573 store i32 %add3, ptr addrspace(1) %dst, align 4
1578 define amdgpu_kernel void @idot4_acc32_3ele_permuted(ptr addrspace(1) %src1,
1579 ; GFX7-LABEL: idot4_acc32_3ele_permuted:
1580 ; GFX7: ; %bb.0: ; %entry
1581 ; GFX7-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x9
1582 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0xd
1583 ; GFX7-NEXT: s_mov_b32 s3, 0xf000
1584 ; GFX7-NEXT: s_mov_b32 s10, 0
1585 ; GFX7-NEXT: s_mov_b32 s11, s3
1586 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
1587 ; GFX7-NEXT: s_mov_b64 s[8:9], s[4:5]
1588 ; GFX7-NEXT: v_lshlrev_b32_e32 v0, 2, v0
1589 ; GFX7-NEXT: v_mov_b32_e32 v1, 0
1590 ; GFX7-NEXT: buffer_load_dword v2, v[0:1], s[8:11], 0 addr64
1591 ; GFX7-NEXT: s_mov_b64 s[8:9], s[6:7]
1592 ; GFX7-NEXT: buffer_load_dword v0, v[0:1], s[8:11], 0 addr64
1593 ; GFX7-NEXT: s_load_dword s4, s[0:1], 0x0
1594 ; GFX7-NEXT: s_mov_b32 s2, -1
1595 ; GFX7-NEXT: s_waitcnt vmcnt(1)
1596 ; GFX7-NEXT: v_ashrrev_i32_e32 v1, 24, v2
1597 ; GFX7-NEXT: v_bfe_i32 v3, v2, 0, 8
1598 ; GFX7-NEXT: s_waitcnt vmcnt(0)
1599 ; GFX7-NEXT: v_ashrrev_i32_e32 v4, 24, v0
1600 ; GFX7-NEXT: v_bfe_i32 v5, v0, 0, 8
1601 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
1602 ; GFX7-NEXT: v_mad_i32_i24 v1, v1, v4, s4
1603 ; GFX7-NEXT: v_bfe_i32 v2, v2, 16, 8
1604 ; GFX7-NEXT: v_bfe_i32 v0, v0, 16, 8
1605 ; GFX7-NEXT: v_mad_i32_i24 v1, v3, v5, v1
1606 ; GFX7-NEXT: v_mad_i32_i24 v0, v2, v0, v1
1607 ; GFX7-NEXT: buffer_store_dword v0, off, s[0:3], 0
1608 ; GFX7-NEXT: s_endpgm
1610 ; GFX8-LABEL: idot4_acc32_3ele_permuted:
1611 ; GFX8: ; %bb.0: ; %entry
1612 ; GFX8-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x24
1613 ; GFX8-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x34
1614 ; GFX8-NEXT: v_lshlrev_b32_e32 v2, 2, v0
1615 ; GFX8-NEXT: s_waitcnt lgkmcnt(0)
1616 ; GFX8-NEXT: v_mov_b32_e32 v1, s5
1617 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, s4, v2
1618 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
1619 ; GFX8-NEXT: flat_load_dword v3, v[0:1]
1620 ; GFX8-NEXT: v_mov_b32_e32 v1, s7
1621 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, s6, v2
1622 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
1623 ; GFX8-NEXT: flat_load_dword v0, v[0:1]
1624 ; GFX8-NEXT: s_load_dword s2, s[0:1], 0x0
1625 ; GFX8-NEXT: s_waitcnt vmcnt(1)
1626 ; GFX8-NEXT: v_ashrrev_i32_e32 v1, 24, v3
1627 ; GFX8-NEXT: v_bfe_i32 v4, v3, 0, 8
1628 ; GFX8-NEXT: v_bfe_i32 v3, v3, 16, 8
1629 ; GFX8-NEXT: s_waitcnt vmcnt(0)
1630 ; GFX8-NEXT: v_ashrrev_i32_e32 v2, 24, v0
1631 ; GFX8-NEXT: v_bfe_i32 v5, v0, 0, 8
1632 ; GFX8-NEXT: s_waitcnt lgkmcnt(0)
1633 ; GFX8-NEXT: v_mad_i32_i24 v1, v1, v2, s2
1634 ; GFX8-NEXT: v_bfe_i32 v0, v0, 16, 8
1635 ; GFX8-NEXT: v_mad_i32_i24 v1, v4, v5, v1
1636 ; GFX8-NEXT: v_mad_i32_i24 v2, v3, v0, v1
1637 ; GFX8-NEXT: v_mov_b32_e32 v0, s0
1638 ; GFX8-NEXT: v_mov_b32_e32 v1, s1
1639 ; GFX8-NEXT: flat_store_dword v[0:1], v2
1640 ; GFX8-NEXT: s_endpgm
1642 ; GFX9-NODL-LABEL: idot4_acc32_3ele_permuted:
1643 ; GFX9-NODL: ; %bb.0: ; %entry
1644 ; GFX9-NODL-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x24
1645 ; GFX9-NODL-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x34
1646 ; GFX9-NODL-NEXT: v_lshlrev_b32_e32 v0, 2, v0
1647 ; GFX9-NODL-NEXT: s_waitcnt lgkmcnt(0)
1648 ; GFX9-NODL-NEXT: global_load_dword v1, v0, s[4:5]
1649 ; GFX9-NODL-NEXT: global_load_dword v2, v0, s[6:7]
1650 ; GFX9-NODL-NEXT: s_load_dword s0, s[2:3], 0x0
1651 ; GFX9-NODL-NEXT: v_mov_b32_e32 v0, 0
1652 ; GFX9-NODL-NEXT: s_waitcnt vmcnt(1)
1653 ; GFX9-NODL-NEXT: v_ashrrev_i32_e32 v3, 24, v1
1654 ; GFX9-NODL-NEXT: s_waitcnt vmcnt(0)
1655 ; GFX9-NODL-NEXT: v_ashrrev_i32_e32 v4, 24, v2
1656 ; GFX9-NODL-NEXT: v_mul_i32_i24_sdwa v5, sext(v1), sext(v2) dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:BYTE_0
1657 ; GFX9-NODL-NEXT: v_mul_i32_i24_sdwa v1, sext(v1), sext(v2) dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_2 src1_sel:BYTE_2
1658 ; GFX9-NODL-NEXT: s_waitcnt lgkmcnt(0)
1659 ; GFX9-NODL-NEXT: v_mad_i32_i24 v2, v3, v4, s0
1660 ; GFX9-NODL-NEXT: v_add3_u32 v1, v2, v5, v1
1661 ; GFX9-NODL-NEXT: global_store_dword v0, v1, s[2:3]
1662 ; GFX9-NODL-NEXT: s_endpgm
1664 ; GFX9-DL-LABEL: idot4_acc32_3ele_permuted:
1665 ; GFX9-DL: ; %bb.0: ; %entry
1666 ; GFX9-DL-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x24
1667 ; GFX9-DL-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x34
1668 ; GFX9-DL-NEXT: v_lshlrev_b32_e32 v0, 2, v0
1669 ; GFX9-DL-NEXT: s_mov_b32 s1, 0xc020003
1670 ; GFX9-DL-NEXT: s_waitcnt lgkmcnt(0)
1671 ; GFX9-DL-NEXT: global_load_dword v1, v0, s[6:7]
1672 ; GFX9-DL-NEXT: global_load_dword v2, v0, s[4:5]
1673 ; GFX9-DL-NEXT: s_load_dword s0, s[2:3], 0x0
1674 ; GFX9-DL-NEXT: v_mov_b32_e32 v0, 0
1675 ; GFX9-DL-NEXT: s_waitcnt vmcnt(1)
1676 ; GFX9-DL-NEXT: v_perm_b32 v1, v1, v1, s1
1677 ; GFX9-DL-NEXT: s_waitcnt vmcnt(0)
1678 ; GFX9-DL-NEXT: v_perm_b32 v2, v2, v2, s1
1679 ; GFX9-DL-NEXT: s_waitcnt lgkmcnt(0)
1680 ; GFX9-DL-NEXT: v_dot4_i32_i8 v1, v2, v1, s0
1681 ; GFX9-DL-NEXT: global_store_dword v0, v1, s[2:3]
1682 ; GFX9-DL-NEXT: s_endpgm
1684 ; GFX10-DL-LABEL: idot4_acc32_3ele_permuted:
1685 ; GFX10-DL: ; %bb.0: ; %entry
1686 ; GFX10-DL-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x24
1687 ; GFX10-DL-NEXT: v_lshlrev_b32_e32 v0, 2, v0
1688 ; GFX10-DL-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x34
1689 ; GFX10-DL-NEXT: v_mov_b32_e32 v3, 0
1690 ; GFX10-DL-NEXT: s_waitcnt lgkmcnt(0)
1691 ; GFX10-DL-NEXT: s_clause 0x1
1692 ; GFX10-DL-NEXT: global_load_dword v1, v0, s[6:7]
1693 ; GFX10-DL-NEXT: global_load_dword v2, v0, s[4:5]
1694 ; GFX10-DL-NEXT: s_load_dword s2, s[0:1], 0x0
1695 ; GFX10-DL-NEXT: s_waitcnt vmcnt(1)
1696 ; GFX10-DL-NEXT: v_perm_b32 v0, v1, v1, 0xc020003
1697 ; GFX10-DL-NEXT: s_waitcnt vmcnt(0)
1698 ; GFX10-DL-NEXT: v_perm_b32 v1, v2, v2, 0xc020003
1699 ; GFX10-DL-NEXT: s_waitcnt lgkmcnt(0)
1700 ; GFX10-DL-NEXT: v_mov_b32_e32 v2, s2
1701 ; GFX10-DL-NEXT: v_dot4c_i32_i8_e32 v2, v1, v0
1702 ; GFX10-DL-NEXT: global_store_dword v3, v2, s[0:1]
1703 ; GFX10-DL-NEXT: s_endpgm
1705 ; GFX11-DL-LABEL: idot4_acc32_3ele_permuted:
1706 ; GFX11-DL: ; %bb.0: ; %entry
1707 ; GFX11-DL-NEXT: s_load_b128 s[4:7], s[0:1], 0x24
1708 ; GFX11-DL-NEXT: v_lshlrev_b32_e32 v0, 2, v0
1709 ; GFX11-DL-NEXT: s_load_b64 s[0:1], s[0:1], 0x34
1710 ; GFX11-DL-NEXT: v_mov_b32_e32 v2, 0
1711 ; GFX11-DL-NEXT: s_waitcnt lgkmcnt(0)
1712 ; GFX11-DL-NEXT: s_clause 0x1
1713 ; GFX11-DL-NEXT: global_load_b32 v1, v0, s[6:7]
1714 ; GFX11-DL-NEXT: global_load_b32 v0, v0, s[4:5]
1715 ; GFX11-DL-NEXT: s_load_b32 s2, s[0:1], 0x0
1716 ; GFX11-DL-NEXT: s_waitcnt vmcnt(1)
1717 ; GFX11-DL-NEXT: v_perm_b32 v1, v1, v1, 0xc020003
1718 ; GFX11-DL-NEXT: s_waitcnt vmcnt(0)
1719 ; GFX11-DL-NEXT: v_perm_b32 v0, v0, v0, 0xc020003
1720 ; GFX11-DL-NEXT: s_waitcnt lgkmcnt(0)
1721 ; GFX11-DL-NEXT: s_delay_alu instid0(VALU_DEP_1)
1722 ; GFX11-DL-NEXT: v_dot4_i32_iu8 v0, v0, v1, s2 neg_lo:[1,1,0]
1723 ; GFX11-DL-NEXT: global_store_b32 v2, v0, s[0:1]
1724 ; GFX11-DL-NEXT: s_nop 0
1725 ; GFX11-DL-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
1726 ; GFX11-DL-NEXT: s_endpgm
1727 ptr addrspace(1) %src2,
1728 ptr addrspace(1) nocapture %dst) {
1730 %idx = call i32 @llvm.amdgcn.workitem.id.x()
1731 %gep1 = getelementptr <4 x i8>, ptr addrspace(1) %src1, i32 %idx
1732 %vec1 = load <4 x i8>, ptr addrspace(1) %gep1
1733 %gep2 = getelementptr <4 x i8>, ptr addrspace(1) %src2, i32 %idx
1734 %vec2 = load <4 x i8>, ptr addrspace(1) %gep2
1736 %v1e0 = extractelement <4 x i8> %vec1, i64 3
1737 %cv1e0 = sext i8 %v1e0 to i32
1738 %v2e0 = extractelement <4 x i8> %vec2, i64 3
1739 %cv2e0 = sext i8 %v2e0 to i32
1740 %mul1 = mul nuw nsw i32 %cv1e0, %cv2e0
1742 %v1e1 = extractelement <4 x i8> %vec1, i64 0
1743 %cv1e1 = sext i8 %v1e1 to i32
1744 %v2e1 = extractelement <4 x i8> %vec2, i64 0
1745 %cv2e1 = sext i8 %v2e1 to i32
1746 %mul2 = mul nuw nsw i32 %cv1e1, %cv2e1
1748 %v1e2 = extractelement <4 x i8> %vec1, i64 2
1749 %cv1e2 = sext i8 %v1e2 to i32
1750 %v2e2 = extractelement <4 x i8> %vec2, i64 2
1751 %cv2e2 = sext i8 %v2e2 to i32
1752 %mul3 = mul nuw nsw i32 %cv1e2, %cv2e2
1754 %acc = load i32, ptr addrspace(1) %dst, align 4
1755 %add1 = add i32 %mul1, %acc
1756 %add2 = add i32 %add1, %mul2
1757 %add3 = add i32 %add2, %mul3
1758 store i32 %add3, ptr addrspace(1) %dst, align 4
1762 define amdgpu_kernel void @idot4_acc32_opt(ptr addrspace(1) %src1,
1763 ; GFX7-LABEL: idot4_acc32_opt:
1764 ; GFX7: ; %bb.0: ; %entry
1765 ; GFX7-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x9
1766 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0xd
1767 ; GFX7-NEXT: s_mov_b32 s3, 0xf000
1768 ; GFX7-NEXT: s_mov_b32 s10, 0
1769 ; GFX7-NEXT: s_mov_b32 s11, s3
1770 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
1771 ; GFX7-NEXT: s_mov_b64 s[8:9], s[4:5]
1772 ; GFX7-NEXT: v_lshlrev_b32_e32 v0, 2, v0
1773 ; GFX7-NEXT: v_mov_b32_e32 v1, 0
1774 ; GFX7-NEXT: buffer_load_dword v2, v[0:1], s[8:11], 0 addr64
1775 ; GFX7-NEXT: s_mov_b64 s[8:9], s[6:7]
1776 ; GFX7-NEXT: buffer_load_dword v0, v[0:1], s[8:11], 0 addr64
1777 ; GFX7-NEXT: s_mov_b32 s2, -1
1778 ; GFX7-NEXT: s_waitcnt vmcnt(1)
1779 ; GFX7-NEXT: v_bfe_i32 v3, v2, 8, 8
1780 ; GFX7-NEXT: v_bfe_i32 v1, v2, 0, 8
1781 ; GFX7-NEXT: s_waitcnt vmcnt(0)
1782 ; GFX7-NEXT: v_bfe_i32 v6, v0, 8, 8
1783 ; GFX7-NEXT: v_bfe_i32 v5, v0, 0, 8
1784 ; GFX7-NEXT: v_mul_i32_i24_e32 v3, v3, v6
1785 ; GFX7-NEXT: v_bfe_i32 v4, v2, 16, 8
1786 ; GFX7-NEXT: v_bfe_i32 v7, v0, 16, 8
1787 ; GFX7-NEXT: v_mad_i32_i24 v1, v1, v5, v3
1788 ; GFX7-NEXT: v_ashrrev_i32_e32 v2, 24, v2
1789 ; GFX7-NEXT: v_ashrrev_i32_e32 v0, 24, v0
1790 ; GFX7-NEXT: v_mad_i32_i24 v1, v4, v7, v1
1791 ; GFX7-NEXT: v_mad_i32_i24 v0, v2, v0, v1
1792 ; GFX7-NEXT: buffer_store_dword v0, off, s[0:3], 0
1793 ; GFX7-NEXT: s_endpgm
1795 ; GFX8-LABEL: idot4_acc32_opt:
1796 ; GFX8: ; %bb.0: ; %entry
1797 ; GFX8-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x24
1798 ; GFX8-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x34
1799 ; GFX8-NEXT: v_lshlrev_b32_e32 v2, 2, v0
1800 ; GFX8-NEXT: s_waitcnt lgkmcnt(0)
1801 ; GFX8-NEXT: v_mov_b32_e32 v1, s5
1802 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, s4, v2
1803 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
1804 ; GFX8-NEXT: flat_load_dword v3, v[0:1]
1805 ; GFX8-NEXT: v_mov_b32_e32 v1, s7
1806 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, s6, v2
1807 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
1808 ; GFX8-NEXT: flat_load_dword v2, v[0:1]
1809 ; GFX8-NEXT: v_mov_b32_e32 v0, s0
1810 ; GFX8-NEXT: v_mov_b32_e32 v1, s1
1811 ; GFX8-NEXT: s_waitcnt vmcnt(1)
1812 ; GFX8-NEXT: v_bfe_i32 v4, v3, 0, 8
1813 ; GFX8-NEXT: v_bfe_i32 v7, v3, 16, 8
1814 ; GFX8-NEXT: s_waitcnt vmcnt(0)
1815 ; GFX8-NEXT: v_bfe_i32 v5, v2, 0, 8
1816 ; GFX8-NEXT: v_mul_i32_i24_sdwa v6, sext(v3), sext(v2) dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_1 src1_sel:BYTE_1
1817 ; GFX8-NEXT: v_bfe_i32 v8, v2, 16, 8
1818 ; GFX8-NEXT: v_mad_i32_i24 v4, v4, v5, v6
1819 ; GFX8-NEXT: v_ashrrev_i32_e32 v3, 24, v3
1820 ; GFX8-NEXT: v_ashrrev_i32_e32 v2, 24, v2
1821 ; GFX8-NEXT: v_mad_i32_i24 v4, v7, v8, v4
1822 ; GFX8-NEXT: v_mad_i32_i24 v2, v3, v2, v4
1823 ; GFX8-NEXT: flat_store_dword v[0:1], v2
1824 ; GFX8-NEXT: s_endpgm
1826 ; GFX9-NODL-LABEL: idot4_acc32_opt:
1827 ; GFX9-NODL: ; %bb.0: ; %entry
1828 ; GFX9-NODL-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x24
1829 ; GFX9-NODL-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x34
1830 ; GFX9-NODL-NEXT: v_lshlrev_b32_e32 v0, 2, v0
1831 ; GFX9-NODL-NEXT: s_waitcnt lgkmcnt(0)
1832 ; GFX9-NODL-NEXT: global_load_dword v1, v0, s[4:5]
1833 ; GFX9-NODL-NEXT: global_load_dword v2, v0, s[6:7]
1834 ; GFX9-NODL-NEXT: v_mov_b32_e32 v0, 0
1835 ; GFX9-NODL-NEXT: s_waitcnt vmcnt(1)
1836 ; GFX9-NODL-NEXT: v_bfe_i32 v3, v1, 0, 8
1837 ; GFX9-NODL-NEXT: s_waitcnt vmcnt(0)
1838 ; GFX9-NODL-NEXT: v_bfe_i32 v4, v2, 0, 8
1839 ; GFX9-NODL-NEXT: v_mul_i32_i24_sdwa v5, sext(v1), sext(v2) dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_1 src1_sel:BYTE_1
1840 ; GFX9-NODL-NEXT: v_mul_i32_i24_sdwa v6, sext(v1), sext(v2) dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_2 src1_sel:BYTE_2
1841 ; GFX9-NODL-NEXT: v_mul_i32_i24_sdwa v1, sext(v1), sext(v2) dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_3 src1_sel:BYTE_3
1842 ; GFX9-NODL-NEXT: v_mad_i32_i24 v2, v3, v4, v5
1843 ; GFX9-NODL-NEXT: v_add3_u32 v1, v2, v6, v1
1844 ; GFX9-NODL-NEXT: global_store_dword v0, v1, s[2:3]
1845 ; GFX9-NODL-NEXT: s_endpgm
1847 ; GFX9-DL-LABEL: idot4_acc32_opt:
1848 ; GFX9-DL: ; %bb.0: ; %entry
1849 ; GFX9-DL-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x24
1850 ; GFX9-DL-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x34
1851 ; GFX9-DL-NEXT: v_lshlrev_b32_e32 v0, 2, v0
1852 ; GFX9-DL-NEXT: s_waitcnt lgkmcnt(0)
1853 ; GFX9-DL-NEXT: global_load_dword v1, v0, s[4:5]
1854 ; GFX9-DL-NEXT: global_load_dword v2, v0, s[6:7]
1855 ; GFX9-DL-NEXT: v_mov_b32_e32 v0, 0
1856 ; GFX9-DL-NEXT: s_waitcnt vmcnt(0)
1857 ; GFX9-DL-NEXT: v_dot4_i32_i8 v1, v1, v2, 0
1858 ; GFX9-DL-NEXT: global_store_dword v0, v1, s[2:3]
1859 ; GFX9-DL-NEXT: s_endpgm
1861 ; GFX10-DL-LABEL: idot4_acc32_opt:
1862 ; GFX10-DL: ; %bb.0: ; %entry
1863 ; GFX10-DL-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x24
1864 ; GFX10-DL-NEXT: v_lshlrev_b32_e32 v0, 2, v0
1865 ; GFX10-DL-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x34
1866 ; GFX10-DL-NEXT: v_mov_b32_e32 v3, 0
1867 ; GFX10-DL-NEXT: s_waitcnt lgkmcnt(0)
1868 ; GFX10-DL-NEXT: s_clause 0x1
1869 ; GFX10-DL-NEXT: global_load_dword v1, v0, s[4:5]
1870 ; GFX10-DL-NEXT: global_load_dword v2, v0, s[6:7]
1871 ; GFX10-DL-NEXT: v_mov_b32_e32 v0, 0
1872 ; GFX10-DL-NEXT: s_waitcnt vmcnt(0)
1873 ; GFX10-DL-NEXT: v_dot4c_i32_i8_e32 v0, v1, v2
1874 ; GFX10-DL-NEXT: global_store_dword v3, v0, s[0:1]
1875 ; GFX10-DL-NEXT: s_endpgm
1877 ; GFX11-DL-LABEL: idot4_acc32_opt:
1878 ; GFX11-DL: ; %bb.0: ; %entry
1879 ; GFX11-DL-NEXT: s_load_b128 s[4:7], s[0:1], 0x24
1880 ; GFX11-DL-NEXT: v_lshlrev_b32_e32 v0, 2, v0
1881 ; GFX11-DL-NEXT: s_load_b64 s[0:1], s[0:1], 0x34
1882 ; GFX11-DL-NEXT: v_mov_b32_e32 v2, 0
1883 ; GFX11-DL-NEXT: s_waitcnt lgkmcnt(0)
1884 ; GFX11-DL-NEXT: s_clause 0x1
1885 ; GFX11-DL-NEXT: global_load_b32 v1, v0, s[4:5]
1886 ; GFX11-DL-NEXT: global_load_b32 v0, v0, s[6:7]
1887 ; GFX11-DL-NEXT: s_waitcnt vmcnt(0)
1888 ; GFX11-DL-NEXT: v_dot4_i32_iu8 v0, v1, v0, 0 neg_lo:[1,1,0]
1889 ; GFX11-DL-NEXT: global_store_b32 v2, v0, s[0:1]
1890 ; GFX11-DL-NEXT: s_nop 0
1891 ; GFX11-DL-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
1892 ; GFX11-DL-NEXT: s_endpgm
1893 ptr addrspace(1) %src2,
1894 ptr addrspace(1) nocapture %dst) {
1896 %idx = call i32 @llvm.amdgcn.workitem.id.x()
1897 %gep1 = getelementptr <4 x i8>, ptr addrspace(1) %src1, i32 %idx
1898 %vec1 = load <4 x i8>, ptr addrspace(1) %gep1
1899 %gep2 = getelementptr <4 x i8>, ptr addrspace(1) %src2, i32 %idx
1900 %vec2 = load <4 x i8>, ptr addrspace(1) %gep2
1902 %v1e0 = extractelement <4 x i8> %vec1, i64 0
1903 %cv1e0 = sext i8 %v1e0 to i32
1904 %v2e0 = extractelement <4 x i8> %vec2, i64 0
1905 %cv2e0 = sext i8 %v2e0 to i32
1906 %mul1 = mul nuw nsw i32 %cv1e0, %cv2e0
1908 %v1e1 = extractelement <4 x i8> %vec1, i64 1
1909 %cv1e1 = sext i8 %v1e1 to i32
1910 %v2e1 = extractelement <4 x i8> %vec2, i64 1
1911 %cv2e1 = sext i8 %v2e1 to i32
1912 %mul2 = mul nuw nsw i32 %cv1e1, %cv2e1
1914 %v1e2 = extractelement <4 x i8> %vec1, i64 2
1915 %cv1e2 = sext i8 %v1e2 to i32
1916 %v2e2 = extractelement <4 x i8> %vec2, i64 2
1917 %cv2e2 = sext i8 %v2e2 to i32
1918 %mul3 = mul nuw nsw i32 %cv1e2, %cv2e2
1920 %v1e3 = extractelement <4 x i8> %vec1, i64 3
1921 %cv1e3 = sext i8 %v1e3 to i32
1922 %v2e3 = extractelement <4 x i8> %vec2, i64 3
1923 %cv2e3 = sext i8 %v2e3 to i32
1924 %mul4 = mul nuw nsw i32 %cv1e3, %cv2e3
1926 %add2 = add i32 %mul1, %mul2
1927 %add3 = add i32 %add2, %mul3
1928 %add4 = add i32 %add3, %mul4
1929 store i32 %add4, ptr addrspace(1) %dst, align 4
1933 define amdgpu_kernel void @idot4_acc32_3src(ptr addrspace(1) %src1,
1934 ; GFX7-LABEL: idot4_acc32_3src:
1935 ; GFX7: ; %bb.0: ; %entry
1936 ; GFX7-NEXT: s_load_dwordx8 s[0:7], s[0:1], 0x9
1937 ; GFX7-NEXT: s_mov_b32 s11, 0xf000
1938 ; GFX7-NEXT: s_mov_b32 s14, 0
1939 ; GFX7-NEXT: s_mov_b32 s15, s11
1940 ; GFX7-NEXT: v_lshlrev_b32_e32 v0, 2, v0
1941 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
1942 ; GFX7-NEXT: s_mov_b64 s[12:13], s[0:1]
1943 ; GFX7-NEXT: v_mov_b32_e32 v1, 0
1944 ; GFX7-NEXT: buffer_load_dword v2, v[0:1], s[12:15], 0 addr64
1945 ; GFX7-NEXT: s_mov_b64 s[12:13], s[2:3]
1946 ; GFX7-NEXT: buffer_load_dword v3, v[0:1], s[12:15], 0 addr64
1947 ; GFX7-NEXT: s_mov_b64 s[12:13], s[4:5]
1948 ; GFX7-NEXT: buffer_load_dword v0, v[0:1], s[12:15], 0 addr64
1949 ; GFX7-NEXT: s_load_dword s0, s[6:7], 0x0
1950 ; GFX7-NEXT: s_mov_b32 s10, -1
1951 ; GFX7-NEXT: s_mov_b32 s8, s6
1952 ; GFX7-NEXT: s_mov_b32 s9, s7
1953 ; GFX7-NEXT: s_waitcnt vmcnt(2)
1954 ; GFX7-NEXT: v_bfe_i32 v1, v2, 0, 8
1955 ; GFX7-NEXT: v_bfe_i32 v4, v2, 8, 8
1956 ; GFX7-NEXT: s_waitcnt vmcnt(1)
1957 ; GFX7-NEXT: v_bfe_i32 v3, v3, 8, 8
1958 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
1959 ; GFX7-NEXT: v_mad_i32_i24 v1, v1, v1, s0
1960 ; GFX7-NEXT: v_bfe_i32 v5, v2, 16, 8
1961 ; GFX7-NEXT: s_waitcnt vmcnt(0)
1962 ; GFX7-NEXT: v_bfe_i32 v6, v0, 16, 8
1963 ; GFX7-NEXT: v_mad_i32_i24 v1, v4, v3, v1
1964 ; GFX7-NEXT: v_ashrrev_i32_e32 v2, 24, v2
1965 ; GFX7-NEXT: v_ashrrev_i32_e32 v0, 24, v0
1966 ; GFX7-NEXT: v_mad_i32_i24 v1, v5, v6, v1
1967 ; GFX7-NEXT: v_mad_i32_i24 v0, v2, v0, v1
1968 ; GFX7-NEXT: buffer_store_dword v0, off, s[8:11], 0
1969 ; GFX7-NEXT: s_endpgm
1971 ; GFX8-LABEL: idot4_acc32_3src:
1972 ; GFX8: ; %bb.0: ; %entry
1973 ; GFX8-NEXT: s_load_dwordx8 s[0:7], s[0:1], 0x24
1974 ; GFX8-NEXT: v_lshlrev_b32_e32 v2, 2, v0
1975 ; GFX8-NEXT: s_waitcnt lgkmcnt(0)
1976 ; GFX8-NEXT: v_mov_b32_e32 v1, s1
1977 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, s0, v2
1978 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
1979 ; GFX8-NEXT: flat_load_dword v3, v[0:1]
1980 ; GFX8-NEXT: v_mov_b32_e32 v1, s3
1981 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, s2, v2
1982 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
1983 ; GFX8-NEXT: flat_load_dword v4, v[0:1]
1984 ; GFX8-NEXT: v_mov_b32_e32 v1, s5
1985 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, s4, v2
1986 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
1987 ; GFX8-NEXT: flat_load_dword v0, v[0:1]
1988 ; GFX8-NEXT: s_load_dword s0, s[6:7], 0x0
1989 ; GFX8-NEXT: s_waitcnt vmcnt(2)
1990 ; GFX8-NEXT: v_bfe_i32 v1, v3, 0, 8
1991 ; GFX8-NEXT: v_bfe_i32 v2, v3, 8, 8
1992 ; GFX8-NEXT: s_waitcnt lgkmcnt(0)
1993 ; GFX8-NEXT: v_mad_i32_i24 v1, v1, v1, s0
1994 ; GFX8-NEXT: v_bfe_i32 v5, v3, 16, 8
1995 ; GFX8-NEXT: v_ashrrev_i32_e32 v3, 24, v3
1996 ; GFX8-NEXT: s_waitcnt vmcnt(1)
1997 ; GFX8-NEXT: v_bfe_i32 v4, v4, 8, 8
1998 ; GFX8-NEXT: v_mad_i32_i24 v1, v2, v4, v1
1999 ; GFX8-NEXT: s_waitcnt vmcnt(0)
2000 ; GFX8-NEXT: v_bfe_i32 v6, v0, 16, 8
2001 ; GFX8-NEXT: v_ashrrev_i32_e32 v0, 24, v0
2002 ; GFX8-NEXT: v_mad_i32_i24 v1, v5, v6, v1
2003 ; GFX8-NEXT: v_mad_i32_i24 v2, v3, v0, v1
2004 ; GFX8-NEXT: v_mov_b32_e32 v0, s6
2005 ; GFX8-NEXT: v_mov_b32_e32 v1, s7
2006 ; GFX8-NEXT: flat_store_dword v[0:1], v2
2007 ; GFX8-NEXT: s_endpgm
2009 ; GFX9-NODL-LABEL: idot4_acc32_3src:
2010 ; GFX9-NODL: ; %bb.0: ; %entry
2011 ; GFX9-NODL-NEXT: s_load_dwordx8 s[0:7], s[0:1], 0x24
2012 ; GFX9-NODL-NEXT: v_lshlrev_b32_e32 v0, 2, v0
2013 ; GFX9-NODL-NEXT: s_waitcnt lgkmcnt(0)
2014 ; GFX9-NODL-NEXT: global_load_dword v1, v0, s[0:1]
2015 ; GFX9-NODL-NEXT: global_load_dword v2, v0, s[2:3]
2016 ; GFX9-NODL-NEXT: global_load_dword v3, v0, s[4:5]
2017 ; GFX9-NODL-NEXT: s_load_dword s0, s[6:7], 0x0
2018 ; GFX9-NODL-NEXT: v_mov_b32_e32 v0, 0
2019 ; GFX9-NODL-NEXT: s_waitcnt vmcnt(2)
2020 ; GFX9-NODL-NEXT: v_mul_i32_i24_sdwa v4, sext(v1), sext(v1) dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:BYTE_0
2021 ; GFX9-NODL-NEXT: s_waitcnt vmcnt(1)
2022 ; GFX9-NODL-NEXT: v_mul_i32_i24_sdwa v2, sext(v1), sext(v2) dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_1 src1_sel:BYTE_1
2023 ; GFX9-NODL-NEXT: s_waitcnt vmcnt(0)
2024 ; GFX9-NODL-NEXT: v_mul_i32_i24_sdwa v5, sext(v1), sext(v3) dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_2 src1_sel:BYTE_2
2025 ; GFX9-NODL-NEXT: v_mul_i32_i24_sdwa v1, sext(v1), sext(v3) dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_3 src1_sel:BYTE_3
2026 ; GFX9-NODL-NEXT: s_waitcnt lgkmcnt(0)
2027 ; GFX9-NODL-NEXT: v_add3_u32 v2, v4, s0, v2
2028 ; GFX9-NODL-NEXT: v_add3_u32 v1, v2, v5, v1
2029 ; GFX9-NODL-NEXT: global_store_dword v0, v1, s[6:7]
2030 ; GFX9-NODL-NEXT: s_endpgm
2032 ; GFX9-DL-LABEL: idot4_acc32_3src:
2033 ; GFX9-DL: ; %bb.0: ; %entry
2034 ; GFX9-DL-NEXT: s_load_dwordx8 s[0:7], s[0:1], 0x24
2035 ; GFX9-DL-NEXT: v_lshlrev_b32_e32 v0, 2, v0
2036 ; GFX9-DL-NEXT: s_waitcnt lgkmcnt(0)
2037 ; GFX9-DL-NEXT: global_load_dword v1, v0, s[2:3]
2038 ; GFX9-DL-NEXT: global_load_dword v2, v0, s[4:5]
2039 ; GFX9-DL-NEXT: global_load_dword v3, v0, s[0:1]
2040 ; GFX9-DL-NEXT: s_load_dword s1, s[6:7], 0x0
2041 ; GFX9-DL-NEXT: s_mov_b32 s0, 0x706010c
2042 ; GFX9-DL-NEXT: s_mov_b32 s2, 0xc0c0c00
2043 ; GFX9-DL-NEXT: v_mov_b32_e32 v0, 0
2044 ; GFX9-DL-NEXT: s_waitcnt vmcnt(1)
2045 ; GFX9-DL-NEXT: v_perm_b32 v1, v2, v1, s0
2046 ; GFX9-DL-NEXT: s_waitcnt vmcnt(0)
2047 ; GFX9-DL-NEXT: v_perm_b32 v2, v3, v3, s2
2048 ; GFX9-DL-NEXT: v_or_b32_e32 v1, v1, v2
2049 ; GFX9-DL-NEXT: s_waitcnt lgkmcnt(0)
2050 ; GFX9-DL-NEXT: v_dot4_i32_i8 v1, v3, v1, s1
2051 ; GFX9-DL-NEXT: global_store_dword v0, v1, s[6:7]
2052 ; GFX9-DL-NEXT: s_endpgm
2054 ; GFX10-DL-LABEL: idot4_acc32_3src:
2055 ; GFX10-DL: ; %bb.0: ; %entry
2056 ; GFX10-DL-NEXT: s_load_dwordx8 s[0:7], s[0:1], 0x24
2057 ; GFX10-DL-NEXT: v_lshlrev_b32_e32 v0, 2, v0
2058 ; GFX10-DL-NEXT: s_waitcnt lgkmcnt(0)
2059 ; GFX10-DL-NEXT: s_clause 0x2
2060 ; GFX10-DL-NEXT: global_load_dword v1, v0, s[2:3]
2061 ; GFX10-DL-NEXT: global_load_dword v2, v0, s[4:5]
2062 ; GFX10-DL-NEXT: global_load_dword v3, v0, s[0:1]
2063 ; GFX10-DL-NEXT: s_waitcnt_depctr 0xffe3
2064 ; GFX10-DL-NEXT: s_load_dword s0, s[6:7], 0x0
2065 ; GFX10-DL-NEXT: s_waitcnt vmcnt(1)
2066 ; GFX10-DL-NEXT: v_perm_b32 v0, v2, v1, 0x706010c
2067 ; GFX10-DL-NEXT: s_waitcnt vmcnt(0)
2068 ; GFX10-DL-NEXT: v_perm_b32 v1, v3, v3, 0xc0c0c00
2069 ; GFX10-DL-NEXT: v_mov_b32_e32 v2, 0
2070 ; GFX10-DL-NEXT: v_or_b32_e32 v0, v0, v1
2071 ; GFX10-DL-NEXT: s_waitcnt lgkmcnt(0)
2072 ; GFX10-DL-NEXT: v_mov_b32_e32 v1, s0
2073 ; GFX10-DL-NEXT: v_dot4c_i32_i8_e32 v1, v3, v0
2074 ; GFX10-DL-NEXT: global_store_dword v2, v1, s[6:7]
2075 ; GFX10-DL-NEXT: s_endpgm
2077 ; GFX11-DL-LABEL: idot4_acc32_3src:
2078 ; GFX11-DL: ; %bb.0: ; %entry
2079 ; GFX11-DL-NEXT: s_load_b256 s[0:7], s[0:1], 0x24
2080 ; GFX11-DL-NEXT: v_lshlrev_b32_e32 v0, 2, v0
2081 ; GFX11-DL-NEXT: s_waitcnt lgkmcnt(0)
2082 ; GFX11-DL-NEXT: s_clause 0x2
2083 ; GFX11-DL-NEXT: global_load_b32 v1, v0, s[2:3]
2084 ; GFX11-DL-NEXT: global_load_b32 v2, v0, s[4:5]
2085 ; GFX11-DL-NEXT: global_load_b32 v0, v0, s[0:1]
2086 ; GFX11-DL-NEXT: s_load_b32 s0, s[6:7], 0x0
2087 ; GFX11-DL-NEXT: s_waitcnt vmcnt(1)
2088 ; GFX11-DL-NEXT: v_perm_b32 v1, v2, v1, 0x706010c
2089 ; GFX11-DL-NEXT: s_waitcnt vmcnt(0)
2090 ; GFX11-DL-NEXT: v_perm_b32 v2, v0, v0, 0xc0c0c00
2091 ; GFX11-DL-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_2)
2092 ; GFX11-DL-NEXT: v_or_b32_e32 v1, v1, v2
2093 ; GFX11-DL-NEXT: v_mov_b32_e32 v2, 0
2094 ; GFX11-DL-NEXT: s_waitcnt lgkmcnt(0)
2095 ; GFX11-DL-NEXT: v_dot4_i32_iu8 v0, v0, v1, s0 neg_lo:[1,1,0]
2096 ; GFX11-DL-NEXT: global_store_b32 v2, v0, s[6:7]
2097 ; GFX11-DL-NEXT: s_nop 0
2098 ; GFX11-DL-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
2099 ; GFX11-DL-NEXT: s_endpgm
2100 ptr addrspace(1) %src2,
2101 ptr addrspace(1) %src3,
2102 ptr addrspace(1) nocapture %dst) {
2104 %idx = call i32 @llvm.amdgcn.workitem.id.x()
2105 %gep1 = getelementptr <4 x i8>, ptr addrspace(1) %src1, i32 %idx
2106 %vec1 = load <4 x i8>, ptr addrspace(1) %gep1
2107 %gep2 = getelementptr <4 x i8>, ptr addrspace(1) %src2, i32 %idx
2108 %vec2 = load <4 x i8>, ptr addrspace(1) %gep2
2109 %gep3 = getelementptr <4 x i8>, ptr addrspace(1) %src3, i32 %idx
2110 %vec3 = load <4 x i8>, ptr addrspace(1) %gep3
2112 %v1e0 = extractelement <4 x i8> %vec1, i64 0
2113 %cv1e0 = sext i8 %v1e0 to i32
2114 %mul1 = mul nuw nsw i32 %cv1e0, %cv1e0
2116 %v1e1 = extractelement <4 x i8> %vec1, i64 1
2117 %cv1e1 = sext i8 %v1e1 to i32
2118 %v2e1 = extractelement <4 x i8> %vec2, i64 1
2119 %cv2e1 = sext i8 %v2e1 to i32
2120 %mul2 = mul nuw nsw i32 %cv1e1, %cv2e1
2122 %v1e2 = extractelement <4 x i8> %vec1, i64 2
2123 %cv1e2 = sext i8 %v1e2 to i32
2124 %v3e2 = extractelement <4 x i8> %vec3, i64 2
2125 %cv3e2 = sext i8 %v3e2 to i32
2126 %mul3 = mul nuw nsw i32 %cv1e2, %cv3e2
2128 %v1e3 = extractelement <4 x i8> %vec1, i64 3
2129 %cv1e3 = sext i8 %v1e3 to i32
2130 %v3e3 = extractelement <4 x i8> %vec3, i64 3
2131 %cv3e3 = sext i8 %v3e3 to i32
2132 %mul4 = mul nuw nsw i32 %cv1e3, %cv3e3
2134 %acc = load i32, ptr addrspace(1) %dst, align 4
2135 %add1 = add i32 %mul1, %acc
2136 %add2 = add i32 %add1, %mul2
2137 %add3 = add i32 %add2, %mul3
2138 %add4 = add i32 %add3, %mul4
2139 store i32 %add4, ptr addrspace(1) %dst, align 4
2143 define amdgpu_kernel void @idot4_acc32_3src_3ele(ptr addrspace(1) %src1,
2144 ; GFX7-LABEL: idot4_acc32_3src_3ele:
2145 ; GFX7: ; %bb.0: ; %entry
2146 ; GFX7-NEXT: s_load_dwordx8 s[0:7], s[0:1], 0x9
2147 ; GFX7-NEXT: s_mov_b32 s11, 0xf000
2148 ; GFX7-NEXT: s_mov_b32 s14, 0
2149 ; GFX7-NEXT: s_mov_b32 s15, s11
2150 ; GFX7-NEXT: v_lshlrev_b32_e32 v0, 2, v0
2151 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
2152 ; GFX7-NEXT: s_mov_b64 s[12:13], s[0:1]
2153 ; GFX7-NEXT: v_mov_b32_e32 v1, 0
2154 ; GFX7-NEXT: buffer_load_dword v2, v[0:1], s[12:15], 0 addr64
2155 ; GFX7-NEXT: s_mov_b64 s[12:13], s[2:3]
2156 ; GFX7-NEXT: buffer_load_dword v3, v[0:1], s[12:15], 0 addr64
2157 ; GFX7-NEXT: s_mov_b64 s[12:13], s[4:5]
2158 ; GFX7-NEXT: buffer_load_dword v0, v[0:1], s[12:15], 0 addr64
2159 ; GFX7-NEXT: s_load_dword s0, s[6:7], 0x0
2160 ; GFX7-NEXT: s_mov_b32 s10, -1
2161 ; GFX7-NEXT: s_mov_b32 s8, s6
2162 ; GFX7-NEXT: s_mov_b32 s9, s7
2163 ; GFX7-NEXT: s_waitcnt vmcnt(2)
2164 ; GFX7-NEXT: v_bfe_i32 v1, v2, 0, 8
2165 ; GFX7-NEXT: v_bfe_i32 v4, v2, 8, 8
2166 ; GFX7-NEXT: s_waitcnt vmcnt(1)
2167 ; GFX7-NEXT: v_bfe_i32 v3, v3, 8, 8
2168 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
2169 ; GFX7-NEXT: v_mad_i32_i24 v1, v1, v1, s0
2170 ; GFX7-NEXT: v_bfe_i32 v2, v2, 16, 8
2171 ; GFX7-NEXT: s_waitcnt vmcnt(0)
2172 ; GFX7-NEXT: v_bfe_i32 v0, v0, 16, 8
2173 ; GFX7-NEXT: v_mad_i32_i24 v1, v4, v3, v1
2174 ; GFX7-NEXT: v_mad_i32_i24 v0, v2, v0, v1
2175 ; GFX7-NEXT: buffer_store_dword v0, off, s[8:11], 0
2176 ; GFX7-NEXT: s_endpgm
2178 ; GFX8-LABEL: idot4_acc32_3src_3ele:
2179 ; GFX8: ; %bb.0: ; %entry
2180 ; GFX8-NEXT: s_load_dwordx8 s[0:7], s[0:1], 0x24
2181 ; GFX8-NEXT: v_lshlrev_b32_e32 v2, 2, v0
2182 ; GFX8-NEXT: s_waitcnt lgkmcnt(0)
2183 ; GFX8-NEXT: v_mov_b32_e32 v1, s1
2184 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, s0, v2
2185 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
2186 ; GFX8-NEXT: flat_load_dword v3, v[0:1]
2187 ; GFX8-NEXT: v_mov_b32_e32 v1, s3
2188 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, s2, v2
2189 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
2190 ; GFX8-NEXT: flat_load_dword v4, v[0:1]
2191 ; GFX8-NEXT: v_mov_b32_e32 v1, s5
2192 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, s4, v2
2193 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
2194 ; GFX8-NEXT: flat_load_dword v0, v[0:1]
2195 ; GFX8-NEXT: s_load_dword s0, s[6:7], 0x0
2196 ; GFX8-NEXT: s_waitcnt vmcnt(2)
2197 ; GFX8-NEXT: v_bfe_i32 v1, v3, 0, 8
2198 ; GFX8-NEXT: v_bfe_i32 v2, v3, 8, 8
2199 ; GFX8-NEXT: s_waitcnt lgkmcnt(0)
2200 ; GFX8-NEXT: v_mad_i32_i24 v1, v1, v1, s0
2201 ; GFX8-NEXT: v_bfe_i32 v3, v3, 16, 8
2202 ; GFX8-NEXT: s_waitcnt vmcnt(1)
2203 ; GFX8-NEXT: v_bfe_i32 v4, v4, 8, 8
2204 ; GFX8-NEXT: v_mad_i32_i24 v1, v2, v4, v1
2205 ; GFX8-NEXT: s_waitcnt vmcnt(0)
2206 ; GFX8-NEXT: v_bfe_i32 v0, v0, 16, 8
2207 ; GFX8-NEXT: v_mad_i32_i24 v2, v3, v0, v1
2208 ; GFX8-NEXT: v_mov_b32_e32 v0, s6
2209 ; GFX8-NEXT: v_mov_b32_e32 v1, s7
2210 ; GFX8-NEXT: flat_store_dword v[0:1], v2
2211 ; GFX8-NEXT: s_endpgm
2213 ; GFX9-NODL-LABEL: idot4_acc32_3src_3ele:
2214 ; GFX9-NODL: ; %bb.0: ; %entry
2215 ; GFX9-NODL-NEXT: s_load_dwordx8 s[0:7], s[0:1], 0x24
2216 ; GFX9-NODL-NEXT: v_lshlrev_b32_e32 v0, 2, v0
2217 ; GFX9-NODL-NEXT: s_waitcnt lgkmcnt(0)
2218 ; GFX9-NODL-NEXT: global_load_dword v1, v0, s[0:1]
2219 ; GFX9-NODL-NEXT: global_load_dword v2, v0, s[2:3]
2220 ; GFX9-NODL-NEXT: global_load_dword v3, v0, s[4:5]
2221 ; GFX9-NODL-NEXT: s_load_dword s0, s[6:7], 0x0
2222 ; GFX9-NODL-NEXT: v_mov_b32_e32 v0, 0
2223 ; GFX9-NODL-NEXT: s_waitcnt vmcnt(2)
2224 ; GFX9-NODL-NEXT: v_bfe_i32 v4, v1, 0, 8
2225 ; GFX9-NODL-NEXT: s_waitcnt vmcnt(1)
2226 ; GFX9-NODL-NEXT: v_mul_i32_i24_sdwa v2, sext(v1), sext(v2) dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_1 src1_sel:BYTE_1
2227 ; GFX9-NODL-NEXT: s_waitcnt vmcnt(0)
2228 ; GFX9-NODL-NEXT: v_mul_i32_i24_sdwa v1, sext(v1), sext(v3) dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_2 src1_sel:BYTE_2
2229 ; GFX9-NODL-NEXT: s_waitcnt lgkmcnt(0)
2230 ; GFX9-NODL-NEXT: v_mad_i32_i24 v3, v4, v4, s0
2231 ; GFX9-NODL-NEXT: v_add3_u32 v1, v3, v2, v1
2232 ; GFX9-NODL-NEXT: global_store_dword v0, v1, s[6:7]
2233 ; GFX9-NODL-NEXT: s_endpgm
2235 ; GFX9-DL-LABEL: idot4_acc32_3src_3ele:
2236 ; GFX9-DL: ; %bb.0: ; %entry
2237 ; GFX9-DL-NEXT: s_load_dwordx8 s[0:7], s[0:1], 0x24
2238 ; GFX9-DL-NEXT: v_lshlrev_b32_e32 v0, 2, v0
2239 ; GFX9-DL-NEXT: s_waitcnt lgkmcnt(0)
2240 ; GFX9-DL-NEXT: global_load_dword v1, v0, s[2:3]
2241 ; GFX9-DL-NEXT: global_load_dword v2, v0, s[4:5]
2242 ; GFX9-DL-NEXT: global_load_dword v3, v0, s[0:1]
2243 ; GFX9-DL-NEXT: s_load_dword s3, s[6:7], 0x0
2244 ; GFX9-DL-NEXT: s_mov_b32 s0, 0xc06010c
2245 ; GFX9-DL-NEXT: s_mov_b32 s1, 0xc0c0c00
2246 ; GFX9-DL-NEXT: s_mov_b32 s2, 0xc020100
2247 ; GFX9-DL-NEXT: v_mov_b32_e32 v0, 0
2248 ; GFX9-DL-NEXT: s_waitcnt vmcnt(1)
2249 ; GFX9-DL-NEXT: v_perm_b32 v1, v2, v1, s0
2250 ; GFX9-DL-NEXT: s_waitcnt vmcnt(0)
2251 ; GFX9-DL-NEXT: v_perm_b32 v2, v3, v3, s1
2252 ; GFX9-DL-NEXT: v_or_b32_e32 v1, v1, v2
2253 ; GFX9-DL-NEXT: v_perm_b32 v2, v3, v3, s2
2254 ; GFX9-DL-NEXT: s_waitcnt lgkmcnt(0)
2255 ; GFX9-DL-NEXT: v_dot4_i32_i8 v1, v2, v1, s3
2256 ; GFX9-DL-NEXT: global_store_dword v0, v1, s[6:7]
2257 ; GFX9-DL-NEXT: s_endpgm
2259 ; GFX10-DL-LABEL: idot4_acc32_3src_3ele:
2260 ; GFX10-DL: ; %bb.0: ; %entry
2261 ; GFX10-DL-NEXT: s_load_dwordx8 s[0:7], s[0:1], 0x24
2262 ; GFX10-DL-NEXT: v_lshlrev_b32_e32 v0, 2, v0
2263 ; GFX10-DL-NEXT: s_waitcnt lgkmcnt(0)
2264 ; GFX10-DL-NEXT: s_clause 0x2
2265 ; GFX10-DL-NEXT: global_load_dword v1, v0, s[2:3]
2266 ; GFX10-DL-NEXT: global_load_dword v2, v0, s[4:5]
2267 ; GFX10-DL-NEXT: global_load_dword v3, v0, s[0:1]
2268 ; GFX10-DL-NEXT: s_waitcnt_depctr 0xffe3
2269 ; GFX10-DL-NEXT: s_load_dword s0, s[6:7], 0x0
2270 ; GFX10-DL-NEXT: s_waitcnt vmcnt(1)
2271 ; GFX10-DL-NEXT: v_perm_b32 v0, v2, v1, 0xc06010c
2272 ; GFX10-DL-NEXT: s_waitcnt vmcnt(0)
2273 ; GFX10-DL-NEXT: v_perm_b32 v1, v3, v3, 0xc0c0c00
2274 ; GFX10-DL-NEXT: v_perm_b32 v2, v3, v3, 0xc020100
2275 ; GFX10-DL-NEXT: v_mov_b32_e32 v3, 0
2276 ; GFX10-DL-NEXT: v_or_b32_e32 v0, v0, v1
2277 ; GFX10-DL-NEXT: s_waitcnt lgkmcnt(0)
2278 ; GFX10-DL-NEXT: v_mov_b32_e32 v1, s0
2279 ; GFX10-DL-NEXT: v_dot4c_i32_i8_e32 v1, v2, v0
2280 ; GFX10-DL-NEXT: global_store_dword v3, v1, s[6:7]
2281 ; GFX10-DL-NEXT: s_endpgm
2283 ; GFX11-DL-LABEL: idot4_acc32_3src_3ele:
2284 ; GFX11-DL: ; %bb.0: ; %entry
2285 ; GFX11-DL-NEXT: s_load_b256 s[0:7], s[0:1], 0x24
2286 ; GFX11-DL-NEXT: v_lshlrev_b32_e32 v0, 2, v0
2287 ; GFX11-DL-NEXT: s_waitcnt lgkmcnt(0)
2288 ; GFX11-DL-NEXT: s_clause 0x2
2289 ; GFX11-DL-NEXT: global_load_b32 v1, v0, s[2:3]
2290 ; GFX11-DL-NEXT: global_load_b32 v2, v0, s[4:5]
2291 ; GFX11-DL-NEXT: global_load_b32 v0, v0, s[0:1]
2292 ; GFX11-DL-NEXT: s_load_b32 s0, s[6:7], 0x0
2293 ; GFX11-DL-NEXT: s_waitcnt vmcnt(1)
2294 ; GFX11-DL-NEXT: v_perm_b32 v1, v2, v1, 0xc06010c
2295 ; GFX11-DL-NEXT: s_waitcnt vmcnt(0)
2296 ; GFX11-DL-NEXT: v_perm_b32 v2, v0, v0, 0xc0c0c00
2297 ; GFX11-DL-NEXT: v_perm_b32 v0, v0, v0, 0xc020100
2298 ; GFX11-DL-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_2) | instid1(VALU_DEP_2)
2299 ; GFX11-DL-NEXT: v_or_b32_e32 v1, v1, v2
2300 ; GFX11-DL-NEXT: v_mov_b32_e32 v2, 0
2301 ; GFX11-DL-NEXT: s_waitcnt lgkmcnt(0)
2302 ; GFX11-DL-NEXT: v_dot4_i32_iu8 v0, v0, v1, s0 neg_lo:[1,1,0]
2303 ; GFX11-DL-NEXT: global_store_b32 v2, v0, s[6:7]
2304 ; GFX11-DL-NEXT: s_nop 0
2305 ; GFX11-DL-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
2306 ; GFX11-DL-NEXT: s_endpgm
2307 ptr addrspace(1) %src2,
2308 ptr addrspace(1) %src3,
2309 ptr addrspace(1) nocapture %dst) {
2311 %idx = call i32 @llvm.amdgcn.workitem.id.x()
2312 %gep1 = getelementptr <4 x i8>, ptr addrspace(1) %src1, i32 %idx
2313 %vec1 = load <4 x i8>, ptr addrspace(1) %gep1
2314 %gep2 = getelementptr <4 x i8>, ptr addrspace(1) %src2, i32 %idx
2315 %vec2 = load <4 x i8>, ptr addrspace(1) %gep2
2316 %gep3 = getelementptr <4 x i8>, ptr addrspace(1) %src3, i32 %idx
2317 %vec3 = load <4 x i8>, ptr addrspace(1) %gep3
2319 %v1e0 = extractelement <4 x i8> %vec1, i64 0
2320 %cv1e0 = sext i8 %v1e0 to i32
2321 %mul1 = mul nuw nsw i32 %cv1e0, %cv1e0
2323 %v1e1 = extractelement <4 x i8> %vec1, i64 1
2324 %cv1e1 = sext i8 %v1e1 to i32
2325 %v2e1 = extractelement <4 x i8> %vec2, i64 1
2326 %cv2e1 = sext i8 %v2e1 to i32
2327 %mul2 = mul nuw nsw i32 %cv1e1, %cv2e1
2329 %v1e2 = extractelement <4 x i8> %vec1, i64 2
2330 %cv1e2 = sext i8 %v1e2 to i32
2331 %v3e2 = extractelement <4 x i8> %vec3, i64 2
2332 %cv3e2 = sext i8 %v3e2 to i32
2333 %mul3 = mul nuw nsw i32 %cv1e2, %cv3e2
2335 %acc = load i32, ptr addrspace(1) %dst, align 4
2336 %add1 = add i32 %mul1, %acc
2337 %add2 = add i32 %add1, %mul2
2338 %add3 = add i32 %add2, %mul3
2339 store i32 %add3, ptr addrspace(1) %dst, align 4
2343 define amdgpu_kernel void @idot4_bad_source(ptr addrspace(1) %src1,
2344 ; GFX7-LABEL: idot4_bad_source:
2345 ; GFX7: ; %bb.0: ; %entry
2346 ; GFX7-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x9
2347 ; GFX7-NEXT: s_load_dword s12, s[0:1], 0xf
2348 ; GFX7-NEXT: s_mov_b32 s3, 0xf000
2349 ; GFX7-NEXT: s_mov_b32 s10, 0
2350 ; GFX7-NEXT: s_mov_b32 s11, s3
2351 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
2352 ; GFX7-NEXT: s_mov_b64 s[8:9], s[4:5]
2353 ; GFX7-NEXT: v_lshlrev_b32_e32 v0, 2, v0
2354 ; GFX7-NEXT: v_mov_b32_e32 v1, 0
2355 ; GFX7-NEXT: buffer_load_dword v2, v[0:1], s[8:11], 0 addr64
2356 ; GFX7-NEXT: s_mov_b64 s[8:9], s[6:7]
2357 ; GFX7-NEXT: buffer_load_dword v0, v[0:1], s[8:11], 0 addr64
2358 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x11
2359 ; GFX7-NEXT: s_sext_i32_i16 s5, s12
2360 ; GFX7-NEXT: s_mov_b32 s2, -1
2361 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
2362 ; GFX7-NEXT: s_load_dword s4, s[0:1], 0x0
2363 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
2364 ; GFX7-NEXT: v_mov_b32_e32 v1, s4
2365 ; GFX7-NEXT: s_waitcnt vmcnt(1)
2366 ; GFX7-NEXT: v_bfe_i32 v3, v2, 0, 8
2367 ; GFX7-NEXT: v_bfe_i32 v4, v2, 8, 8
2368 ; GFX7-NEXT: s_waitcnt vmcnt(0)
2369 ; GFX7-NEXT: v_bfe_i32 v5, v0, 8, 8
2370 ; GFX7-NEXT: v_mad_i32_i24 v1, v3, s5, v1
2371 ; GFX7-NEXT: v_bfe_i32 v2, v2, 16, 8
2372 ; GFX7-NEXT: v_bfe_i32 v0, v0, 16, 8
2373 ; GFX7-NEXT: v_mad_i32_i24 v1, v4, v5, v1
2374 ; GFX7-NEXT: v_mad_i32_i24 v0, v2, v0, v1
2375 ; GFX7-NEXT: buffer_store_dword v0, off, s[0:3], 0
2376 ; GFX7-NEXT: s_endpgm
2378 ; GFX8-LABEL: idot4_bad_source:
2379 ; GFX8: ; %bb.0: ; %entry
2380 ; GFX8-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x24
2381 ; GFX8-NEXT: s_load_dword s2, s[0:1], 0x3c
2382 ; GFX8-NEXT: v_lshlrev_b32_e32 v2, 2, v0
2383 ; GFX8-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x44
2384 ; GFX8-NEXT: s_waitcnt lgkmcnt(0)
2385 ; GFX8-NEXT: v_mov_b32_e32 v1, s5
2386 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, s4, v2
2387 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
2388 ; GFX8-NEXT: flat_load_dword v3, v[0:1]
2389 ; GFX8-NEXT: v_mov_b32_e32 v1, s7
2390 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, s6, v2
2391 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
2392 ; GFX8-NEXT: flat_load_dword v0, v[0:1]
2393 ; GFX8-NEXT: s_load_dword s3, s[0:1], 0x0
2394 ; GFX8-NEXT: s_sext_i32_i16 s2, s2
2395 ; GFX8-NEXT: s_waitcnt lgkmcnt(0)
2396 ; GFX8-NEXT: v_mov_b32_e32 v1, s3
2397 ; GFX8-NEXT: s_waitcnt vmcnt(1)
2398 ; GFX8-NEXT: v_bfe_i32 v2, v3, 0, 8
2399 ; GFX8-NEXT: v_bfe_i32 v4, v3, 8, 8
2400 ; GFX8-NEXT: v_mad_i32_i24 v1, v2, s2, v1
2401 ; GFX8-NEXT: v_bfe_i32 v3, v3, 16, 8
2402 ; GFX8-NEXT: s_waitcnt vmcnt(0)
2403 ; GFX8-NEXT: v_bfe_i32 v5, v0, 8, 8
2404 ; GFX8-NEXT: v_bfe_i32 v0, v0, 16, 8
2405 ; GFX8-NEXT: v_mad_i32_i24 v1, v4, v5, v1
2406 ; GFX8-NEXT: v_mad_i32_i24 v2, v3, v0, v1
2407 ; GFX8-NEXT: v_mov_b32_e32 v0, s0
2408 ; GFX8-NEXT: v_mov_b32_e32 v1, s1
2409 ; GFX8-NEXT: flat_store_dword v[0:1], v2
2410 ; GFX8-NEXT: s_endpgm
2412 ; GFX9-NODL-LABEL: idot4_bad_source:
2413 ; GFX9-NODL: ; %bb.0: ; %entry
2414 ; GFX9-NODL-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x24
2415 ; GFX9-NODL-NEXT: s_load_dword s2, s[0:1], 0x3c
2416 ; GFX9-NODL-NEXT: v_lshlrev_b32_e32 v0, 2, v0
2417 ; GFX9-NODL-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x44
2418 ; GFX9-NODL-NEXT: s_waitcnt lgkmcnt(0)
2419 ; GFX9-NODL-NEXT: global_load_dword v1, v0, s[4:5]
2420 ; GFX9-NODL-NEXT: global_load_dword v2, v0, s[6:7]
2421 ; GFX9-NODL-NEXT: s_sext_i32_i16 s2, s2
2422 ; GFX9-NODL-NEXT: v_mov_b32_e32 v0, 0
2423 ; GFX9-NODL-NEXT: s_load_dword s3, s[0:1], 0x0
2424 ; GFX9-NODL-NEXT: s_waitcnt vmcnt(1)
2425 ; GFX9-NODL-NEXT: v_bfe_i32 v3, v1, 0, 8
2426 ; GFX9-NODL-NEXT: s_waitcnt vmcnt(0)
2427 ; GFX9-NODL-NEXT: v_mul_i32_i24_sdwa v4, sext(v1), sext(v2) dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_1 src1_sel:BYTE_1
2428 ; GFX9-NODL-NEXT: v_mul_i32_i24_sdwa v1, sext(v1), sext(v2) dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_2 src1_sel:BYTE_2
2429 ; GFX9-NODL-NEXT: s_waitcnt lgkmcnt(0)
2430 ; GFX9-NODL-NEXT: v_mov_b32_e32 v2, s3
2431 ; GFX9-NODL-NEXT: v_mad_i32_i24 v2, v3, s2, v2
2432 ; GFX9-NODL-NEXT: v_add3_u32 v1, v2, v4, v1
2433 ; GFX9-NODL-NEXT: global_store_dword v0, v1, s[0:1]
2434 ; GFX9-NODL-NEXT: s_endpgm
2436 ; GFX9-DL-LABEL: idot4_bad_source:
2437 ; GFX9-DL: ; %bb.0: ; %entry
2438 ; GFX9-DL-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x24
2439 ; GFX9-DL-NEXT: s_load_dword s2, s[0:1], 0x3c
2440 ; GFX9-DL-NEXT: v_lshlrev_b32_e32 v0, 2, v0
2441 ; GFX9-DL-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x44
2442 ; GFX9-DL-NEXT: s_waitcnt lgkmcnt(0)
2443 ; GFX9-DL-NEXT: global_load_dword v1, v0, s[4:5]
2444 ; GFX9-DL-NEXT: global_load_dword v2, v0, s[6:7]
2445 ; GFX9-DL-NEXT: s_mov_b32 s4, 0xc0c0201
2446 ; GFX9-DL-NEXT: s_sext_i32_i16 s2, s2
2447 ; GFX9-DL-NEXT: s_load_dword s3, s[0:1], 0x0
2448 ; GFX9-DL-NEXT: v_mov_b32_e32 v0, 0
2449 ; GFX9-DL-NEXT: s_waitcnt lgkmcnt(0)
2450 ; GFX9-DL-NEXT: v_mov_b32_e32 v3, s3
2451 ; GFX9-DL-NEXT: s_waitcnt vmcnt(1)
2452 ; GFX9-DL-NEXT: v_bfe_i32 v4, v1, 0, 8
2453 ; GFX9-DL-NEXT: s_waitcnt vmcnt(0)
2454 ; GFX9-DL-NEXT: v_perm_b32 v2, v2, v2, s4
2455 ; GFX9-DL-NEXT: v_mad_i32_i24 v3, v4, s2, v3
2456 ; GFX9-DL-NEXT: v_perm_b32 v1, v1, v1, s4
2457 ; GFX9-DL-NEXT: v_dot4_i32_i8 v1, v1, v2, v3
2458 ; GFX9-DL-NEXT: global_store_dword v0, v1, s[0:1]
2459 ; GFX9-DL-NEXT: s_endpgm
2461 ; GFX10-DL-LABEL: idot4_bad_source:
2462 ; GFX10-DL: ; %bb.0: ; %entry
2463 ; GFX10-DL-NEXT: s_clause 0x1
2464 ; GFX10-DL-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x24
2465 ; GFX10-DL-NEXT: s_load_dword s2, s[0:1], 0x3c
2466 ; GFX10-DL-NEXT: v_lshlrev_b32_e32 v0, 2, v0
2467 ; GFX10-DL-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x44
2468 ; GFX10-DL-NEXT: v_mov_b32_e32 v3, 0
2469 ; GFX10-DL-NEXT: s_waitcnt lgkmcnt(0)
2470 ; GFX10-DL-NEXT: s_clause 0x1
2471 ; GFX10-DL-NEXT: global_load_dword v1, v0, s[4:5]
2472 ; GFX10-DL-NEXT: global_load_dword v2, v0, s[6:7]
2473 ; GFX10-DL-NEXT: s_sext_i32_i16 s2, s2
2474 ; GFX10-DL-NEXT: s_load_dword s3, s[0:1], 0x0
2475 ; GFX10-DL-NEXT: s_waitcnt vmcnt(1)
2476 ; GFX10-DL-NEXT: v_bfe_i32 v0, v1, 0, 8
2477 ; GFX10-DL-NEXT: s_waitcnt vmcnt(0)
2478 ; GFX10-DL-NEXT: v_perm_b32 v2, v2, v2, 0xc0c0201
2479 ; GFX10-DL-NEXT: v_perm_b32 v1, v1, v1, 0xc0c0201
2480 ; GFX10-DL-NEXT: s_waitcnt lgkmcnt(0)
2481 ; GFX10-DL-NEXT: v_mad_i32_i24 v0, v0, s2, s3
2482 ; GFX10-DL-NEXT: v_dot4c_i32_i8_e32 v0, v1, v2
2483 ; GFX10-DL-NEXT: global_store_dword v3, v0, s[0:1]
2484 ; GFX10-DL-NEXT: s_endpgm
2486 ; GFX11-DL-LABEL: idot4_bad_source:
2487 ; GFX11-DL: ; %bb.0: ; %entry
2488 ; GFX11-DL-NEXT: s_clause 0x1
2489 ; GFX11-DL-NEXT: s_load_b128 s[4:7], s[0:1], 0x24
2490 ; GFX11-DL-NEXT: s_load_b32 s2, s[0:1], 0x3c
2491 ; GFX11-DL-NEXT: v_dual_mov_b32 v3, 0 :: v_dual_lshlrev_b32 v0, 2, v0
2492 ; GFX11-DL-NEXT: s_load_b64 s[0:1], s[0:1], 0x44
2493 ; GFX11-DL-NEXT: s_waitcnt lgkmcnt(0)
2494 ; GFX11-DL-NEXT: s_clause 0x1
2495 ; GFX11-DL-NEXT: global_load_b32 v1, v0, s[4:5]
2496 ; GFX11-DL-NEXT: global_load_b32 v0, v0, s[6:7]
2497 ; GFX11-DL-NEXT: s_sext_i32_i16 s2, s2
2498 ; GFX11-DL-NEXT: s_load_b32 s3, s[0:1], 0x0
2499 ; GFX11-DL-NEXT: s_waitcnt vmcnt(1)
2500 ; GFX11-DL-NEXT: v_bfe_i32 v2, v1, 0, 8
2501 ; GFX11-DL-NEXT: s_waitcnt vmcnt(0)
2502 ; GFX11-DL-NEXT: v_perm_b32 v0, v0, v0, 0xc0c0201
2503 ; GFX11-DL-NEXT: v_perm_b32 v1, v1, v1, 0xc0c0201
2504 ; GFX11-DL-NEXT: s_waitcnt lgkmcnt(0)
2505 ; GFX11-DL-NEXT: v_mad_i32_i24 v2, v2, s2, s3
2506 ; GFX11-DL-NEXT: s_delay_alu instid0(VALU_DEP_1)
2507 ; GFX11-DL-NEXT: v_dot4_i32_iu8 v0, v1, v0, v2 neg_lo:[1,1,0]
2508 ; GFX11-DL-NEXT: global_store_b32 v3, v0, s[0:1]
2509 ; GFX11-DL-NEXT: s_nop 0
2510 ; GFX11-DL-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
2511 ; GFX11-DL-NEXT: s_endpgm
2512 ptr addrspace(1) %src2,
2513 ptr addrspace(1) %src3,
2515 ptr addrspace(1) nocapture %dst) {
2517 %idx = call i32 @llvm.amdgcn.workitem.id.x()
2518 %gep1 = getelementptr <4 x i8>, ptr addrspace(1) %src1, i32 %idx
2519 %vec1 = load <4 x i8>, ptr addrspace(1) %gep1
2520 %gep2 = getelementptr <4 x i8>, ptr addrspace(1) %src2, i32 %idx
2521 %vec2 = load <4 x i8>, ptr addrspace(1) %gep2
2522 %gep3 = getelementptr <4 x i8>, ptr addrspace(1) %src3, i32 %idx
2523 %vec3 = load <4 x i8>, ptr addrspace(1) %gep3
2525 %v1e0 = extractelement <4 x i8> %vec1, i64 0
2526 %cv1e0 = sext i8 %v1e0 to i32
2527 %v2e0 = extractelement <4 x i8> %vec2, i64 0
2528 %other = sext i16 %badsource to i32
2529 %mul1 = mul nuw nsw i32 %cv1e0, %other
2531 %v1e1 = extractelement <4 x i8> %vec1, i64 1
2532 %cv1e1 = sext i8 %v1e1 to i32
2533 %v2e1 = extractelement <4 x i8> %vec2, i64 1
2534 %cv2e1 = sext i8 %v2e1 to i32
2535 %mul2 = mul nuw nsw i32 %cv1e1, %cv2e1
2537 %v2e2 = extractelement <4 x i8> %vec2, i64 2
2538 %cv2e2 = sext i8 %v2e2 to i32
2539 %v1e2 = extractelement <4 x i8> %vec1, i64 2
2540 %cv1e2 = sext i8 %v1e2 to i32
2541 %mul3 = mul nuw nsw i32 %cv1e2, %cv2e2
2544 %acc = load i32, ptr addrspace(1) %dst, align 4
2545 %mad1 = add i32 %mul1, %acc
2546 %mad2 = add i32 %mad1, %mul2
2547 %mad3 = add i32 %mad2, %mul3
2549 store i32 %mad3, ptr addrspace(1) %dst, align 4
2554 define amdgpu_kernel void @idot4_commutative(ptr addrspace(1) %src1,
2555 ; GFX7-LABEL: idot4_commutative:
2556 ; GFX7: ; %bb.0: ; %entry
2557 ; GFX7-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x9
2558 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0xf
2559 ; GFX7-NEXT: s_mov_b32 s3, 0xf000
2560 ; GFX7-NEXT: s_mov_b32 s10, 0
2561 ; GFX7-NEXT: s_mov_b32 s11, s3
2562 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
2563 ; GFX7-NEXT: s_mov_b64 s[8:9], s[4:5]
2564 ; GFX7-NEXT: v_lshlrev_b32_e32 v0, 2, v0
2565 ; GFX7-NEXT: v_mov_b32_e32 v1, 0
2566 ; GFX7-NEXT: buffer_load_dword v2, v[0:1], s[8:11], 0 addr64
2567 ; GFX7-NEXT: s_mov_b64 s[8:9], s[6:7]
2568 ; GFX7-NEXT: buffer_load_dword v0, v[0:1], s[8:11], 0 addr64
2569 ; GFX7-NEXT: s_load_dword s4, s[0:1], 0x0
2570 ; GFX7-NEXT: s_mov_b32 s2, -1
2571 ; GFX7-NEXT: s_waitcnt vmcnt(1)
2572 ; GFX7-NEXT: v_bfe_i32 v1, v2, 0, 8
2573 ; GFX7-NEXT: v_bfe_i32 v3, v2, 8, 8
2574 ; GFX7-NEXT: s_waitcnt vmcnt(0)
2575 ; GFX7-NEXT: v_bfe_i32 v4, v0, 0, 8
2576 ; GFX7-NEXT: v_bfe_i32 v5, v0, 8, 8
2577 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
2578 ; GFX7-NEXT: v_mad_i32_i24 v1, v1, v4, s4
2579 ; GFX7-NEXT: v_bfe_i32 v0, v0, 16, 8
2580 ; GFX7-NEXT: v_bfe_i32 v2, v2, 16, 8
2581 ; GFX7-NEXT: v_mad_i32_i24 v1, v3, v5, v1
2582 ; GFX7-NEXT: v_mad_i32_i24 v0, v2, v0, v1
2583 ; GFX7-NEXT: buffer_store_dword v0, off, s[0:3], 0
2584 ; GFX7-NEXT: s_endpgm
2586 ; GFX8-LABEL: idot4_commutative:
2587 ; GFX8: ; %bb.0: ; %entry
2588 ; GFX8-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x24
2589 ; GFX8-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x3c
2590 ; GFX8-NEXT: v_lshlrev_b32_e32 v2, 2, v0
2591 ; GFX8-NEXT: s_waitcnt lgkmcnt(0)
2592 ; GFX8-NEXT: v_mov_b32_e32 v1, s5
2593 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, s4, v2
2594 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
2595 ; GFX8-NEXT: flat_load_dword v3, v[0:1]
2596 ; GFX8-NEXT: v_mov_b32_e32 v1, s7
2597 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, s6, v2
2598 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
2599 ; GFX8-NEXT: flat_load_dword v0, v[0:1]
2600 ; GFX8-NEXT: s_load_dword s2, s[0:1], 0x0
2601 ; GFX8-NEXT: s_waitcnt vmcnt(1)
2602 ; GFX8-NEXT: v_bfe_i32 v1, v3, 0, 8
2603 ; GFX8-NEXT: v_bfe_i32 v4, v3, 8, 8
2604 ; GFX8-NEXT: v_bfe_i32 v3, v3, 16, 8
2605 ; GFX8-NEXT: s_waitcnt vmcnt(0)
2606 ; GFX8-NEXT: v_bfe_i32 v2, v0, 0, 8
2607 ; GFX8-NEXT: v_bfe_i32 v5, v0, 8, 8
2608 ; GFX8-NEXT: s_waitcnt lgkmcnt(0)
2609 ; GFX8-NEXT: v_mad_i32_i24 v1, v1, v2, s2
2610 ; GFX8-NEXT: v_bfe_i32 v0, v0, 16, 8
2611 ; GFX8-NEXT: v_mad_i32_i24 v1, v4, v5, v1
2612 ; GFX8-NEXT: v_mad_i32_i24 v2, v3, v0, v1
2613 ; GFX8-NEXT: v_mov_b32_e32 v0, s0
2614 ; GFX8-NEXT: v_mov_b32_e32 v1, s1
2615 ; GFX8-NEXT: flat_store_dword v[0:1], v2
2616 ; GFX8-NEXT: s_endpgm
2618 ; GFX9-NODL-LABEL: idot4_commutative:
2619 ; GFX9-NODL: ; %bb.0: ; %entry
2620 ; GFX9-NODL-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x24
2621 ; GFX9-NODL-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x3c
2622 ; GFX9-NODL-NEXT: v_lshlrev_b32_e32 v0, 2, v0
2623 ; GFX9-NODL-NEXT: s_waitcnt lgkmcnt(0)
2624 ; GFX9-NODL-NEXT: global_load_dword v1, v0, s[4:5]
2625 ; GFX9-NODL-NEXT: global_load_dword v2, v0, s[6:7]
2626 ; GFX9-NODL-NEXT: s_load_dword s0, s[2:3], 0x0
2627 ; GFX9-NODL-NEXT: v_mov_b32_e32 v0, 0
2628 ; GFX9-NODL-NEXT: s_waitcnt vmcnt(1)
2629 ; GFX9-NODL-NEXT: v_bfe_i32 v3, v1, 0, 8
2630 ; GFX9-NODL-NEXT: s_waitcnt vmcnt(0)
2631 ; GFX9-NODL-NEXT: v_bfe_i32 v4, v2, 0, 8
2632 ; GFX9-NODL-NEXT: v_mul_i32_i24_sdwa v5, sext(v1), sext(v2) dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_1 src1_sel:BYTE_1
2633 ; GFX9-NODL-NEXT: v_mul_i32_i24_sdwa v1, sext(v1), sext(v2) dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_2 src1_sel:BYTE_2
2634 ; GFX9-NODL-NEXT: s_waitcnt lgkmcnt(0)
2635 ; GFX9-NODL-NEXT: v_mad_i32_i24 v2, v3, v4, s0
2636 ; GFX9-NODL-NEXT: v_add3_u32 v1, v2, v5, v1
2637 ; GFX9-NODL-NEXT: global_store_dword v0, v1, s[2:3]
2638 ; GFX9-NODL-NEXT: s_endpgm
2640 ; GFX9-DL-LABEL: idot4_commutative:
2641 ; GFX9-DL: ; %bb.0: ; %entry
2642 ; GFX9-DL-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x24
2643 ; GFX9-DL-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x3c
2644 ; GFX9-DL-NEXT: v_lshlrev_b32_e32 v0, 2, v0
2645 ; GFX9-DL-NEXT: s_mov_b32 s1, 0xc020100
2646 ; GFX9-DL-NEXT: s_waitcnt lgkmcnt(0)
2647 ; GFX9-DL-NEXT: global_load_dword v1, v0, s[6:7]
2648 ; GFX9-DL-NEXT: global_load_dword v2, v0, s[4:5]
2649 ; GFX9-DL-NEXT: s_load_dword s0, s[2:3], 0x0
2650 ; GFX9-DL-NEXT: v_mov_b32_e32 v0, 0
2651 ; GFX9-DL-NEXT: s_waitcnt vmcnt(1)
2652 ; GFX9-DL-NEXT: v_perm_b32 v1, v1, v1, s1
2653 ; GFX9-DL-NEXT: s_waitcnt vmcnt(0)
2654 ; GFX9-DL-NEXT: v_perm_b32 v2, v2, v2, s1
2655 ; GFX9-DL-NEXT: s_waitcnt lgkmcnt(0)
2656 ; GFX9-DL-NEXT: v_dot4_i32_i8 v1, v2, v1, s0
2657 ; GFX9-DL-NEXT: global_store_dword v0, v1, s[2:3]
2658 ; GFX9-DL-NEXT: s_endpgm
2660 ; GFX10-DL-LABEL: idot4_commutative:
2661 ; GFX10-DL: ; %bb.0: ; %entry
2662 ; GFX10-DL-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x24
2663 ; GFX10-DL-NEXT: v_lshlrev_b32_e32 v0, 2, v0
2664 ; GFX10-DL-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x3c
2665 ; GFX10-DL-NEXT: v_mov_b32_e32 v3, 0
2666 ; GFX10-DL-NEXT: s_waitcnt lgkmcnt(0)
2667 ; GFX10-DL-NEXT: s_clause 0x1
2668 ; GFX10-DL-NEXT: global_load_dword v1, v0, s[6:7]
2669 ; GFX10-DL-NEXT: global_load_dword v2, v0, s[4:5]
2670 ; GFX10-DL-NEXT: s_load_dword s2, s[0:1], 0x0
2671 ; GFX10-DL-NEXT: s_waitcnt vmcnt(1)
2672 ; GFX10-DL-NEXT: v_perm_b32 v0, v1, v1, 0xc020100
2673 ; GFX10-DL-NEXT: s_waitcnt vmcnt(0)
2674 ; GFX10-DL-NEXT: v_perm_b32 v1, v2, v2, 0xc020100
2675 ; GFX10-DL-NEXT: s_waitcnt lgkmcnt(0)
2676 ; GFX10-DL-NEXT: v_mov_b32_e32 v2, s2
2677 ; GFX10-DL-NEXT: v_dot4c_i32_i8_e32 v2, v1, v0
2678 ; GFX10-DL-NEXT: global_store_dword v3, v2, s[0:1]
2679 ; GFX10-DL-NEXT: s_endpgm
2681 ; GFX11-DL-LABEL: idot4_commutative:
2682 ; GFX11-DL: ; %bb.0: ; %entry
2683 ; GFX11-DL-NEXT: s_load_b128 s[4:7], s[0:1], 0x24
2684 ; GFX11-DL-NEXT: v_lshlrev_b32_e32 v0, 2, v0
2685 ; GFX11-DL-NEXT: s_load_b64 s[0:1], s[0:1], 0x3c
2686 ; GFX11-DL-NEXT: v_mov_b32_e32 v2, 0
2687 ; GFX11-DL-NEXT: s_waitcnt lgkmcnt(0)
2688 ; GFX11-DL-NEXT: s_clause 0x1
2689 ; GFX11-DL-NEXT: global_load_b32 v1, v0, s[6:7]
2690 ; GFX11-DL-NEXT: global_load_b32 v0, v0, s[4:5]
2691 ; GFX11-DL-NEXT: s_load_b32 s2, s[0:1], 0x0
2692 ; GFX11-DL-NEXT: s_waitcnt vmcnt(1)
2693 ; GFX11-DL-NEXT: v_perm_b32 v1, v1, v1, 0xc020100
2694 ; GFX11-DL-NEXT: s_waitcnt vmcnt(0)
2695 ; GFX11-DL-NEXT: v_perm_b32 v0, v0, v0, 0xc020100
2696 ; GFX11-DL-NEXT: s_waitcnt lgkmcnt(0)
2697 ; GFX11-DL-NEXT: s_delay_alu instid0(VALU_DEP_1)
2698 ; GFX11-DL-NEXT: v_dot4_i32_iu8 v0, v0, v1, s2 neg_lo:[1,1,0]
2699 ; GFX11-DL-NEXT: global_store_b32 v2, v0, s[0:1]
2700 ; GFX11-DL-NEXT: s_nop 0
2701 ; GFX11-DL-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
2702 ; GFX11-DL-NEXT: s_endpgm
2703 ptr addrspace(1) %src2,
2704 ptr addrspace(1) %src3,
2705 ptr addrspace(1) nocapture %dst) {
2707 %idx = call i32 @llvm.amdgcn.workitem.id.x()
2708 %gep1 = getelementptr <4 x i8>, ptr addrspace(1) %src1, i32 %idx
2709 %vec1 = load <4 x i8>, ptr addrspace(1) %gep1
2710 %gep2 = getelementptr <4 x i8>, ptr addrspace(1) %src2, i32 %idx
2711 %vec2 = load <4 x i8>, ptr addrspace(1) %gep2
2712 %gep3 = getelementptr <4 x i8>, ptr addrspace(1) %src3, i32 %idx
2713 %vec3 = load <4 x i8>, ptr addrspace(1) %gep3
2715 %v1e0 = extractelement <4 x i8> %vec1, i64 0
2716 %cv1e0 = sext i8 %v1e0 to i32
2717 %v2e0 = extractelement <4 x i8> %vec2, i64 0
2718 %cv2e0 = sext i8 %v2e0 to i32
2719 %mul1 = mul nuw nsw i32 %cv1e0, %cv2e0
2721 %v1e1 = extractelement <4 x i8> %vec1, i64 1
2722 %cv1e1 = sext i8 %v1e1 to i32
2723 %v2e1 = extractelement <4 x i8> %vec2, i64 1
2724 %cv2e1 = sext i8 %v2e1 to i32
2725 %mul2 = mul nuw nsw i32 %cv1e1, %cv2e1
2727 %v2e2 = extractelement <4 x i8> %vec2, i64 2
2728 %cv2e2 = sext i8 %v2e2 to i32
2729 %v1e2 = extractelement <4 x i8> %vec1, i64 2
2730 %cv1e2 = sext i8 %v1e2 to i32
2731 %mul3 = mul nuw nsw i32 %cv1e2, %cv2e2
2734 %acc = load i32, ptr addrspace(1) %dst, align 4
2735 %mad1 = add i32 %mul1, %acc
2736 %mad2 = add i32 %mad1, %mul2
2737 %mad3 = add i32 %mad2, %mul3
2739 store i32 %mad3, ptr addrspace(1) %dst, align 4
2743 define amdgpu_kernel void @idot4_acc32_3src_3ele_src0(ptr addrspace(1) %src1,
2744 ; GFX7-LABEL: idot4_acc32_3src_3ele_src0:
2745 ; GFX7: ; %bb.0: ; %entry
2746 ; GFX7-NEXT: s_load_dwordx8 s[0:7], s[0:1], 0x9
2747 ; GFX7-NEXT: s_mov_b32 s11, 0xf000
2748 ; GFX7-NEXT: s_mov_b32 s14, 0
2749 ; GFX7-NEXT: s_mov_b32 s15, s11
2750 ; GFX7-NEXT: v_lshlrev_b32_e32 v0, 2, v0
2751 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
2752 ; GFX7-NEXT: s_mov_b64 s[12:13], s[0:1]
2753 ; GFX7-NEXT: v_mov_b32_e32 v1, 0
2754 ; GFX7-NEXT: buffer_load_dword v2, v[0:1], s[12:15], 0 addr64
2755 ; GFX7-NEXT: s_mov_b64 s[12:13], s[2:3]
2756 ; GFX7-NEXT: buffer_load_dword v3, v[0:1], s[12:15], 0 addr64
2757 ; GFX7-NEXT: s_mov_b64 s[12:13], s[4:5]
2758 ; GFX7-NEXT: buffer_load_dword v0, v[0:1], s[12:15], 0 addr64
2759 ; GFX7-NEXT: s_load_dword s0, s[6:7], 0x0
2760 ; GFX7-NEXT: s_mov_b32 s10, -1
2761 ; GFX7-NEXT: s_mov_b32 s8, s6
2762 ; GFX7-NEXT: s_mov_b32 s9, s7
2763 ; GFX7-NEXT: s_waitcnt vmcnt(2)
2764 ; GFX7-NEXT: v_bfe_i32 v1, v2, 8, 8
2765 ; GFX7-NEXT: s_waitcnt vmcnt(1)
2766 ; GFX7-NEXT: v_bfe_i32 v2, v3, 8, 8
2767 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
2768 ; GFX7-NEXT: v_mad_i32_i24 v4, v2, v2, s0
2769 ; GFX7-NEXT: v_bfe_i32 v3, v3, 16, 8
2770 ; GFX7-NEXT: s_waitcnt vmcnt(0)
2771 ; GFX7-NEXT: v_bfe_i32 v0, v0, 16, 8
2772 ; GFX7-NEXT: v_mad_i32_i24 v1, v1, v2, v4
2773 ; GFX7-NEXT: v_mad_i32_i24 v0, v3, v0, v1
2774 ; GFX7-NEXT: buffer_store_dword v0, off, s[8:11], 0
2775 ; GFX7-NEXT: s_endpgm
2777 ; GFX8-LABEL: idot4_acc32_3src_3ele_src0:
2778 ; GFX8: ; %bb.0: ; %entry
2779 ; GFX8-NEXT: s_load_dwordx8 s[0:7], s[0:1], 0x24
2780 ; GFX8-NEXT: v_lshlrev_b32_e32 v2, 2, v0
2781 ; GFX8-NEXT: s_waitcnt lgkmcnt(0)
2782 ; GFX8-NEXT: v_mov_b32_e32 v1, s1
2783 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, s0, v2
2784 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
2785 ; GFX8-NEXT: flat_load_dword v3, v[0:1]
2786 ; GFX8-NEXT: v_mov_b32_e32 v1, s3
2787 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, s2, v2
2788 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
2789 ; GFX8-NEXT: flat_load_dword v4, v[0:1]
2790 ; GFX8-NEXT: v_mov_b32_e32 v1, s5
2791 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, s4, v2
2792 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
2793 ; GFX8-NEXT: flat_load_dword v0, v[0:1]
2794 ; GFX8-NEXT: s_load_dword s0, s[6:7], 0x0
2795 ; GFX8-NEXT: s_waitcnt vmcnt(2)
2796 ; GFX8-NEXT: v_bfe_i32 v2, v3, 8, 8
2797 ; GFX8-NEXT: s_waitcnt vmcnt(1)
2798 ; GFX8-NEXT: v_bfe_i32 v1, v4, 8, 8
2799 ; GFX8-NEXT: v_bfe_i32 v3, v4, 16, 8
2800 ; GFX8-NEXT: s_waitcnt lgkmcnt(0)
2801 ; GFX8-NEXT: v_mad_i32_i24 v4, v1, v1, s0
2802 ; GFX8-NEXT: v_mad_i32_i24 v1, v2, v1, v4
2803 ; GFX8-NEXT: s_waitcnt vmcnt(0)
2804 ; GFX8-NEXT: v_bfe_i32 v0, v0, 16, 8
2805 ; GFX8-NEXT: v_mad_i32_i24 v2, v3, v0, v1
2806 ; GFX8-NEXT: v_mov_b32_e32 v0, s6
2807 ; GFX8-NEXT: v_mov_b32_e32 v1, s7
2808 ; GFX8-NEXT: flat_store_dword v[0:1], v2
2809 ; GFX8-NEXT: s_endpgm
2811 ; GFX9-NODL-LABEL: idot4_acc32_3src_3ele_src0:
2812 ; GFX9-NODL: ; %bb.0: ; %entry
2813 ; GFX9-NODL-NEXT: s_load_dwordx8 s[0:7], s[0:1], 0x24
2814 ; GFX9-NODL-NEXT: v_lshlrev_b32_e32 v0, 2, v0
2815 ; GFX9-NODL-NEXT: s_waitcnt lgkmcnt(0)
2816 ; GFX9-NODL-NEXT: global_load_dword v1, v0, s[2:3]
2817 ; GFX9-NODL-NEXT: global_load_dword v2, v0, s[4:5]
2818 ; GFX9-NODL-NEXT: global_load_dword v3, v0, s[0:1]
2819 ; GFX9-NODL-NEXT: s_load_dword s0, s[6:7], 0x0
2820 ; GFX9-NODL-NEXT: v_mov_b32_e32 v0, 0
2821 ; GFX9-NODL-NEXT: s_waitcnt vmcnt(2)
2822 ; GFX9-NODL-NEXT: v_bfe_i32 v4, v1, 8, 8
2823 ; GFX9-NODL-NEXT: s_waitcnt vmcnt(1)
2824 ; GFX9-NODL-NEXT: v_mul_i32_i24_sdwa v1, sext(v1), sext(v2) dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_2 src1_sel:BYTE_2
2825 ; GFX9-NODL-NEXT: s_waitcnt vmcnt(0)
2826 ; GFX9-NODL-NEXT: v_mul_i32_i24_sdwa v2, sext(v3), v4 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_1 src1_sel:DWORD
2827 ; GFX9-NODL-NEXT: s_waitcnt lgkmcnt(0)
2828 ; GFX9-NODL-NEXT: v_mad_i32_i24 v3, v4, v4, s0
2829 ; GFX9-NODL-NEXT: v_add3_u32 v1, v3, v2, v1
2830 ; GFX9-NODL-NEXT: global_store_dword v0, v1, s[6:7]
2831 ; GFX9-NODL-NEXT: s_endpgm
2833 ; GFX9-DL-LABEL: idot4_acc32_3src_3ele_src0:
2834 ; GFX9-DL: ; %bb.0: ; %entry
2835 ; GFX9-DL-NEXT: s_load_dwordx8 s[0:7], s[0:1], 0x24
2836 ; GFX9-DL-NEXT: v_lshlrev_b32_e32 v0, 2, v0
2837 ; GFX9-DL-NEXT: s_waitcnt lgkmcnt(0)
2838 ; GFX9-DL-NEXT: global_load_dword v1, v0, s[4:5]
2839 ; GFX9-DL-NEXT: global_load_dword v2, v0, s[0:1]
2840 ; GFX9-DL-NEXT: global_load_dword v3, v0, s[2:3]
2841 ; GFX9-DL-NEXT: s_load_dword s3, s[6:7], 0x0
2842 ; GFX9-DL-NEXT: s_mov_b32 s0, 0xc06010c
2843 ; GFX9-DL-NEXT: s_mov_b32 s1, 0xc0c0c01
2844 ; GFX9-DL-NEXT: s_mov_b32 s2, 0xc020101
2845 ; GFX9-DL-NEXT: v_mov_b32_e32 v0, 0
2846 ; GFX9-DL-NEXT: s_waitcnt vmcnt(1)
2847 ; GFX9-DL-NEXT: v_perm_b32 v1, v1, v2, s0
2848 ; GFX9-DL-NEXT: s_waitcnt vmcnt(0)
2849 ; GFX9-DL-NEXT: v_perm_b32 v2, v3, v3, s1
2850 ; GFX9-DL-NEXT: v_or_b32_e32 v1, v1, v2
2851 ; GFX9-DL-NEXT: v_perm_b32 v2, v3, v3, s2
2852 ; GFX9-DL-NEXT: s_waitcnt lgkmcnt(0)
2853 ; GFX9-DL-NEXT: v_dot4_i32_i8 v1, v2, v1, s3
2854 ; GFX9-DL-NEXT: global_store_dword v0, v1, s[6:7]
2855 ; GFX9-DL-NEXT: s_endpgm
2857 ; GFX10-DL-LABEL: idot4_acc32_3src_3ele_src0:
2858 ; GFX10-DL: ; %bb.0: ; %entry
2859 ; GFX10-DL-NEXT: s_load_dwordx8 s[0:7], s[0:1], 0x24
2860 ; GFX10-DL-NEXT: v_lshlrev_b32_e32 v0, 2, v0
2861 ; GFX10-DL-NEXT: s_waitcnt lgkmcnt(0)
2862 ; GFX10-DL-NEXT: s_clause 0x2
2863 ; GFX10-DL-NEXT: global_load_dword v1, v0, s[4:5]
2864 ; GFX10-DL-NEXT: global_load_dword v2, v0, s[0:1]
2865 ; GFX10-DL-NEXT: global_load_dword v3, v0, s[2:3]
2866 ; GFX10-DL-NEXT: s_waitcnt_depctr 0xffe3
2867 ; GFX10-DL-NEXT: s_load_dword s0, s[6:7], 0x0
2868 ; GFX10-DL-NEXT: s_waitcnt vmcnt(1)
2869 ; GFX10-DL-NEXT: v_perm_b32 v0, v1, v2, 0xc06010c
2870 ; GFX10-DL-NEXT: s_waitcnt vmcnt(0)
2871 ; GFX10-DL-NEXT: v_perm_b32 v1, v3, v3, 0xc0c0c01
2872 ; GFX10-DL-NEXT: v_perm_b32 v2, v3, v3, 0xc020101
2873 ; GFX10-DL-NEXT: v_mov_b32_e32 v3, 0
2874 ; GFX10-DL-NEXT: v_or_b32_e32 v0, v0, v1
2875 ; GFX10-DL-NEXT: s_waitcnt lgkmcnt(0)
2876 ; GFX10-DL-NEXT: v_mov_b32_e32 v1, s0
2877 ; GFX10-DL-NEXT: v_dot4c_i32_i8_e32 v1, v2, v0
2878 ; GFX10-DL-NEXT: global_store_dword v3, v1, s[6:7]
2879 ; GFX10-DL-NEXT: s_endpgm
2881 ; GFX11-DL-LABEL: idot4_acc32_3src_3ele_src0:
2882 ; GFX11-DL: ; %bb.0: ; %entry
2883 ; GFX11-DL-NEXT: s_load_b256 s[0:7], s[0:1], 0x24
2884 ; GFX11-DL-NEXT: v_lshlrev_b32_e32 v0, 2, v0
2885 ; GFX11-DL-NEXT: s_waitcnt lgkmcnt(0)
2886 ; GFX11-DL-NEXT: s_clause 0x2
2887 ; GFX11-DL-NEXT: global_load_b32 v1, v0, s[4:5]
2888 ; GFX11-DL-NEXT: global_load_b32 v2, v0, s[0:1]
2889 ; GFX11-DL-NEXT: global_load_b32 v0, v0, s[2:3]
2890 ; GFX11-DL-NEXT: s_load_b32 s0, s[6:7], 0x0
2891 ; GFX11-DL-NEXT: s_waitcnt vmcnt(1)
2892 ; GFX11-DL-NEXT: v_perm_b32 v1, v1, v2, 0xc06010c
2893 ; GFX11-DL-NEXT: s_waitcnt vmcnt(0)
2894 ; GFX11-DL-NEXT: v_perm_b32 v2, v0, v0, 0xc0c0c01
2895 ; GFX11-DL-NEXT: v_perm_b32 v0, v0, v0, 0xc020101
2896 ; GFX11-DL-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_2) | instid1(VALU_DEP_2)
2897 ; GFX11-DL-NEXT: v_or_b32_e32 v1, v1, v2
2898 ; GFX11-DL-NEXT: v_mov_b32_e32 v2, 0
2899 ; GFX11-DL-NEXT: s_waitcnt lgkmcnt(0)
2900 ; GFX11-DL-NEXT: v_dot4_i32_iu8 v0, v0, v1, s0 neg_lo:[1,1,0]
2901 ; GFX11-DL-NEXT: global_store_b32 v2, v0, s[6:7]
2902 ; GFX11-DL-NEXT: s_nop 0
2903 ; GFX11-DL-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
2904 ; GFX11-DL-NEXT: s_endpgm
2905 ptr addrspace(1) %src2,
2906 ptr addrspace(1) %src3,
2907 ptr addrspace(1) nocapture %dst) {
2909 %idx = call i32 @llvm.amdgcn.workitem.id.x()
2910 %gep1 = getelementptr <4 x i8>, ptr addrspace(1) %src1, i32 %idx
2911 %vec1 = load <4 x i8>, ptr addrspace(1) %gep1
2912 %gep2 = getelementptr <4 x i8>, ptr addrspace(1) %src2, i32 %idx
2913 %vec2 = load <4 x i8>, ptr addrspace(1) %gep2
2914 %gep3 = getelementptr <4 x i8>, ptr addrspace(1) %src3, i32 %idx
2915 %vec3 = load <4 x i8>, ptr addrspace(1) %gep3
2917 %v2e0 = extractelement <4 x i8> %vec2, i64 1
2918 %cv2e0 = sext i8 %v2e0 to i32
2919 %mul1 = mul nuw nsw i32 %cv2e0, %cv2e0
2921 %v1e1 = extractelement <4 x i8> %vec1, i64 1
2922 %cv1e1 = sext i8 %v1e1 to i32
2923 %v2e1 = extractelement <4 x i8> %vec2, i64 1
2924 %cv2e1 = sext i8 %v2e1 to i32
2925 %mul2 = mul nuw nsw i32 %cv1e1, %cv2e1
2927 %v3e2 = extractelement <4 x i8> %vec3, i64 2
2928 %cv3e2 = sext i8 %v3e2 to i32
2929 %v2e2 = extractelement <4 x i8> %vec2, i64 2
2930 %cv2e2 = sext i8 %v2e2 to i32
2931 %mul3 = mul nuw nsw i32 %cv2e2, %cv3e2
2934 %acc = load i32, ptr addrspace(1) %dst, align 4
2935 %mad1 = add i32 %mul1, %acc
2936 %mad2 = add i32 %mad1, %mul2
2937 %mad3 = add i32 %mad2, %mul3
2939 store i32 %mad3, ptr addrspace(1) %dst, align 4
2943 define amdgpu_kernel void @idot4_4src(ptr addrspace(1) %src1,
2944 ; GFX7-LABEL: idot4_4src:
2945 ; GFX7: ; %bb.0: ; %entry
2946 ; GFX7-NEXT: s_load_dwordx8 s[4:11], s[0:1], 0x9
2947 ; GFX7-NEXT: s_mov_b32 s3, 0xf000
2948 ; GFX7-NEXT: s_mov_b32 s14, 0
2949 ; GFX7-NEXT: s_mov_b32 s15, s3
2950 ; GFX7-NEXT: v_lshlrev_b32_e32 v0, 2, v0
2951 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
2952 ; GFX7-NEXT: s_mov_b64 s[12:13], s[4:5]
2953 ; GFX7-NEXT: v_mov_b32_e32 v1, 0
2954 ; GFX7-NEXT: buffer_load_dword v2, v[0:1], s[12:15], 0 addr64
2955 ; GFX7-NEXT: s_mov_b64 s[12:13], s[6:7]
2956 ; GFX7-NEXT: buffer_load_dword v3, v[0:1], s[12:15], 0 addr64
2957 ; GFX7-NEXT: s_mov_b64 s[12:13], s[8:9]
2958 ; GFX7-NEXT: buffer_load_dword v4, v[0:1], s[12:15], 0 addr64
2959 ; GFX7-NEXT: s_mov_b64 s[12:13], s[10:11]
2960 ; GFX7-NEXT: buffer_load_dword v0, v[0:1], s[12:15], 0 addr64
2961 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x11
2962 ; GFX7-NEXT: s_mov_b32 s2, -1
2963 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
2964 ; GFX7-NEXT: s_load_dword s4, s[0:1], 0x0
2965 ; GFX7-NEXT: s_waitcnt vmcnt(3)
2966 ; GFX7-NEXT: v_bfe_i32 v1, v2, 0, 8
2967 ; GFX7-NEXT: v_bfe_i32 v2, v2, 8, 8
2968 ; GFX7-NEXT: s_waitcnt vmcnt(2)
2969 ; GFX7-NEXT: v_bfe_i32 v5, v3, 0, 8
2970 ; GFX7-NEXT: v_bfe_i32 v3, v3, 8, 8
2971 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
2972 ; GFX7-NEXT: v_mad_i32_i24 v1, v1, v2, s4
2973 ; GFX7-NEXT: s_waitcnt vmcnt(1)
2974 ; GFX7-NEXT: v_bfe_i32 v2, v4, 0, 8
2975 ; GFX7-NEXT: v_bfe_i32 v4, v4, 8, 8
2976 ; GFX7-NEXT: v_mad_i32_i24 v1, v5, v3, v1
2977 ; GFX7-NEXT: s_waitcnt vmcnt(0)
2978 ; GFX7-NEXT: v_bfe_i32 v3, v0, 0, 8
2979 ; GFX7-NEXT: v_bfe_i32 v0, v0, 8, 8
2980 ; GFX7-NEXT: v_mad_i32_i24 v1, v2, v4, v1
2981 ; GFX7-NEXT: v_mad_i32_i24 v0, v3, v0, v1
2982 ; GFX7-NEXT: buffer_store_dword v0, off, s[0:3], 0
2983 ; GFX7-NEXT: s_endpgm
2985 ; GFX8-LABEL: idot4_4src:
2986 ; GFX8: ; %bb.0: ; %entry
2987 ; GFX8-NEXT: s_load_dwordx8 s[4:11], s[0:1], 0x24
2988 ; GFX8-NEXT: v_lshlrev_b32_e32 v2, 2, v0
2989 ; GFX8-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x44
2990 ; GFX8-NEXT: s_waitcnt lgkmcnt(0)
2991 ; GFX8-NEXT: v_mov_b32_e32 v1, s5
2992 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, s4, v2
2993 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
2994 ; GFX8-NEXT: flat_load_dword v3, v[0:1]
2995 ; GFX8-NEXT: v_mov_b32_e32 v1, s7
2996 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, s6, v2
2997 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
2998 ; GFX8-NEXT: flat_load_dword v4, v[0:1]
2999 ; GFX8-NEXT: v_mov_b32_e32 v1, s9
3000 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, s8, v2
3001 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
3002 ; GFX8-NEXT: flat_load_dword v5, v[0:1]
3003 ; GFX8-NEXT: v_mov_b32_e32 v1, s11
3004 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, s10, v2
3005 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
3006 ; GFX8-NEXT: flat_load_dword v0, v[0:1]
3007 ; GFX8-NEXT: s_load_dword s2, s[0:1], 0x0
3008 ; GFX8-NEXT: s_waitcnt vmcnt(3)
3009 ; GFX8-NEXT: v_bfe_i32 v1, v3, 0, 8
3010 ; GFX8-NEXT: v_bfe_i32 v2, v3, 8, 8
3011 ; GFX8-NEXT: s_waitcnt lgkmcnt(0)
3012 ; GFX8-NEXT: v_mad_i32_i24 v1, v1, v2, s2
3013 ; GFX8-NEXT: s_waitcnt vmcnt(2)
3014 ; GFX8-NEXT: v_bfe_i32 v3, v4, 0, 8
3015 ; GFX8-NEXT: v_bfe_i32 v4, v4, 8, 8
3016 ; GFX8-NEXT: v_mad_i32_i24 v1, v3, v4, v1
3017 ; GFX8-NEXT: s_waitcnt vmcnt(1)
3018 ; GFX8-NEXT: v_bfe_i32 v6, v5, 0, 8
3019 ; GFX8-NEXT: v_bfe_i32 v5, v5, 8, 8
3020 ; GFX8-NEXT: v_mad_i32_i24 v1, v6, v5, v1
3021 ; GFX8-NEXT: s_waitcnt vmcnt(0)
3022 ; GFX8-NEXT: v_bfe_i32 v7, v0, 0, 8
3023 ; GFX8-NEXT: v_bfe_i32 v0, v0, 8, 8
3024 ; GFX8-NEXT: v_mad_i32_i24 v2, v7, v0, v1
3025 ; GFX8-NEXT: v_mov_b32_e32 v0, s0
3026 ; GFX8-NEXT: v_mov_b32_e32 v1, s1
3027 ; GFX8-NEXT: flat_store_dword v[0:1], v2
3028 ; GFX8-NEXT: s_endpgm
3030 ; GFX9-NODL-LABEL: idot4_4src:
3031 ; GFX9-NODL: ; %bb.0: ; %entry
3032 ; GFX9-NODL-NEXT: s_load_dwordx8 s[4:11], s[0:1], 0x24
3033 ; GFX9-NODL-NEXT: v_lshlrev_b32_e32 v0, 2, v0
3034 ; GFX9-NODL-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x44
3035 ; GFX9-NODL-NEXT: s_waitcnt lgkmcnt(0)
3036 ; GFX9-NODL-NEXT: global_load_dword v1, v0, s[4:5]
3037 ; GFX9-NODL-NEXT: global_load_dword v2, v0, s[6:7]
3038 ; GFX9-NODL-NEXT: global_load_dword v3, v0, s[8:9]
3039 ; GFX9-NODL-NEXT: global_load_dword v4, v0, s[10:11]
3040 ; GFX9-NODL-NEXT: v_mov_b32_e32 v0, 0
3041 ; GFX9-NODL-NEXT: s_load_dword s2, s[0:1], 0x0
3042 ; GFX9-NODL-NEXT: s_waitcnt vmcnt(3)
3043 ; GFX9-NODL-NEXT: v_mul_i32_i24_sdwa v1, sext(v1), sext(v1) dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:BYTE_1
3044 ; GFX9-NODL-NEXT: s_waitcnt vmcnt(2)
3045 ; GFX9-NODL-NEXT: v_mul_i32_i24_sdwa v2, sext(v2), sext(v2) dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:BYTE_1
3046 ; GFX9-NODL-NEXT: s_waitcnt vmcnt(1)
3047 ; GFX9-NODL-NEXT: v_mul_i32_i24_sdwa v3, sext(v3), sext(v3) dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:BYTE_1
3048 ; GFX9-NODL-NEXT: s_waitcnt vmcnt(0)
3049 ; GFX9-NODL-NEXT: v_mul_i32_i24_sdwa v4, sext(v4), sext(v4) dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:BYTE_1
3050 ; GFX9-NODL-NEXT: s_waitcnt lgkmcnt(0)
3051 ; GFX9-NODL-NEXT: v_add3_u32 v1, v1, s2, v2
3052 ; GFX9-NODL-NEXT: v_add3_u32 v1, v1, v3, v4
3053 ; GFX9-NODL-NEXT: global_store_dword v0, v1, s[0:1]
3054 ; GFX9-NODL-NEXT: s_endpgm
3056 ; GFX9-DL-LABEL: idot4_4src:
3057 ; GFX9-DL: ; %bb.0: ; %entry
3058 ; GFX9-DL-NEXT: s_load_dwordx8 s[4:11], s[0:1], 0x24
3059 ; GFX9-DL-NEXT: v_lshlrev_b32_e32 v0, 2, v0
3060 ; GFX9-DL-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x44
3061 ; GFX9-DL-NEXT: s_mov_b32 s2, 0xc0c0501
3062 ; GFX9-DL-NEXT: s_mov_b32 s3, 0x5010c0c
3063 ; GFX9-DL-NEXT: s_waitcnt lgkmcnt(0)
3064 ; GFX9-DL-NEXT: global_load_dword v1, v0, s[4:5]
3065 ; GFX9-DL-NEXT: global_load_dword v2, v0, s[6:7]
3066 ; GFX9-DL-NEXT: global_load_dword v3, v0, s[8:9]
3067 ; GFX9-DL-NEXT: global_load_dword v4, v0, s[10:11]
3068 ; GFX9-DL-NEXT: s_mov_b32 s4, 0xc0c0400
3069 ; GFX9-DL-NEXT: s_load_dword s6, s[0:1], 0x0
3070 ; GFX9-DL-NEXT: s_mov_b32 s5, 0x4000c0c
3071 ; GFX9-DL-NEXT: v_mov_b32_e32 v0, 0
3072 ; GFX9-DL-NEXT: s_waitcnt vmcnt(2)
3073 ; GFX9-DL-NEXT: v_perm_b32 v5, v2, v1, s2
3074 ; GFX9-DL-NEXT: v_perm_b32 v1, v2, v1, s4
3075 ; GFX9-DL-NEXT: s_waitcnt vmcnt(0)
3076 ; GFX9-DL-NEXT: v_perm_b32 v6, v4, v3, s3
3077 ; GFX9-DL-NEXT: v_perm_b32 v2, v4, v3, s5
3078 ; GFX9-DL-NEXT: v_or_b32_e32 v3, v6, v5
3079 ; GFX9-DL-NEXT: v_or_b32_e32 v1, v2, v1
3080 ; GFX9-DL-NEXT: s_waitcnt lgkmcnt(0)
3081 ; GFX9-DL-NEXT: v_dot4_i32_i8 v1, v1, v3, s6
3082 ; GFX9-DL-NEXT: global_store_dword v0, v1, s[0:1]
3083 ; GFX9-DL-NEXT: s_endpgm
3085 ; GFX10-DL-LABEL: idot4_4src:
3086 ; GFX10-DL: ; %bb.0: ; %entry
3087 ; GFX10-DL-NEXT: s_load_dwordx8 s[4:11], s[0:1], 0x24
3088 ; GFX10-DL-NEXT: v_lshlrev_b32_e32 v0, 2, v0
3089 ; GFX10-DL-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x44
3090 ; GFX10-DL-NEXT: s_waitcnt lgkmcnt(0)
3091 ; GFX10-DL-NEXT: s_clause 0x3
3092 ; GFX10-DL-NEXT: global_load_dword v1, v0, s[4:5]
3093 ; GFX10-DL-NEXT: global_load_dword v2, v0, s[6:7]
3094 ; GFX10-DL-NEXT: global_load_dword v3, v0, s[8:9]
3095 ; GFX10-DL-NEXT: global_load_dword v4, v0, s[10:11]
3096 ; GFX10-DL-NEXT: s_load_dword s2, s[0:1], 0x0
3097 ; GFX10-DL-NEXT: s_waitcnt vmcnt(2)
3098 ; GFX10-DL-NEXT: v_perm_b32 v0, v2, v1, 0xc0c0501
3099 ; GFX10-DL-NEXT: v_perm_b32 v1, v2, v1, 0xc0c0400
3100 ; GFX10-DL-NEXT: s_waitcnt vmcnt(0)
3101 ; GFX10-DL-NEXT: v_perm_b32 v5, v4, v3, 0x5010c0c
3102 ; GFX10-DL-NEXT: v_perm_b32 v2, v4, v3, 0x4000c0c
3103 ; GFX10-DL-NEXT: v_mov_b32_e32 v3, 0
3104 ; GFX10-DL-NEXT: v_or_b32_e32 v0, v5, v0
3105 ; GFX10-DL-NEXT: v_or_b32_e32 v1, v2, v1
3106 ; GFX10-DL-NEXT: s_waitcnt lgkmcnt(0)
3107 ; GFX10-DL-NEXT: v_mov_b32_e32 v2, s2
3108 ; GFX10-DL-NEXT: v_dot4c_i32_i8_e32 v2, v1, v0
3109 ; GFX10-DL-NEXT: global_store_dword v3, v2, s[0:1]
3110 ; GFX10-DL-NEXT: s_endpgm
3112 ; GFX11-DL-LABEL: idot4_4src:
3113 ; GFX11-DL: ; %bb.0: ; %entry
3114 ; GFX11-DL-NEXT: s_load_b256 s[4:11], s[0:1], 0x24
3115 ; GFX11-DL-NEXT: v_lshlrev_b32_e32 v0, 2, v0
3116 ; GFX11-DL-NEXT: s_load_b64 s[0:1], s[0:1], 0x44
3117 ; GFX11-DL-NEXT: s_waitcnt lgkmcnt(0)
3118 ; GFX11-DL-NEXT: s_clause 0x3
3119 ; GFX11-DL-NEXT: global_load_b32 v1, v0, s[4:5]
3120 ; GFX11-DL-NEXT: global_load_b32 v2, v0, s[6:7]
3121 ; GFX11-DL-NEXT: global_load_b32 v3, v0, s[8:9]
3122 ; GFX11-DL-NEXT: global_load_b32 v0, v0, s[10:11]
3123 ; GFX11-DL-NEXT: s_load_b32 s2, s[0:1], 0x0
3124 ; GFX11-DL-NEXT: s_waitcnt vmcnt(2)
3125 ; GFX11-DL-NEXT: v_perm_b32 v4, v2, v1, 0xc0c0501
3126 ; GFX11-DL-NEXT: v_perm_b32 v1, v2, v1, 0xc0c0400
3127 ; GFX11-DL-NEXT: s_waitcnt vmcnt(0)
3128 ; GFX11-DL-NEXT: v_perm_b32 v5, v0, v3, 0x5010c0c
3129 ; GFX11-DL-NEXT: v_perm_b32 v0, v0, v3, 0x4000c0c
3130 ; GFX11-DL-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
3131 ; GFX11-DL-NEXT: v_or_b32_e32 v2, v5, v4
3132 ; GFX11-DL-NEXT: v_or_b32_e32 v0, v0, v1
3133 ; GFX11-DL-NEXT: v_mov_b32_e32 v1, 0
3134 ; GFX11-DL-NEXT: s_waitcnt lgkmcnt(0)
3135 ; GFX11-DL-NEXT: s_delay_alu instid0(VALU_DEP_2)
3136 ; GFX11-DL-NEXT: v_dot4_i32_iu8 v0, v0, v2, s2 neg_lo:[1,1,0]
3137 ; GFX11-DL-NEXT: global_store_b32 v1, v0, s[0:1]
3138 ; GFX11-DL-NEXT: s_nop 0
3139 ; GFX11-DL-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
3140 ; GFX11-DL-NEXT: s_endpgm
3141 ptr addrspace(1) %src2,
3142 ptr addrspace(1) %src3,
3143 ptr addrspace(1) %src4,
3144 ptr addrspace(1) nocapture %dst) {
3146 %idx = call i32 @llvm.amdgcn.workitem.id.x()
3148 %gep1 = getelementptr <4 x i8>, ptr addrspace(1) %src1, i32 %idx
3149 %vec1 = load <4 x i8>, ptr addrspace(1) %gep1
3150 %gep2 = getelementptr <4 x i8>, ptr addrspace(1) %src2, i32 %idx
3151 %vec2 = load <4 x i8>, ptr addrspace(1) %gep2
3152 %gep3 = getelementptr <4 x i8>, ptr addrspace(1) %src3, i32 %idx
3153 %vec3 = load <4 x i8>, ptr addrspace(1) %gep3
3154 %gep4 = getelementptr <4 x i8>, ptr addrspace(1) %src4, i32 %idx
3155 %vec4 = load <4 x i8>, ptr addrspace(1) %gep4
3158 %v1e0 = extractelement <4 x i8> %vec1, i64 0
3159 %cv1e0 = sext i8 %v1e0 to i32
3160 %v1e1 = extractelement <4 x i8> %vec1, i64 1
3161 %cv1e1 = sext i8 %v1e1 to i32
3162 %mul1 = mul nuw nsw i32 %cv1e0, %cv1e1
3164 %v2e0 = extractelement <4 x i8> %vec2, i64 0
3165 %cv2e0 = sext i8 %v2e0 to i32
3166 %v2e1 = extractelement <4 x i8> %vec2, i64 1
3167 %cv2e1 = sext i8 %v2e1 to i32
3168 %mul2 = mul nuw nsw i32 %cv2e0, %cv2e1
3170 %v3e0 = extractelement <4 x i8> %vec3, i64 0
3171 %cv3e0 = sext i8 %v3e0 to i32
3172 %v3e1 = extractelement <4 x i8> %vec3, i64 1
3173 %cv3e1 = sext i8 %v3e1 to i32
3174 %mul3 = mul nuw nsw i32 %cv3e0, %cv3e1
3176 %v4e0 = extractelement <4 x i8> %vec4, i64 0
3177 %cv4e0 = sext i8 %v4e0 to i32
3178 %v4e1 = extractelement <4 x i8> %vec4, i64 1
3179 %cv4e1 = sext i8 %v4e1 to i32
3180 %mul4 = mul nuw nsw i32 %cv4e0, %cv4e1
3183 %acc = load i32, ptr addrspace(1) %dst, align 4
3184 %mad1 = add i32 %mul1, %acc
3185 %mad2 = add i32 %mad1, %mul2
3186 %mad3 = add i32 %mad2, %mul3
3187 %mad4 = add i32 %mad3, %mul4
3189 store i32 %mad4, ptr addrspace(1) %dst, align 4
3193 define amdgpu_kernel void @idot4_nonstandard_signed(ptr addrspace(1) %src1,
3194 ; GFX7-LABEL: idot4_nonstandard_signed:
3195 ; GFX7: ; %bb.0: ; %entry
3196 ; GFX7-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x9
3197 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0xd
3198 ; GFX7-NEXT: s_mov_b32 s3, 0xf000
3199 ; GFX7-NEXT: s_mov_b32 s10, 0
3200 ; GFX7-NEXT: s_mov_b32 s11, s3
3201 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
3202 ; GFX7-NEXT: s_mov_b64 s[8:9], s[4:5]
3203 ; GFX7-NEXT: v_lshlrev_b32_e32 v0, 2, v0
3204 ; GFX7-NEXT: v_mov_b32_e32 v1, 0
3205 ; GFX7-NEXT: buffer_load_dword v2, v[0:1], s[8:11], 0 addr64
3206 ; GFX7-NEXT: s_mov_b64 s[8:9], s[6:7]
3207 ; GFX7-NEXT: buffer_load_dword v0, v[0:1], s[8:11], 0 addr64
3208 ; GFX7-NEXT: s_mov_b32 s2, -1
3209 ; GFX7-NEXT: s_waitcnt vmcnt(1)
3210 ; GFX7-NEXT: v_bfe_i32 v1, v2, 0, 8
3211 ; GFX7-NEXT: v_bfe_i32 v3, v2, 8, 8
3212 ; GFX7-NEXT: v_and_b32_e32 v1, 0xffff, v1
3213 ; GFX7-NEXT: s_waitcnt vmcnt(0)
3214 ; GFX7-NEXT: v_and_b32_e32 v5, 0xff, v0
3215 ; GFX7-NEXT: v_bfe_i32 v4, v2, 16, 8
3216 ; GFX7-NEXT: v_bfe_u32 v6, v0, 8, 8
3217 ; GFX7-NEXT: v_and_b32_e32 v3, 0xffff, v3
3218 ; GFX7-NEXT: v_mul_u32_u24_e32 v1, v1, v5
3219 ; GFX7-NEXT: v_ashrrev_i32_e32 v2, 24, v2
3220 ; GFX7-NEXT: v_bfe_u32 v7, v0, 16, 8
3221 ; GFX7-NEXT: v_and_b32_e32 v4, 0xffff, v4
3222 ; GFX7-NEXT: v_mad_u32_u24 v1, v6, v3, v1
3223 ; GFX7-NEXT: v_lshrrev_b32_e32 v0, 24, v0
3224 ; GFX7-NEXT: v_mad_u32_u24 v1, v7, v4, v1
3225 ; GFX7-NEXT: v_and_b32_e32 v2, 0xffff, v2
3226 ; GFX7-NEXT: v_mad_u32_u24 v0, v2, v0, v1
3227 ; GFX7-NEXT: v_bfe_i32 v0, v0, 0, 16
3228 ; GFX7-NEXT: buffer_store_dword v0, off, s[0:3], 0
3229 ; GFX7-NEXT: s_endpgm
3231 ; GFX8-LABEL: idot4_nonstandard_signed:
3232 ; GFX8: ; %bb.0: ; %entry
3233 ; GFX8-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x24
3234 ; GFX8-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x34
3235 ; GFX8-NEXT: v_lshlrev_b32_e32 v2, 2, v0
3236 ; GFX8-NEXT: v_mov_b32_e32 v4, 0xff
3237 ; GFX8-NEXT: s_waitcnt lgkmcnt(0)
3238 ; GFX8-NEXT: v_mov_b32_e32 v1, s5
3239 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, s4, v2
3240 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
3241 ; GFX8-NEXT: flat_load_dword v3, v[0:1]
3242 ; GFX8-NEXT: v_mov_b32_e32 v1, s7
3243 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, s6, v2
3244 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
3245 ; GFX8-NEXT: flat_load_dword v2, v[0:1]
3246 ; GFX8-NEXT: v_mov_b32_e32 v0, s0
3247 ; GFX8-NEXT: v_mov_b32_e32 v1, s1
3248 ; GFX8-NEXT: s_waitcnt vmcnt(1)
3249 ; GFX8-NEXT: v_lshrrev_b32_e32 v7, 8, v3
3250 ; GFX8-NEXT: v_lshrrev_b32_e32 v5, 16, v3
3251 ; GFX8-NEXT: v_bfe_i32 v7, v7, 0, 8
3252 ; GFX8-NEXT: v_bfe_i32 v5, v5, 0, 8
3253 ; GFX8-NEXT: s_waitcnt vmcnt(0)
3254 ; GFX8-NEXT: v_lshrrev_b32_e32 v8, 8, v2
3255 ; GFX8-NEXT: v_mul_lo_u16_sdwa v6, sext(v3), v2 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:BYTE_0
3256 ; GFX8-NEXT: v_and_b32_e32 v8, 0xff, v8
3257 ; GFX8-NEXT: v_and_b32_sdwa v4, v2, v4 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_1 src1_sel:DWORD
3258 ; GFX8-NEXT: v_lshrrev_b32_e32 v3, 24, v3
3259 ; GFX8-NEXT: v_mad_u16 v6, v8, v7, v6
3260 ; GFX8-NEXT: v_bfe_i32 v3, v3, 0, 8
3261 ; GFX8-NEXT: v_mad_u16 v4, v4, v5, v6
3262 ; GFX8-NEXT: v_lshrrev_b32_e32 v2, 24, v2
3263 ; GFX8-NEXT: v_mad_u16 v2, v3, v2, v4
3264 ; GFX8-NEXT: v_bfe_i32 v2, v2, 0, 16
3265 ; GFX8-NEXT: flat_store_dword v[0:1], v2
3266 ; GFX8-NEXT: s_endpgm
3268 ; GFX9-NODL-LABEL: idot4_nonstandard_signed:
3269 ; GFX9-NODL: ; %bb.0: ; %entry
3270 ; GFX9-NODL-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x24
3271 ; GFX9-NODL-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x34
3272 ; GFX9-NODL-NEXT: v_lshlrev_b32_e32 v0, 2, v0
3273 ; GFX9-NODL-NEXT: s_movk_i32 s0, 0xff
3274 ; GFX9-NODL-NEXT: s_waitcnt lgkmcnt(0)
3275 ; GFX9-NODL-NEXT: global_load_dword v1, v0, s[4:5]
3276 ; GFX9-NODL-NEXT: global_load_dword v2, v0, s[6:7]
3277 ; GFX9-NODL-NEXT: v_mov_b32_e32 v0, 0
3278 ; GFX9-NODL-NEXT: s_waitcnt vmcnt(1)
3279 ; GFX9-NODL-NEXT: v_lshrrev_b32_e32 v5, 8, v1
3280 ; GFX9-NODL-NEXT: s_waitcnt vmcnt(0)
3281 ; GFX9-NODL-NEXT: v_lshrrev_b32_e32 v6, 8, v2
3282 ; GFX9-NODL-NEXT: v_lshrrev_b32_e32 v3, 16, v1
3283 ; GFX9-NODL-NEXT: v_mul_lo_u16_sdwa v4, sext(v1), v2 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:BYTE_0
3284 ; GFX9-NODL-NEXT: v_bfe_i32 v5, v5, 0, 8
3285 ; GFX9-NODL-NEXT: v_and_b32_e32 v6, 0xff, v6
3286 ; GFX9-NODL-NEXT: v_and_b32_sdwa v7, v2, s0 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_1 src1_sel:DWORD
3287 ; GFX9-NODL-NEXT: v_lshrrev_b32_e32 v1, 24, v1
3288 ; GFX9-NODL-NEXT: v_bfe_i32 v3, v3, 0, 8
3289 ; GFX9-NODL-NEXT: v_mad_legacy_u16 v4, v6, v5, v4
3290 ; GFX9-NODL-NEXT: v_bfe_i32 v1, v1, 0, 8
3291 ; GFX9-NODL-NEXT: v_mad_legacy_u16 v3, v7, v3, v4
3292 ; GFX9-NODL-NEXT: v_lshrrev_b32_e32 v2, 24, v2
3293 ; GFX9-NODL-NEXT: v_mad_legacy_u16 v1, v1, v2, v3
3294 ; GFX9-NODL-NEXT: v_bfe_i32 v1, v1, 0, 16
3295 ; GFX9-NODL-NEXT: global_store_dword v0, v1, s[2:3]
3296 ; GFX9-NODL-NEXT: s_endpgm
3298 ; GFX9-DL-LABEL: idot4_nonstandard_signed:
3299 ; GFX9-DL: ; %bb.0: ; %entry
3300 ; GFX9-DL-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x24
3301 ; GFX9-DL-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x34
3302 ; GFX9-DL-NEXT: v_lshlrev_b32_e32 v0, 2, v0
3303 ; GFX9-DL-NEXT: s_movk_i32 s0, 0xff
3304 ; GFX9-DL-NEXT: s_waitcnt lgkmcnt(0)
3305 ; GFX9-DL-NEXT: global_load_dword v1, v0, s[4:5]
3306 ; GFX9-DL-NEXT: global_load_dword v2, v0, s[6:7]
3307 ; GFX9-DL-NEXT: v_mov_b32_e32 v0, 0
3308 ; GFX9-DL-NEXT: s_waitcnt vmcnt(1)
3309 ; GFX9-DL-NEXT: v_lshrrev_b32_e32 v5, 8, v1
3310 ; GFX9-DL-NEXT: s_waitcnt vmcnt(0)
3311 ; GFX9-DL-NEXT: v_lshrrev_b32_e32 v6, 8, v2
3312 ; GFX9-DL-NEXT: v_lshrrev_b32_e32 v3, 16, v1
3313 ; GFX9-DL-NEXT: v_mul_lo_u16_sdwa v4, sext(v1), v2 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:BYTE_0
3314 ; GFX9-DL-NEXT: v_bfe_i32 v5, v5, 0, 8
3315 ; GFX9-DL-NEXT: v_and_b32_e32 v6, 0xff, v6
3316 ; GFX9-DL-NEXT: v_and_b32_sdwa v7, v2, s0 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_1 src1_sel:DWORD
3317 ; GFX9-DL-NEXT: v_lshrrev_b32_e32 v1, 24, v1
3318 ; GFX9-DL-NEXT: v_bfe_i32 v3, v3, 0, 8
3319 ; GFX9-DL-NEXT: v_mad_legacy_u16 v4, v6, v5, v4
3320 ; GFX9-DL-NEXT: v_bfe_i32 v1, v1, 0, 8
3321 ; GFX9-DL-NEXT: v_mad_legacy_u16 v3, v7, v3, v4
3322 ; GFX9-DL-NEXT: v_lshrrev_b32_e32 v2, 24, v2
3323 ; GFX9-DL-NEXT: v_mad_legacy_u16 v1, v1, v2, v3
3324 ; GFX9-DL-NEXT: v_bfe_i32 v1, v1, 0, 16
3325 ; GFX9-DL-NEXT: global_store_dword v0, v1, s[2:3]
3326 ; GFX9-DL-NEXT: s_endpgm
3328 ; GFX10-DL-LABEL: idot4_nonstandard_signed:
3329 ; GFX10-DL: ; %bb.0: ; %entry
3330 ; GFX10-DL-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x24
3331 ; GFX10-DL-NEXT: v_lshlrev_b32_e32 v0, 2, v0
3332 ; GFX10-DL-NEXT: v_mov_b32_e32 v6, 0xff
3333 ; GFX10-DL-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x34
3334 ; GFX10-DL-NEXT: s_waitcnt lgkmcnt(0)
3335 ; GFX10-DL-NEXT: s_clause 0x1
3336 ; GFX10-DL-NEXT: global_load_dword v1, v0, s[4:5]
3337 ; GFX10-DL-NEXT: global_load_dword v2, v0, s[6:7]
3338 ; GFX10-DL-NEXT: s_waitcnt vmcnt(1)
3339 ; GFX10-DL-NEXT: v_bfe_i32 v0, v1, 0, 8
3340 ; GFX10-DL-NEXT: s_waitcnt vmcnt(0)
3341 ; GFX10-DL-NEXT: v_and_b32_e32 v3, 0xff, v2
3342 ; GFX10-DL-NEXT: v_lshrrev_b32_e32 v4, 8, v1
3343 ; GFX10-DL-NEXT: v_lshrrev_b32_e32 v5, 8, v2
3344 ; GFX10-DL-NEXT: v_lshrrev_b32_e32 v7, 16, v1
3345 ; GFX10-DL-NEXT: v_lshrrev_b32_e32 v1, 24, v1
3346 ; GFX10-DL-NEXT: v_mul_lo_u16 v0, v0, v3
3347 ; GFX10-DL-NEXT: v_bfe_i32 v3, v4, 0, 8
3348 ; GFX10-DL-NEXT: v_and_b32_e32 v4, 0xff, v5
3349 ; GFX10-DL-NEXT: v_and_b32_sdwa v5, v2, v6 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_1 src1_sel:DWORD
3350 ; GFX10-DL-NEXT: v_bfe_i32 v6, v7, 0, 8
3351 ; GFX10-DL-NEXT: v_bfe_i32 v1, v1, 0, 8
3352 ; GFX10-DL-NEXT: v_lshrrev_b32_e32 v2, 24, v2
3353 ; GFX10-DL-NEXT: v_mad_u16 v0, v4, v3, v0
3354 ; GFX10-DL-NEXT: v_mad_u16 v0, v5, v6, v0
3355 ; GFX10-DL-NEXT: v_mad_u16 v0, v1, v2, v0
3356 ; GFX10-DL-NEXT: v_mov_b32_e32 v1, 0
3357 ; GFX10-DL-NEXT: v_bfe_i32 v0, v0, 0, 16
3358 ; GFX10-DL-NEXT: global_store_dword v1, v0, s[0:1]
3359 ; GFX10-DL-NEXT: s_endpgm
3361 ; GFX11-DL-LABEL: idot4_nonstandard_signed:
3362 ; GFX11-DL: ; %bb.0: ; %entry
3363 ; GFX11-DL-NEXT: s_load_b128 s[4:7], s[0:1], 0x24
3364 ; GFX11-DL-NEXT: v_lshlrev_b32_e32 v0, 2, v0
3365 ; GFX11-DL-NEXT: s_load_b64 s[0:1], s[0:1], 0x34
3366 ; GFX11-DL-NEXT: s_waitcnt lgkmcnt(0)
3367 ; GFX11-DL-NEXT: s_clause 0x1
3368 ; GFX11-DL-NEXT: global_load_b32 v1, v0, s[4:5]
3369 ; GFX11-DL-NEXT: global_load_b32 v0, v0, s[6:7]
3370 ; GFX11-DL-NEXT: s_waitcnt vmcnt(1)
3371 ; GFX11-DL-NEXT: v_bfe_i32 v2, v1, 0, 8
3372 ; GFX11-DL-NEXT: s_waitcnt vmcnt(0)
3373 ; GFX11-DL-NEXT: v_and_b32_e32 v3, 0xff, v0
3374 ; GFX11-DL-NEXT: v_lshrrev_b32_e32 v4, 8, v1
3375 ; GFX11-DL-NEXT: v_lshrrev_b32_e32 v5, 8, v0
3376 ; GFX11-DL-NEXT: v_lshrrev_b32_e32 v6, 16, v1
3377 ; GFX11-DL-NEXT: v_lshrrev_b32_e32 v7, 16, v0
3378 ; GFX11-DL-NEXT: v_mul_lo_u16 v2, v2, v3
3379 ; GFX11-DL-NEXT: v_bfe_i32 v3, v4, 0, 8
3380 ; GFX11-DL-NEXT: v_and_b32_e32 v4, 0xff, v5
3381 ; GFX11-DL-NEXT: v_lshrrev_b32_e32 v1, 24, v1
3382 ; GFX11-DL-NEXT: v_bfe_i32 v5, v6, 0, 8
3383 ; GFX11-DL-NEXT: v_and_b32_e32 v6, 0xff, v7
3384 ; GFX11-DL-NEXT: v_lshrrev_b32_e32 v0, 24, v0
3385 ; GFX11-DL-NEXT: v_mad_u16 v2, v4, v3, v2
3386 ; GFX11-DL-NEXT: v_bfe_i32 v1, v1, 0, 8
3387 ; GFX11-DL-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
3388 ; GFX11-DL-NEXT: v_mad_u16 v2, v6, v5, v2
3389 ; GFX11-DL-NEXT: v_mad_u16 v0, v1, v0, v2
3390 ; GFX11-DL-NEXT: v_mov_b32_e32 v1, 0
3391 ; GFX11-DL-NEXT: s_delay_alu instid0(VALU_DEP_2)
3392 ; GFX11-DL-NEXT: v_bfe_i32 v0, v0, 0, 16
3393 ; GFX11-DL-NEXT: global_store_b32 v1, v0, s[0:1]
3394 ; GFX11-DL-NEXT: s_nop 0
3395 ; GFX11-DL-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
3396 ; GFX11-DL-NEXT: s_endpgm
3397 ptr addrspace(1) %src2,
3398 ptr addrspace(1) nocapture %dst) {
3400 %idx = call i32 @llvm.amdgcn.workitem.id.x()
3401 %gep1 = getelementptr <4 x i8>, ptr addrspace(1) %src1, i32 %idx
3402 %vec1 = load <4 x i8>, ptr addrspace(1) %gep1
3403 %gep2 = getelementptr <4 x i8>, ptr addrspace(1) %src2, i32 %idx
3404 %vec2 = load <4 x i8>, ptr addrspace(1) %gep2
3405 %v1e0 = extractelement <4 x i8> %vec1, i64 0
3406 %v1e0e = sext i8 %v1e0 to i16
3407 %v2e0 = extractelement <4 x i8> %vec2, i64 0
3408 %v2e0e = zext i8 %v2e0 to i16
3409 %mul0 = mul nsw i16 %v1e0e, %v2e0e
3410 %add0 = add i16 %mul0, 0
3412 %v1e1 = extractelement <4 x i8> %vec1, i64 1
3413 %v1e1e = sext i8 %v1e1 to i16
3414 %v2e1 = extractelement <4 x i8> %vec2, i64 1
3415 %v2e1e = zext i8 %v2e1 to i16
3416 %mul1 = mul nsw i16 %v2e1e, %v1e1e
3417 %add1 = add i16 %mul1, %add0
3418 %v1e2 = extractelement <4 x i8> %vec1, i64 2
3419 %v1e2e = sext i8 %v1e2 to i16
3420 %v2e2 = extractelement <4 x i8> %vec2, i64 2
3421 %v2e2e = zext i8 %v2e2 to i16
3422 %mul2 = mul nsw i16 %v2e2e, %v1e2e
3423 %add2 = add i16 %mul2, %add1
3424 %v1e3 = extractelement <4 x i8> %vec1, i64 3
3425 %v1e3e = sext i8 %v1e3 to i16
3426 %v2e3 = extractelement <4 x i8> %vec2, i64 3
3427 %v2e3e = zext i8 %v2e3 to i16
3428 %mul3 = mul nsw i16 %v1e3e, %v2e3e
3429 %add3 = add i16 %mul3, %add2
3430 %res = sext i16 %add3 to i32
3431 store i32 %res, ptr addrspace(1) %dst, align 4
3436 declare i32 @llvm.amdgcn.workitem.id.x()