1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=tonga -verify-machineinstrs < %s | FileCheck -check-prefixes=PREGFX10-UNPACKED %s
3 ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx810 -verify-machineinstrs < %s | FileCheck -check-prefixes=PREGFX10-PACKED %s
4 ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 -verify-machineinstrs < %s | FileCheck -check-prefixes=PREGFX10-PACKED %s
5 ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1010 -verify-machineinstrs < %s | FileCheck -check-prefixes=GFX10-PACKED %s
6 ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1100 -amdgpu-enable-vopd=0 -verify-machineinstrs < %s | FileCheck -check-prefixes=GFX11-PACKED %s
8 define amdgpu_kernel void @tbuffer_store_d16_x(<4 x i32> %rsrc, half %data, i32 %vindex) {
9 ; PREGFX10-UNPACKED-LABEL: tbuffer_store_d16_x:
10 ; PREGFX10-UNPACKED: ; %bb.0: ; %main_body
11 ; PREGFX10-UNPACKED-NEXT: s_load_dwordx2 s[6:7], s[4:5], 0x10
12 ; PREGFX10-UNPACKED-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
13 ; PREGFX10-UNPACKED-NEXT: s_waitcnt lgkmcnt(0)
14 ; PREGFX10-UNPACKED-NEXT: v_mov_b32_e32 v0, s6
15 ; PREGFX10-UNPACKED-NEXT: v_mov_b32_e32 v1, s7
16 ; PREGFX10-UNPACKED-NEXT: tbuffer_store_format_d16_x v0, v1, s[0:3], 0 format:[BUF_NUM_FORMAT_USCALED] idxen
17 ; PREGFX10-UNPACKED-NEXT: s_endpgm
19 ; PREGFX10-PACKED-LABEL: tbuffer_store_d16_x:
20 ; PREGFX10-PACKED: ; %bb.0: ; %main_body
21 ; PREGFX10-PACKED-NEXT: s_load_dwordx2 s[6:7], s[4:5], 0x10
22 ; PREGFX10-PACKED-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
23 ; PREGFX10-PACKED-NEXT: s_waitcnt lgkmcnt(0)
24 ; PREGFX10-PACKED-NEXT: v_mov_b32_e32 v0, s6
25 ; PREGFX10-PACKED-NEXT: v_mov_b32_e32 v1, s7
26 ; PREGFX10-PACKED-NEXT: tbuffer_store_format_d16_x v0, v1, s[0:3], 0 format:[BUF_NUM_FORMAT_USCALED] idxen
27 ; PREGFX10-PACKED-NEXT: s_endpgm
29 ; GFX10-PACKED-LABEL: tbuffer_store_d16_x:
30 ; GFX10-PACKED: ; %bb.0: ; %main_body
31 ; GFX10-PACKED-NEXT: s_clause 0x1
32 ; GFX10-PACKED-NEXT: s_load_dwordx2 s[6:7], s[4:5], 0x10
33 ; GFX10-PACKED-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
34 ; GFX10-PACKED-NEXT: s_waitcnt lgkmcnt(0)
35 ; GFX10-PACKED-NEXT: v_mov_b32_e32 v0, s6
36 ; GFX10-PACKED-NEXT: v_mov_b32_e32 v1, s7
37 ; GFX10-PACKED-NEXT: tbuffer_store_format_d16_x v0, v1, s[0:3], 0 format:[BUF_FMT_10_11_11_SSCALED] idxen
38 ; GFX10-PACKED-NEXT: s_endpgm
40 ; GFX11-PACKED-LABEL: tbuffer_store_d16_x:
41 ; GFX11-PACKED: ; %bb.0: ; %main_body
42 ; GFX11-PACKED-NEXT: s_clause 0x1
43 ; GFX11-PACKED-NEXT: s_load_b64 s[4:5], s[0:1], 0x10
44 ; GFX11-PACKED-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
45 ; GFX11-PACKED-NEXT: s_waitcnt lgkmcnt(0)
46 ; GFX11-PACKED-NEXT: v_mov_b32_e32 v0, s4
47 ; GFX11-PACKED-NEXT: v_mov_b32_e32 v1, s5
48 ; GFX11-PACKED-NEXT: tbuffer_store_d16_format_x v0, v1, s[0:3], 0 format:[BUF_FMT_10_10_10_2_SNORM] idxen
49 ; GFX11-PACKED-NEXT: s_nop 0
50 ; GFX11-PACKED-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
51 ; GFX11-PACKED-NEXT: s_endpgm
53 call void @llvm.amdgcn.struct.tbuffer.store.f16(half %data, <4 x i32> %rsrc, i32 %vindex, i32 0, i32 0, i32 33, i32 0)
57 define amdgpu_kernel void @tbuffer_store_d16_xy(<4 x i32> %rsrc, <2 x half> %data, i32 %vindex) {
58 ; PREGFX10-UNPACKED-LABEL: tbuffer_store_d16_xy:
59 ; PREGFX10-UNPACKED: ; %bb.0: ; %main_body
60 ; PREGFX10-UNPACKED-NEXT: s_load_dwordx2 s[6:7], s[4:5], 0x10
61 ; PREGFX10-UNPACKED-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
62 ; PREGFX10-UNPACKED-NEXT: s_waitcnt lgkmcnt(0)
63 ; PREGFX10-UNPACKED-NEXT: s_lshr_b32 s4, s6, 16
64 ; PREGFX10-UNPACKED-NEXT: s_and_b32 s5, s6, 0xffff
65 ; PREGFX10-UNPACKED-NEXT: v_mov_b32_e32 v0, s5
66 ; PREGFX10-UNPACKED-NEXT: v_mov_b32_e32 v1, s4
67 ; PREGFX10-UNPACKED-NEXT: v_mov_b32_e32 v2, s7
68 ; PREGFX10-UNPACKED-NEXT: tbuffer_store_format_d16_xy v[0:1], v2, s[0:3], 0 format:[BUF_NUM_FORMAT_USCALED] idxen
69 ; PREGFX10-UNPACKED-NEXT: s_endpgm
71 ; PREGFX10-PACKED-LABEL: tbuffer_store_d16_xy:
72 ; PREGFX10-PACKED: ; %bb.0: ; %main_body
73 ; PREGFX10-PACKED-NEXT: s_load_dwordx2 s[6:7], s[4:5], 0x10
74 ; PREGFX10-PACKED-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
75 ; PREGFX10-PACKED-NEXT: s_waitcnt lgkmcnt(0)
76 ; PREGFX10-PACKED-NEXT: v_mov_b32_e32 v0, s6
77 ; PREGFX10-PACKED-NEXT: v_mov_b32_e32 v1, s7
78 ; PREGFX10-PACKED-NEXT: tbuffer_store_format_d16_xy v0, v1, s[0:3], 0 format:[BUF_NUM_FORMAT_USCALED] idxen
79 ; PREGFX10-PACKED-NEXT: s_endpgm
81 ; GFX10-PACKED-LABEL: tbuffer_store_d16_xy:
82 ; GFX10-PACKED: ; %bb.0: ; %main_body
83 ; GFX10-PACKED-NEXT: s_clause 0x1
84 ; GFX10-PACKED-NEXT: s_load_dwordx2 s[6:7], s[4:5], 0x10
85 ; GFX10-PACKED-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
86 ; GFX10-PACKED-NEXT: s_waitcnt lgkmcnt(0)
87 ; GFX10-PACKED-NEXT: v_mov_b32_e32 v0, s6
88 ; GFX10-PACKED-NEXT: v_mov_b32_e32 v1, s7
89 ; GFX10-PACKED-NEXT: tbuffer_store_format_d16_xy v0, v1, s[0:3], 0 format:[BUF_FMT_10_11_11_SSCALED] idxen
90 ; GFX10-PACKED-NEXT: s_endpgm
92 ; GFX11-PACKED-LABEL: tbuffer_store_d16_xy:
93 ; GFX11-PACKED: ; %bb.0: ; %main_body
94 ; GFX11-PACKED-NEXT: s_clause 0x1
95 ; GFX11-PACKED-NEXT: s_load_b64 s[4:5], s[0:1], 0x10
96 ; GFX11-PACKED-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
97 ; GFX11-PACKED-NEXT: s_waitcnt lgkmcnt(0)
98 ; GFX11-PACKED-NEXT: v_mov_b32_e32 v0, s4
99 ; GFX11-PACKED-NEXT: v_mov_b32_e32 v1, s5
100 ; GFX11-PACKED-NEXT: tbuffer_store_d16_format_xy v0, v1, s[0:3], 0 format:[BUF_FMT_10_10_10_2_SNORM] idxen
101 ; GFX11-PACKED-NEXT: s_nop 0
102 ; GFX11-PACKED-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
103 ; GFX11-PACKED-NEXT: s_endpgm
105 call void @llvm.amdgcn.struct.tbuffer.store.v2f16(<2 x half> %data, <4 x i32> %rsrc, i32 %vindex, i32 0, i32 0, i32 33, i32 0)
109 define amdgpu_kernel void @tbuffer_store_d16_xyz(<4 x i32> %rsrc, <4 x half> %data, i32 %vindex) {
110 ; PREGFX10-UNPACKED-LABEL: tbuffer_store_d16_xyz:
111 ; PREGFX10-UNPACKED: ; %bb.0: ; %main_body
112 ; PREGFX10-UNPACKED-NEXT: s_load_dwordx2 s[6:7], s[4:5], 0x10
113 ; PREGFX10-UNPACKED-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
114 ; PREGFX10-UNPACKED-NEXT: s_load_dword s4, s[4:5], 0x18
115 ; PREGFX10-UNPACKED-NEXT: s_waitcnt lgkmcnt(0)
116 ; PREGFX10-UNPACKED-NEXT: s_and_b32 s5, s7, 0xffff
117 ; PREGFX10-UNPACKED-NEXT: s_lshr_b32 s7, s6, 16
118 ; PREGFX10-UNPACKED-NEXT: s_and_b32 s6, s6, 0xffff
119 ; PREGFX10-UNPACKED-NEXT: v_mov_b32_e32 v0, s6
120 ; PREGFX10-UNPACKED-NEXT: v_mov_b32_e32 v1, s7
121 ; PREGFX10-UNPACKED-NEXT: v_mov_b32_e32 v2, s5
122 ; PREGFX10-UNPACKED-NEXT: v_mov_b32_e32 v3, s4
123 ; PREGFX10-UNPACKED-NEXT: tbuffer_store_format_d16_xyz v[0:2], v3, s[0:3], 0 format:[BUF_NUM_FORMAT_USCALED] idxen
124 ; PREGFX10-UNPACKED-NEXT: s_endpgm
126 ; PREGFX10-PACKED-LABEL: tbuffer_store_d16_xyz:
127 ; PREGFX10-PACKED: ; %bb.0: ; %main_body
128 ; PREGFX10-PACKED-NEXT: s_load_dwordx2 s[6:7], s[4:5], 0x10
129 ; PREGFX10-PACKED-NEXT: s_load_dword s8, s[4:5], 0x18
130 ; PREGFX10-PACKED-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
131 ; PREGFX10-PACKED-NEXT: s_waitcnt lgkmcnt(0)
132 ; PREGFX10-PACKED-NEXT: s_and_b32 s4, s7, 0xffff
133 ; PREGFX10-PACKED-NEXT: v_mov_b32_e32 v0, s6
134 ; PREGFX10-PACKED-NEXT: v_mov_b32_e32 v1, s4
135 ; PREGFX10-PACKED-NEXT: v_mov_b32_e32 v2, s8
136 ; PREGFX10-PACKED-NEXT: tbuffer_store_format_d16_xyz v[0:1], v2, s[0:3], 0 format:[BUF_NUM_FORMAT_USCALED] idxen
137 ; PREGFX10-PACKED-NEXT: s_endpgm
139 ; GFX10-PACKED-LABEL: tbuffer_store_d16_xyz:
140 ; GFX10-PACKED: ; %bb.0: ; %main_body
141 ; GFX10-PACKED-NEXT: s_clause 0x2
142 ; GFX10-PACKED-NEXT: s_load_dwordx2 s[6:7], s[4:5], 0x10
143 ; GFX10-PACKED-NEXT: s_load_dword s8, s[4:5], 0x18
144 ; GFX10-PACKED-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
145 ; GFX10-PACKED-NEXT: s_waitcnt lgkmcnt(0)
146 ; GFX10-PACKED-NEXT: s_and_b32 s4, s7, 0xffff
147 ; GFX10-PACKED-NEXT: v_mov_b32_e32 v0, s6
148 ; GFX10-PACKED-NEXT: v_mov_b32_e32 v1, s4
149 ; GFX10-PACKED-NEXT: v_mov_b32_e32 v2, s8
150 ; GFX10-PACKED-NEXT: tbuffer_store_format_d16_xyz v[0:1], v2, s[0:3], 0 format:[BUF_FMT_10_11_11_SSCALED] idxen
151 ; GFX10-PACKED-NEXT: s_endpgm
153 ; GFX11-PACKED-LABEL: tbuffer_store_d16_xyz:
154 ; GFX11-PACKED: ; %bb.0: ; %main_body
155 ; GFX11-PACKED-NEXT: s_clause 0x2
156 ; GFX11-PACKED-NEXT: s_load_b64 s[4:5], s[0:1], 0x10
157 ; GFX11-PACKED-NEXT: s_load_b32 s6, s[0:1], 0x18
158 ; GFX11-PACKED-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
159 ; GFX11-PACKED-NEXT: s_waitcnt lgkmcnt(0)
160 ; GFX11-PACKED-NEXT: s_and_b32 s5, s5, 0xffff
161 ; GFX11-PACKED-NEXT: v_mov_b32_e32 v0, s4
162 ; GFX11-PACKED-NEXT: v_mov_b32_e32 v1, s5
163 ; GFX11-PACKED-NEXT: v_mov_b32_e32 v2, s6
164 ; GFX11-PACKED-NEXT: tbuffer_store_d16_format_xyz v[0:1], v2, s[0:3], 0 format:[BUF_FMT_10_10_10_2_SNORM] idxen
165 ; GFX11-PACKED-NEXT: s_nop 0
166 ; GFX11-PACKED-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
167 ; GFX11-PACKED-NEXT: s_endpgm
169 %data_subvec = shufflevector <4 x half> %data, <4 x half> undef, <3 x i32> <i32 0, i32 1, i32 2>
170 call void @llvm.amdgcn.struct.tbuffer.store.v3f16(<3 x half> %data_subvec, <4 x i32> %rsrc, i32 %vindex, i32 0, i32 0, i32 33, i32 0)
174 define amdgpu_kernel void @tbuffer_store_d16_xyzw(<4 x i32> %rsrc, <4 x half> %data, i32 %vindex) {
175 ; PREGFX10-UNPACKED-LABEL: tbuffer_store_d16_xyzw:
176 ; PREGFX10-UNPACKED: ; %bb.0: ; %main_body
177 ; PREGFX10-UNPACKED-NEXT: s_load_dwordx2 s[6:7], s[4:5], 0x10
178 ; PREGFX10-UNPACKED-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
179 ; PREGFX10-UNPACKED-NEXT: s_load_dword s4, s[4:5], 0x18
180 ; PREGFX10-UNPACKED-NEXT: s_waitcnt lgkmcnt(0)
181 ; PREGFX10-UNPACKED-NEXT: s_lshr_b32 s5, s7, 16
182 ; PREGFX10-UNPACKED-NEXT: s_and_b32 s7, s7, 0xffff
183 ; PREGFX10-UNPACKED-NEXT: s_lshr_b32 s8, s6, 16
184 ; PREGFX10-UNPACKED-NEXT: s_and_b32 s6, s6, 0xffff
185 ; PREGFX10-UNPACKED-NEXT: v_mov_b32_e32 v0, s6
186 ; PREGFX10-UNPACKED-NEXT: v_mov_b32_e32 v1, s8
187 ; PREGFX10-UNPACKED-NEXT: v_mov_b32_e32 v2, s7
188 ; PREGFX10-UNPACKED-NEXT: v_mov_b32_e32 v3, s5
189 ; PREGFX10-UNPACKED-NEXT: v_mov_b32_e32 v4, s4
190 ; PREGFX10-UNPACKED-NEXT: tbuffer_store_format_d16_xyzw v[0:3], v4, s[0:3], 0 format:[BUF_NUM_FORMAT_USCALED] idxen
191 ; PREGFX10-UNPACKED-NEXT: s_endpgm
193 ; PREGFX10-PACKED-LABEL: tbuffer_store_d16_xyzw:
194 ; PREGFX10-PACKED: ; %bb.0: ; %main_body
195 ; PREGFX10-PACKED-NEXT: s_load_dwordx2 s[6:7], s[4:5], 0x10
196 ; PREGFX10-PACKED-NEXT: s_load_dword s8, s[4:5], 0x18
197 ; PREGFX10-PACKED-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
198 ; PREGFX10-PACKED-NEXT: s_waitcnt lgkmcnt(0)
199 ; PREGFX10-PACKED-NEXT: v_mov_b32_e32 v0, s6
200 ; PREGFX10-PACKED-NEXT: v_mov_b32_e32 v1, s7
201 ; PREGFX10-PACKED-NEXT: v_mov_b32_e32 v2, s8
202 ; PREGFX10-PACKED-NEXT: tbuffer_store_format_d16_xyzw v[0:1], v2, s[0:3], 0 format:[BUF_NUM_FORMAT_USCALED] idxen
203 ; PREGFX10-PACKED-NEXT: s_endpgm
205 ; GFX10-PACKED-LABEL: tbuffer_store_d16_xyzw:
206 ; GFX10-PACKED: ; %bb.0: ; %main_body
207 ; GFX10-PACKED-NEXT: s_clause 0x2
208 ; GFX10-PACKED-NEXT: s_load_dwordx2 s[6:7], s[4:5], 0x10
209 ; GFX10-PACKED-NEXT: s_load_dword s8, s[4:5], 0x18
210 ; GFX10-PACKED-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
211 ; GFX10-PACKED-NEXT: s_waitcnt lgkmcnt(0)
212 ; GFX10-PACKED-NEXT: v_mov_b32_e32 v0, s6
213 ; GFX10-PACKED-NEXT: v_mov_b32_e32 v1, s7
214 ; GFX10-PACKED-NEXT: v_mov_b32_e32 v2, s8
215 ; GFX10-PACKED-NEXT: tbuffer_store_format_d16_xyzw v[0:1], v2, s[0:3], 0 format:[BUF_FMT_10_11_11_SSCALED] idxen
216 ; GFX10-PACKED-NEXT: s_endpgm
218 ; GFX11-PACKED-LABEL: tbuffer_store_d16_xyzw:
219 ; GFX11-PACKED: ; %bb.0: ; %main_body
220 ; GFX11-PACKED-NEXT: s_clause 0x2
221 ; GFX11-PACKED-NEXT: s_load_b64 s[4:5], s[0:1], 0x10
222 ; GFX11-PACKED-NEXT: s_load_b32 s6, s[0:1], 0x18
223 ; GFX11-PACKED-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
224 ; GFX11-PACKED-NEXT: s_waitcnt lgkmcnt(0)
225 ; GFX11-PACKED-NEXT: v_mov_b32_e32 v0, s4
226 ; GFX11-PACKED-NEXT: v_mov_b32_e32 v1, s5
227 ; GFX11-PACKED-NEXT: v_mov_b32_e32 v2, s6
228 ; GFX11-PACKED-NEXT: tbuffer_store_d16_format_xyzw v[0:1], v2, s[0:3], 0 format:[BUF_FMT_10_10_10_2_SNORM] idxen
229 ; GFX11-PACKED-NEXT: s_nop 0
230 ; GFX11-PACKED-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
231 ; GFX11-PACKED-NEXT: s_endpgm
233 call void @llvm.amdgcn.struct.tbuffer.store.v4f16(<4 x half> %data, <4 x i32> %rsrc, i32 %vindex, i32 0, i32 0, i32 33, i32 0)
237 declare void @llvm.amdgcn.struct.tbuffer.store.f16(half, <4 x i32>, i32, i32, i32, i32, i32)
238 declare void @llvm.amdgcn.struct.tbuffer.store.v2f16(<2 x half>, <4 x i32>, i32, i32, i32, i32, i32)
239 declare void @llvm.amdgcn.struct.tbuffer.store.v3f16(<3 x half>, <4 x i32>, i32, i32, i32, i32, i32)
240 declare void @llvm.amdgcn.struct.tbuffer.store.v4f16(<4 x half>, <4 x i32>, i32, i32, i32, i32, i32)