1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ;RUN: llc < %s -march=amdgcn -mcpu=verde -verify-machineinstrs | FileCheck -check-prefixes=PREGFX10 %s
3 ;RUN: llc < %s -march=amdgcn -mcpu=tonga -verify-machineinstrs | FileCheck -check-prefixes=PREGFX10 %s
4 ;RUN: llc < %s -march=amdgcn -mcpu=gfx1010 -verify-machineinstrs | FileCheck -check-prefixes=GFX10 %s
5 ;RUN: llc < %s -march=amdgcn -mcpu=gfx1100 -verify-machineinstrs | FileCheck -check-prefixes=GFX11 %s
7 define amdgpu_ps void @tbuffer_store(<4 x i32> inreg, <4 x float>, <4 x float>, <4 x float>) {
8 ; PREGFX10-LABEL: tbuffer_store:
9 ; PREGFX10: ; %bb.0: ; %main_body
10 ; PREGFX10-NEXT: tbuffer_store_format_xyzw v[0:3], off, s[0:3], 0 format:[BUF_DATA_FORMAT_16_16_16_16,BUF_NUM_FORMAT_USCALED]
11 ; PREGFX10-NEXT: tbuffer_store_format_xyzw v[4:7], off, s[0:3], 0 format:[BUF_DATA_FORMAT_32_32_32,BUF_NUM_FORMAT_SSCALED] glc
12 ; PREGFX10-NEXT: tbuffer_store_format_xyzw v[8:11], off, s[0:3], 0 format:[BUF_DATA_FORMAT_32_32_32_32,BUF_NUM_FORMAT_UINT] slc
13 ; PREGFX10-NEXT: tbuffer_store_format_xyzw v[8:11], off, s[0:3], 0 format:[BUF_DATA_FORMAT_32_32_32_32,BUF_NUM_FORMAT_UINT] glc
14 ; PREGFX10-NEXT: s_endpgm
16 ; GFX10-LABEL: tbuffer_store:
17 ; GFX10: ; %bb.0: ; %main_body
18 ; GFX10-NEXT: tbuffer_store_format_xyzw v[0:3], off, s[0:3], 0 format:[BUF_FMT_10_10_10_2_UNORM]
19 ; GFX10-NEXT: tbuffer_store_format_xyzw v[4:7], off, s[0:3], 0 format:[BUF_FMT_8_8_8_8_SINT] glc
20 ; GFX10-NEXT: tbuffer_store_format_xyzw v[8:11], off, s[0:3], 0 format:78 slc
21 ; GFX10-NEXT: tbuffer_store_format_xyzw v[8:11], off, s[0:3], 0 format:78 glc dlc
22 ; GFX10-NEXT: s_endpgm
24 ; GFX11-LABEL: tbuffer_store:
25 ; GFX11: ; %bb.0: ; %main_body
26 ; GFX11-NEXT: s_clause 0x3
27 ; GFX11-NEXT: tbuffer_store_format_xyzw v[0:3], off, s[0:3], 0 format:[BUF_FMT_8_8_8_8_USCALED]
28 ; GFX11-NEXT: tbuffer_store_format_xyzw v[4:7], off, s[0:3], 0 format:[BUF_FMT_32_32_32_32_UINT] glc
29 ; GFX11-NEXT: tbuffer_store_format_xyzw v[8:11], off, s[0:3], 0 format:78 slc
30 ; GFX11-NEXT: tbuffer_store_format_xyzw v[8:11], off, s[0:3], 0 format:78 glc dlc
32 ; GFX11-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
33 ; GFX11-NEXT: s_endpgm
35 %in1 = bitcast <4 x float> %1 to <4 x i32>
36 %in2 = bitcast <4 x float> %2 to <4 x i32>
37 %in3 = bitcast <4 x float> %3 to <4 x i32>
38 call void @llvm.amdgcn.raw.tbuffer.store.v4i32(<4 x i32> %in1, <4 x i32> %0, i32 0, i32 0, i32 44, i32 0)
39 call void @llvm.amdgcn.raw.tbuffer.store.v4i32(<4 x i32> %in2, <4 x i32> %0, i32 0, i32 0, i32 61, i32 1)
40 call void @llvm.amdgcn.raw.tbuffer.store.v4i32(<4 x i32> %in3, <4 x i32> %0, i32 0, i32 0, i32 78, i32 2)
41 call void @llvm.amdgcn.raw.tbuffer.store.v4f32(<4 x float> %3, <4 x i32> %0, i32 0, i32 0, i32 78, i32 5)
45 define amdgpu_ps void @tbuffer_store_immoffs(<4 x i32> inreg, <4 x float>) {
46 ; PREGFX10-LABEL: tbuffer_store_immoffs:
47 ; PREGFX10: ; %bb.0: ; %main_body
48 ; PREGFX10-NEXT: tbuffer_store_format_xyzw v[0:3], off, s[0:3], 0 format:[BUF_DATA_FORMAT_16_16,BUF_NUM_FORMAT_FLOAT] offset:42
49 ; PREGFX10-NEXT: s_endpgm
51 ; GFX10-LABEL: tbuffer_store_immoffs:
52 ; GFX10: ; %bb.0: ; %main_body
53 ; GFX10-NEXT: tbuffer_store_format_xyzw v[0:3], off, s[0:3], 0 format:117 offset:42
54 ; GFX10-NEXT: s_endpgm
56 ; GFX11-LABEL: tbuffer_store_immoffs:
57 ; GFX11: ; %bb.0: ; %main_body
58 ; GFX11-NEXT: tbuffer_store_format_xyzw v[0:3], off, s[0:3], 0 format:117 offset:42
60 ; GFX11-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
61 ; GFX11-NEXT: s_endpgm
63 %in1 = bitcast <4 x float> %1 to <4 x i32>
64 call void @llvm.amdgcn.raw.tbuffer.store.v4i32(<4 x i32> %in1, <4 x i32> %0, i32 42, i32 0, i32 117, i32 0)
68 define amdgpu_ps void @tbuffer_store_scalar_and_imm_offs(<4 x i32> inreg, <4 x float> %vdata, i32 inreg %soffset) {
69 ; PREGFX10-LABEL: tbuffer_store_scalar_and_imm_offs:
70 ; PREGFX10: ; %bb.0: ; %main_body
71 ; PREGFX10-NEXT: tbuffer_store_format_xyzw v[0:3], off, s[0:3], s4 format:[BUF_DATA_FORMAT_16_16,BUF_NUM_FORMAT_FLOAT] offset:42
72 ; PREGFX10-NEXT: s_endpgm
74 ; GFX10-LABEL: tbuffer_store_scalar_and_imm_offs:
75 ; GFX10: ; %bb.0: ; %main_body
76 ; GFX10-NEXT: tbuffer_store_format_xyzw v[0:3], off, s[0:3], s4 format:117 offset:42
77 ; GFX10-NEXT: s_endpgm
79 ; GFX11-LABEL: tbuffer_store_scalar_and_imm_offs:
80 ; GFX11: ; %bb.0: ; %main_body
81 ; GFX11-NEXT: tbuffer_store_format_xyzw v[0:3], off, s[0:3], s4 format:117 offset:42
83 ; GFX11-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
84 ; GFX11-NEXT: s_endpgm
86 %in1 = bitcast <4 x float> %vdata to <4 x i32>
87 call void @llvm.amdgcn.raw.tbuffer.store.v4i32(<4 x i32> %in1, <4 x i32> %0, i32 42, i32 %soffset, i32 117, i32 0)
91 define amdgpu_ps void @buffer_store_ofs(<4 x i32> inreg, <4 x float> %vdata, i32 %voffset) {
92 ; PREGFX10-LABEL: buffer_store_ofs:
93 ; PREGFX10: ; %bb.0: ; %main_body
94 ; PREGFX10-NEXT: tbuffer_store_format_xyzw v[0:3], v4, s[0:3], 0 format:[BUF_DATA_FORMAT_8_8,BUF_NUM_FORMAT_FLOAT] offen
95 ; PREGFX10-NEXT: s_endpgm
97 ; GFX10-LABEL: buffer_store_ofs:
98 ; GFX10: ; %bb.0: ; %main_body
99 ; GFX10-NEXT: tbuffer_store_format_xyzw v[0:3], v4, s[0:3], 0 format:115 offen
100 ; GFX10-NEXT: s_endpgm
102 ; GFX11-LABEL: buffer_store_ofs:
103 ; GFX11: ; %bb.0: ; %main_body
104 ; GFX11-NEXT: tbuffer_store_format_xyzw v[0:3], v4, s[0:3], 0 format:115 offen
105 ; GFX11-NEXT: s_nop 0
106 ; GFX11-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
107 ; GFX11-NEXT: s_endpgm
109 %in1 = bitcast <4 x float> %vdata to <4 x i32>
110 call void @llvm.amdgcn.raw.tbuffer.store.v4i32(<4 x i32> %in1, <4 x i32> %0, i32 %voffset, i32 0, i32 115, i32 0)
114 define amdgpu_ps void @buffer_store_x1(<4 x i32> inreg %rsrc, float %data) {
115 ; PREGFX10-LABEL: buffer_store_x1:
116 ; PREGFX10: ; %bb.0: ; %main_body
117 ; PREGFX10-NEXT: tbuffer_store_format_x v0, off, s[0:3], 0 format:[BUF_DATA_FORMAT_32_32_32,BUF_NUM_FORMAT_FLOAT]
118 ; PREGFX10-NEXT: s_endpgm
120 ; GFX10-LABEL: buffer_store_x1:
121 ; GFX10: ; %bb.0: ; %main_body
122 ; GFX10-NEXT: tbuffer_store_format_x v0, off, s[0:3], 0 format:125
123 ; GFX10-NEXT: s_endpgm
125 ; GFX11-LABEL: buffer_store_x1:
126 ; GFX11: ; %bb.0: ; %main_body
127 ; GFX11-NEXT: tbuffer_store_format_x v0, off, s[0:3], 0 format:125
128 ; GFX11-NEXT: s_nop 0
129 ; GFX11-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
130 ; GFX11-NEXT: s_endpgm
132 %data.i = bitcast float %data to i32
133 call void @llvm.amdgcn.raw.tbuffer.store.i32(i32 %data.i, <4 x i32> %rsrc, i32 0, i32 0, i32 125, i32 0)
137 define amdgpu_ps void @buffer_store_x2(<4 x i32> inreg %rsrc, <2 x float> %data) {
138 ; PREGFX10-LABEL: buffer_store_x2:
139 ; PREGFX10: ; %bb.0: ; %main_body
140 ; PREGFX10-NEXT: tbuffer_store_format_xy v[0:1], off, s[0:3], 0 format:[BUF_NUM_FORMAT_USCALED]
141 ; PREGFX10-NEXT: s_endpgm
143 ; GFX10-LABEL: buffer_store_x2:
144 ; GFX10: ; %bb.0: ; %main_body
145 ; GFX10-NEXT: tbuffer_store_format_xy v[0:1], off, s[0:3], 0 format:[BUF_FMT_10_11_11_SSCALED]
146 ; GFX10-NEXT: s_endpgm
148 ; GFX11-LABEL: buffer_store_x2:
149 ; GFX11: ; %bb.0: ; %main_body
150 ; GFX11-NEXT: tbuffer_store_format_xy v[0:1], off, s[0:3], 0 format:[BUF_FMT_10_10_10_2_SNORM]
151 ; GFX11-NEXT: s_nop 0
152 ; GFX11-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
153 ; GFX11-NEXT: s_endpgm
155 %data.i = bitcast <2 x float> %data to <2 x i32>
156 call void @llvm.amdgcn.raw.tbuffer.store.v2i32(<2 x i32> %data.i, <4 x i32> %rsrc, i32 0, i32 0, i32 33, i32 0)
160 define amdgpu_ps void @buffer_store_voffset_large_12bit(<4 x i32> inreg %rsrc, <4 x float> %data) {
161 ; PREGFX10-LABEL: buffer_store_voffset_large_12bit:
162 ; PREGFX10: ; %bb.0: ; %main_body
163 ; PREGFX10-NEXT: tbuffer_store_format_xyzw v[0:3], off, s[0:3], 0 format:[BUF_DATA_FORMAT_RESERVED_15,BUF_NUM_FORMAT_SSCALED] offset:4092
164 ; PREGFX10-NEXT: s_endpgm
166 ; GFX10-LABEL: buffer_store_voffset_large_12bit:
167 ; GFX10: ; %bb.0: ; %main_body
168 ; GFX10-NEXT: tbuffer_store_format_xyzw v[0:3], off, s[0:3], 0 format:[BUF_FMT_32_32_SINT] offset:4092
169 ; GFX10-NEXT: s_endpgm
171 ; GFX11-LABEL: buffer_store_voffset_large_12bit:
172 ; GFX11: ; %bb.0: ; %main_body
173 ; GFX11-NEXT: tbuffer_store_format_xyzw v[0:3], off, s[0:3], 0 format:[BUF_FMT_32_32_32_32_FLOAT] offset:4092
174 ; GFX11-NEXT: s_nop 0
175 ; GFX11-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
176 ; GFX11-NEXT: s_endpgm
178 call void @llvm.amdgcn.raw.tbuffer.store.v4f32(<4 x float> %data, <4 x i32> %rsrc, i32 4092, i32 0, i32 63, i32 0)
182 define amdgpu_ps void @buffer_store_voffset_large_13bit(<4 x i32> inreg %rsrc, <4 x float> %data) {
183 ; PREGFX10-LABEL: buffer_store_voffset_large_13bit:
184 ; PREGFX10: ; %bb.0: ; %main_body
185 ; PREGFX10-NEXT: v_mov_b32_e32 v4, 0x1000
186 ; PREGFX10-NEXT: tbuffer_store_format_xyzw v[0:3], v4, s[0:3], 0 format:[BUF_DATA_FORMAT_RESERVED_15,BUF_NUM_FORMAT_SSCALED] offen offset:4092
187 ; PREGFX10-NEXT: s_endpgm
189 ; GFX10-LABEL: buffer_store_voffset_large_13bit:
190 ; GFX10: ; %bb.0: ; %main_body
191 ; GFX10-NEXT: v_mov_b32_e32 v4, 0x1000
192 ; GFX10-NEXT: tbuffer_store_format_xyzw v[0:3], v4, s[0:3], 0 format:[BUF_FMT_32_32_SINT] offen offset:4092
193 ; GFX10-NEXT: s_endpgm
195 ; GFX11-LABEL: buffer_store_voffset_large_13bit:
196 ; GFX11: ; %bb.0: ; %main_body
197 ; GFX11-NEXT: v_mov_b32_e32 v4, 0x1000
198 ; GFX11-NEXT: tbuffer_store_format_xyzw v[0:3], v4, s[0:3], 0 format:[BUF_FMT_32_32_32_32_FLOAT] offen offset:4092
199 ; GFX11-NEXT: s_nop 0
200 ; GFX11-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
201 ; GFX11-NEXT: s_endpgm
203 call void @llvm.amdgcn.raw.tbuffer.store.v4f32(<4 x float> %data, <4 x i32> %rsrc, i32 8188, i32 0, i32 63, i32 0)
207 define amdgpu_ps void @buffer_store_voffset_large_16bit(<4 x i32> inreg %rsrc, <4 x float> %data) {
208 ; PREGFX10-LABEL: buffer_store_voffset_large_16bit:
209 ; PREGFX10: ; %bb.0: ; %main_body
210 ; PREGFX10-NEXT: v_mov_b32_e32 v4, 0xf000
211 ; PREGFX10-NEXT: tbuffer_store_format_xyzw v[0:3], v4, s[0:3], 0 format:[BUF_DATA_FORMAT_RESERVED_15,BUF_NUM_FORMAT_SSCALED] offen offset:4092
212 ; PREGFX10-NEXT: s_endpgm
214 ; GFX10-LABEL: buffer_store_voffset_large_16bit:
215 ; GFX10: ; %bb.0: ; %main_body
216 ; GFX10-NEXT: v_mov_b32_e32 v4, 0xf000
217 ; GFX10-NEXT: tbuffer_store_format_xyzw v[0:3], v4, s[0:3], 0 format:[BUF_FMT_32_32_SINT] offen offset:4092
218 ; GFX10-NEXT: s_endpgm
220 ; GFX11-LABEL: buffer_store_voffset_large_16bit:
221 ; GFX11: ; %bb.0: ; %main_body
222 ; GFX11-NEXT: v_mov_b32_e32 v4, 0xf000
223 ; GFX11-NEXT: tbuffer_store_format_xyzw v[0:3], v4, s[0:3], 0 format:[BUF_FMT_32_32_32_32_FLOAT] offen offset:4092
224 ; GFX11-NEXT: s_nop 0
225 ; GFX11-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
226 ; GFX11-NEXT: s_endpgm
228 call void @llvm.amdgcn.raw.tbuffer.store.v4f32(<4 x float> %data, <4 x i32> %rsrc, i32 65532, i32 0, i32 63, i32 0)
232 define amdgpu_ps void @buffer_store_voffset_large_23bit(<4 x i32> inreg %rsrc, <4 x float> %data) {
233 ; PREGFX10-LABEL: buffer_store_voffset_large_23bit:
234 ; PREGFX10: ; %bb.0: ; %main_body
235 ; PREGFX10-NEXT: v_mov_b32_e32 v4, 0x7ff000
236 ; PREGFX10-NEXT: tbuffer_store_format_xyzw v[0:3], v4, s[0:3], 0 format:[BUF_DATA_FORMAT_RESERVED_15,BUF_NUM_FORMAT_SSCALED] offen offset:4092
237 ; PREGFX10-NEXT: s_endpgm
239 ; GFX10-LABEL: buffer_store_voffset_large_23bit:
240 ; GFX10: ; %bb.0: ; %main_body
241 ; GFX10-NEXT: v_mov_b32_e32 v4, 0x7ff000
242 ; GFX10-NEXT: tbuffer_store_format_xyzw v[0:3], v4, s[0:3], 0 format:[BUF_FMT_32_32_SINT] offen offset:4092
243 ; GFX10-NEXT: s_endpgm
245 ; GFX11-LABEL: buffer_store_voffset_large_23bit:
246 ; GFX11: ; %bb.0: ; %main_body
247 ; GFX11-NEXT: v_mov_b32_e32 v4, 0x7ff000
248 ; GFX11-NEXT: tbuffer_store_format_xyzw v[0:3], v4, s[0:3], 0 format:[BUF_FMT_32_32_32_32_FLOAT] offen offset:4092
249 ; GFX11-NEXT: s_nop 0
250 ; GFX11-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
251 ; GFX11-NEXT: s_endpgm
253 call void @llvm.amdgcn.raw.tbuffer.store.v4f32(<4 x float> %data, <4 x i32> %rsrc, i32 8388604, i32 0, i32 63, i32 0)
257 define amdgpu_ps void @buffer_store_voffset_large_24bit(<4 x i32> inreg %rsrc, <4 x float> %data) {
258 ; PREGFX10-LABEL: buffer_store_voffset_large_24bit:
259 ; PREGFX10: ; %bb.0: ; %main_body
260 ; PREGFX10-NEXT: v_mov_b32_e32 v4, 0xfff000
261 ; PREGFX10-NEXT: tbuffer_store_format_xyzw v[0:3], v4, s[0:3], 0 format:[BUF_DATA_FORMAT_RESERVED_15,BUF_NUM_FORMAT_SSCALED] offen offset:4092
262 ; PREGFX10-NEXT: s_endpgm
264 ; GFX10-LABEL: buffer_store_voffset_large_24bit:
265 ; GFX10: ; %bb.0: ; %main_body
266 ; GFX10-NEXT: v_mov_b32_e32 v4, 0xfff000
267 ; GFX10-NEXT: tbuffer_store_format_xyzw v[0:3], v4, s[0:3], 0 format:[BUF_FMT_32_32_SINT] offen offset:4092
268 ; GFX10-NEXT: s_endpgm
270 ; GFX11-LABEL: buffer_store_voffset_large_24bit:
271 ; GFX11: ; %bb.0: ; %main_body
272 ; GFX11-NEXT: v_mov_b32_e32 v4, 0xfff000
273 ; GFX11-NEXT: tbuffer_store_format_xyzw v[0:3], v4, s[0:3], 0 format:[BUF_FMT_32_32_32_32_FLOAT] offen offset:4092
274 ; GFX11-NEXT: s_nop 0
275 ; GFX11-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
276 ; GFX11-NEXT: s_endpgm
278 call void @llvm.amdgcn.raw.tbuffer.store.v4f32(<4 x float> %data, <4 x i32> %rsrc, i32 16777212, i32 0, i32 63, i32 0)
282 declare void @llvm.amdgcn.raw.tbuffer.store.i32(i32, <4 x i32>, i32, i32, i32, i32) #0
283 declare void @llvm.amdgcn.raw.tbuffer.store.v2i32(<2 x i32>, <4 x i32>, i32, i32, i32, i32) #0
284 declare void @llvm.amdgcn.raw.tbuffer.store.v4i32(<4 x i32>, <4 x i32>, i32, i32, i32, i32) #0
285 declare void @llvm.amdgcn.raw.tbuffer.store.v4f32(<4 x float>, <4 x i32>, i32, i32, i32, i32) #0
286 attributes #0 = { nounwind }
287 attributes #1 = { nounwind readonly }