1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc -march=amdgcn -mcpu=gfx900 -verify-machineinstrs < %s | FileCheck -check-prefixes=GFX9 %s
3; RUN: llc -march=amdgcn -mcpu=gfx1010 -verify-machineinstrs < %s | FileCheck -check-prefixes=GFX10 %s
4; RUN: llc -march=amdgcn -mcpu=gfx1100 -verify-machineinstrs < %s | FileCheck -check-prefixes=GFX10 %s
5
6define amdgpu_ps <4 x float> @load_1d(<8 x i32> inreg %rsrc, <2 x i16> %coords) {
7; GFX9-LABEL: load_1d:
8; GFX9:       ; %bb.0: ; %main_body
9; GFX9-NEXT:    image_load v[0:3], v0, s[0:7] dmask:0xf unorm a16
10; GFX9-NEXT:    s_waitcnt vmcnt(0)
11; GFX9-NEXT:    ; return to shader part epilog
12;
13; GFX10-LABEL: load_1d:
14; GFX10:       ; %bb.0: ; %main_body
15; GFX10-NEXT:    image_load v[0:3], v0, s[0:7] dmask:0xf dim:SQ_RSRC_IMG_1D unorm a16
16; GFX10-NEXT:    s_waitcnt vmcnt(0)
17; GFX10-NEXT:    ; return to shader part epilog
18main_body:
19  %s = extractelement <2 x i16> %coords, i32 0
20  %v = call <4 x float> @llvm.amdgcn.image.load.1d.v4f32.i16(i32 15, i16 %s, <8 x i32> %rsrc, i32 0, i32 0)
21  ret <4 x float> %v
22}
23
24define amdgpu_ps <4 x float> @load_2d(<8 x i32> inreg %rsrc, <2 x i16> %coords) {
25; GFX9-LABEL: load_2d:
26; GFX9:       ; %bb.0: ; %main_body
27; GFX9-NEXT:    image_load v[0:3], v0, s[0:7] dmask:0xf unorm a16
28; GFX9-NEXT:    s_waitcnt vmcnt(0)
29; GFX9-NEXT:    ; return to shader part epilog
30;
31; GFX10-LABEL: load_2d:
32; GFX10:       ; %bb.0: ; %main_body
33; GFX10-NEXT:    image_load v[0:3], v0, s[0:7] dmask:0xf dim:SQ_RSRC_IMG_2D unorm a16
34; GFX10-NEXT:    s_waitcnt vmcnt(0)
35; GFX10-NEXT:    ; return to shader part epilog
36main_body:
37  %s = extractelement <2 x i16> %coords, i32 0
38  %t = extractelement <2 x i16> %coords, i32 1
39  %v = call <4 x float> @llvm.amdgcn.image.load.2d.v4f32.i16(i32 15, i16 %s, i16 %t, <8 x i32> %rsrc, i32 0, i32 0)
40  ret <4 x float> %v
41}
42
43define amdgpu_ps <4 x float> @load_3d(<8 x i32> inreg %rsrc, <2 x i16> %coords_lo, <2 x i16> %coords_hi) {
44; GFX9-LABEL: load_3d:
45; GFX9:       ; %bb.0: ; %main_body
46; GFX9-NEXT:    image_load v[0:3], v[0:1], s[0:7] dmask:0xf unorm a16
47; GFX9-NEXT:    s_waitcnt vmcnt(0)
48; GFX9-NEXT:    ; return to shader part epilog
49;
50; GFX10-LABEL: load_3d:
51; GFX10:       ; %bb.0: ; %main_body
52; GFX10-NEXT:    image_load v[0:3], v[0:1], s[0:7] dmask:0xf dim:SQ_RSRC_IMG_3D unorm a16
53; GFX10-NEXT:    s_waitcnt vmcnt(0)
54; GFX10-NEXT:    ; return to shader part epilog
55main_body:
56  %s = extractelement <2 x i16> %coords_lo, i32 0
57  %t = extractelement <2 x i16> %coords_lo, i32 1
58  %r = extractelement <2 x i16> %coords_hi, i32 0
59  %v = call <4 x float> @llvm.amdgcn.image.load.3d.v4f32.i16(i32 15, i16 %s, i16 %t, i16 %r, <8 x i32> %rsrc, i32 0, i32 0)
60  ret <4 x float> %v
61}
62
63define amdgpu_ps <4 x float> @load_cube(<8 x i32> inreg %rsrc, <2 x i16> %coords_lo, <2 x i16> %coords_hi) {
64; GFX9-LABEL: load_cube:
65; GFX9:       ; %bb.0: ; %main_body
66; GFX9-NEXT:    image_load v[0:3], v[0:1], s[0:7] dmask:0xf unorm a16 da
67; GFX9-NEXT:    s_waitcnt vmcnt(0)
68; GFX9-NEXT:    ; return to shader part epilog
69;
70; GFX10-LABEL: load_cube:
71; GFX10:       ; %bb.0: ; %main_body
72; GFX10-NEXT:    image_load v[0:3], v[0:1], s[0:7] dmask:0xf dim:SQ_RSRC_IMG_CUBE unorm a16
73; GFX10-NEXT:    s_waitcnt vmcnt(0)
74; GFX10-NEXT:    ; return to shader part epilog
75main_body:
76  %s = extractelement <2 x i16> %coords_lo, i32 0
77  %t = extractelement <2 x i16> %coords_lo, i32 1
78  %slice = extractelement <2 x i16> %coords_hi, i32 0
79  %v = call <4 x float> @llvm.amdgcn.image.load.cube.v4f32.i16(i32 15, i16 %s, i16 %t, i16 %slice, <8 x i32> %rsrc, i32 0, i32 0)
80  ret <4 x float> %v
81}
82
83define amdgpu_ps <4 x float> @load_1darray(<8 x i32> inreg %rsrc, <2 x i16> %coords) {
84; GFX9-LABEL: load_1darray:
85; GFX9:       ; %bb.0: ; %main_body
86; GFX9-NEXT:    image_load v[0:3], v0, s[0:7] dmask:0xf unorm a16 da
87; GFX9-NEXT:    s_waitcnt vmcnt(0)
88; GFX9-NEXT:    ; return to shader part epilog
89;
90; GFX10-LABEL: load_1darray:
91; GFX10:       ; %bb.0: ; %main_body
92; GFX10-NEXT:    image_load v[0:3], v0, s[0:7] dmask:0xf dim:SQ_RSRC_IMG_1D_ARRAY unorm a16
93; GFX10-NEXT:    s_waitcnt vmcnt(0)
94; GFX10-NEXT:    ; return to shader part epilog
95main_body:
96  %s = extractelement <2 x i16> %coords, i32 0
97  %slice = extractelement <2 x i16> %coords, i32 1
98  %v = call <4 x float> @llvm.amdgcn.image.load.1darray.v4f32.i16(i32 15, i16 %s, i16 %slice, <8 x i32> %rsrc, i32 0, i32 0)
99  ret <4 x float> %v
100}
101
102define amdgpu_ps <4 x float> @load_2darray(<8 x i32> inreg %rsrc, <2 x i16> %coords_lo, <2 x i16> %coords_hi) {
103; GFX9-LABEL: load_2darray:
104; GFX9:       ; %bb.0: ; %main_body
105; GFX9-NEXT:    image_load v[0:3], v[0:1], s[0:7] dmask:0xf unorm a16 da
106; GFX9-NEXT:    s_waitcnt vmcnt(0)
107; GFX9-NEXT:    ; return to shader part epilog
108;
109; GFX10-LABEL: load_2darray:
110; GFX10:       ; %bb.0: ; %main_body
111; GFX10-NEXT:    image_load v[0:3], v[0:1], s[0:7] dmask:0xf dim:SQ_RSRC_IMG_2D_ARRAY unorm a16
112; GFX10-NEXT:    s_waitcnt vmcnt(0)
113; GFX10-NEXT:    ; return to shader part epilog
114main_body:
115  %s = extractelement <2 x i16> %coords_lo, i32 0
116  %t = extractelement <2 x i16> %coords_lo, i32 1
117  %slice = extractelement <2 x i16> %coords_hi, i32 0
118  %v = call <4 x float> @llvm.amdgcn.image.load.2darray.v4f32.i16(i32 15, i16 %s, i16 %t, i16 %slice, <8 x i32> %rsrc, i32 0, i32 0)
119  ret <4 x float> %v
120}
121
122define amdgpu_ps <4 x float> @load_2dmsaa(<8 x i32> inreg %rsrc, <2 x i16> %coords_lo, <2 x i16> %coords_hi) {
123; GFX9-LABEL: load_2dmsaa:
124; GFX9:       ; %bb.0: ; %main_body
125; GFX9-NEXT:    image_load v[0:3], v[0:1], s[0:7] dmask:0xf unorm a16
126; GFX9-NEXT:    s_waitcnt vmcnt(0)
127; GFX9-NEXT:    ; return to shader part epilog
128;
129; GFX10-LABEL: load_2dmsaa:
130; GFX10:       ; %bb.0: ; %main_body
131; GFX10-NEXT:    image_load v[0:3], v[0:1], s[0:7] dmask:0xf dim:SQ_RSRC_IMG_2D_MSAA unorm a16
132; GFX10-NEXT:    s_waitcnt vmcnt(0)
133; GFX10-NEXT:    ; return to shader part epilog
134main_body:
135  %s = extractelement <2 x i16> %coords_lo, i32 0
136  %t = extractelement <2 x i16> %coords_lo, i32 1
137  %fragid = extractelement <2 x i16> %coords_hi, i32 0
138  %v = call <4 x float> @llvm.amdgcn.image.load.2dmsaa.v4f32.i16(i32 15, i16 %s, i16 %t, i16 %fragid, <8 x i32> %rsrc, i32 0, i32 0)
139  ret <4 x float> %v
140}
141
142define amdgpu_ps <4 x float> @load_2darraymsaa(<8 x i32> inreg %rsrc, <2 x i16> %coords_lo, <2 x i16> %coords_hi) {
143; GFX9-LABEL: load_2darraymsaa:
144; GFX9:       ; %bb.0: ; %main_body
145; GFX9-NEXT:    image_load v[0:3], v[0:1], s[0:7] dmask:0xf unorm a16 da
146; GFX9-NEXT:    s_waitcnt vmcnt(0)
147; GFX9-NEXT:    ; return to shader part epilog
148;
149; GFX10-LABEL: load_2darraymsaa:
150; GFX10:       ; %bb.0: ; %main_body
151; GFX10-NEXT:    image_load v[0:3], v[0:1], s[0:7] dmask:0xf dim:SQ_RSRC_IMG_2D_MSAA_ARRAY unorm a16
152; GFX10-NEXT:    s_waitcnt vmcnt(0)
153; GFX10-NEXT:    ; return to shader part epilog
154main_body:
155  %s = extractelement <2 x i16> %coords_lo, i32 0
156  %t = extractelement <2 x i16> %coords_lo, i32 1
157  %slice = extractelement <2 x i16> %coords_hi, i32 0
158  %fragid = extractelement <2 x i16> %coords_hi, i32 1
159  %v = call <4 x float> @llvm.amdgcn.image.load.2darraymsaa.v4f32.i16(i32 15, i16 %s, i16 %t, i16 %slice, i16 %fragid, <8 x i32> %rsrc, i32 0, i32 0)
160  ret <4 x float> %v
161}
162
163define amdgpu_ps <4 x float> @load_mip_1d(<8 x i32> inreg %rsrc, <2 x i16> %coords) {
164; GFX9-LABEL: load_mip_1d:
165; GFX9:       ; %bb.0: ; %main_body
166; GFX9-NEXT:    image_load_mip v[0:3], v0, s[0:7] dmask:0xf unorm a16
167; GFX9-NEXT:    s_waitcnt vmcnt(0)
168; GFX9-NEXT:    ; return to shader part epilog
169;
170; GFX10-LABEL: load_mip_1d:
171; GFX10:       ; %bb.0: ; %main_body
172; GFX10-NEXT:    image_load_mip v[0:3], v0, s[0:7] dmask:0xf dim:SQ_RSRC_IMG_1D unorm a16
173; GFX10-NEXT:    s_waitcnt vmcnt(0)
174; GFX10-NEXT:    ; return to shader part epilog
175main_body:
176  %s = extractelement <2 x i16> %coords, i32 0
177  %mip = extractelement <2 x i16> %coords, i32 1
178  %v = call <4 x float> @llvm.amdgcn.image.load.mip.1d.v4f32.i16(i32 15, i16 %s, i16 %mip, <8 x i32> %rsrc, i32 0, i32 0)
179  ret <4 x float> %v
180}
181
182define amdgpu_ps <4 x float> @load_mip_2d(<8 x i32> inreg %rsrc, <2 x i16> %coords_lo, <2 x i16> %coords_hi) {
183; GFX9-LABEL: load_mip_2d:
184; GFX9:       ; %bb.0: ; %main_body
185; GFX9-NEXT:    image_load_mip v[0:3], v[0:1], s[0:7] dmask:0xf unorm a16
186; GFX9-NEXT:    s_waitcnt vmcnt(0)
187; GFX9-NEXT:    ; return to shader part epilog
188;
189; GFX10-LABEL: load_mip_2d:
190; GFX10:       ; %bb.0: ; %main_body
191; GFX10-NEXT:    image_load_mip v[0:3], v[0:1], s[0:7] dmask:0xf dim:SQ_RSRC_IMG_2D unorm a16
192; GFX10-NEXT:    s_waitcnt vmcnt(0)
193; GFX10-NEXT:    ; return to shader part epilog
194main_body:
195  %s = extractelement <2 x i16> %coords_lo, i32 0
196  %t = extractelement <2 x i16> %coords_lo, i32 1
197  %mip = extractelement <2 x i16> %coords_hi, i32 0
198  %v = call <4 x float> @llvm.amdgcn.image.load.mip.2d.v4f32.i16(i32 15, i16 %s, i16 %t, i16 %mip, <8 x i32> %rsrc, i32 0, i32 0)
199  ret <4 x float> %v
200}
201
202define amdgpu_ps <4 x float> @load_mip_3d(<8 x i32> inreg %rsrc, <2 x i16> %coords_lo, <2 x i16> %coords_hi) {
203; GFX9-LABEL: load_mip_3d:
204; GFX9:       ; %bb.0: ; %main_body
205; GFX9-NEXT:    image_load_mip v[0:3], v[0:1], s[0:7] dmask:0xf unorm a16
206; GFX9-NEXT:    s_waitcnt vmcnt(0)
207; GFX9-NEXT:    ; return to shader part epilog
208;
209; GFX10-LABEL: load_mip_3d:
210; GFX10:       ; %bb.0: ; %main_body
211; GFX10-NEXT:    image_load_mip v[0:3], v[0:1], s[0:7] dmask:0xf dim:SQ_RSRC_IMG_3D unorm a16
212; GFX10-NEXT:    s_waitcnt vmcnt(0)
213; GFX10-NEXT:    ; return to shader part epilog
214main_body:
215  %s = extractelement <2 x i16> %coords_lo, i32 0
216  %t = extractelement <2 x i16> %coords_lo, i32 1
217  %r = extractelement <2 x i16> %coords_hi, i32 0
218  %mip = extractelement <2 x i16> %coords_hi, i32 1
219  %v = call <4 x float> @llvm.amdgcn.image.load.mip.3d.v4f32.i16(i32 15, i16 %s, i16 %t, i16 %r, i16 %mip, <8 x i32> %rsrc, i32 0, i32 0)
220  ret <4 x float> %v
221}
222
223define amdgpu_ps <4 x float> @load_mip_cube(<8 x i32> inreg %rsrc, <2 x i16> %coords_lo, <2 x i16> %coords_hi) {
224; GFX9-LABEL: load_mip_cube:
225; GFX9:       ; %bb.0: ; %main_body
226; GFX9-NEXT:    image_load_mip v[0:3], v[0:1], s[0:7] dmask:0xf unorm a16 da
227; GFX9-NEXT:    s_waitcnt vmcnt(0)
228; GFX9-NEXT:    ; return to shader part epilog
229;
230; GFX10-LABEL: load_mip_cube:
231; GFX10:       ; %bb.0: ; %main_body
232; GFX10-NEXT:    image_load_mip v[0:3], v[0:1], s[0:7] dmask:0xf dim:SQ_RSRC_IMG_CUBE unorm a16
233; GFX10-NEXT:    s_waitcnt vmcnt(0)
234; GFX10-NEXT:    ; return to shader part epilog
235main_body:
236  %s = extractelement <2 x i16> %coords_lo, i32 0
237  %t = extractelement <2 x i16> %coords_lo, i32 1
238  %slice = extractelement <2 x i16> %coords_hi, i32 0
239  %mip = extractelement <2 x i16> %coords_hi, i32 1
240  %v = call <4 x float> @llvm.amdgcn.image.load.mip.cube.v4f32.i16(i32 15, i16 %s, i16 %t, i16 %slice, i16 %mip, <8 x i32> %rsrc, i32 0, i32 0)
241  ret <4 x float> %v
242}
243
244define amdgpu_ps <4 x float> @load_mip_1darray(<8 x i32> inreg %rsrc, <2 x i16> %coords_lo, <2 x i16> %coords_hi) {
245; GFX9-LABEL: load_mip_1darray:
246; GFX9:       ; %bb.0: ; %main_body
247; GFX9-NEXT:    image_load_mip v[0:3], v[0:1], s[0:7] dmask:0xf unorm a16 da
248; GFX9-NEXT:    s_waitcnt vmcnt(0)
249; GFX9-NEXT:    ; return to shader part epilog
250;
251; GFX10-LABEL: load_mip_1darray:
252; GFX10:       ; %bb.0: ; %main_body
253; GFX10-NEXT:    image_load_mip v[0:3], v[0:1], s[0:7] dmask:0xf dim:SQ_RSRC_IMG_1D_ARRAY unorm a16
254; GFX10-NEXT:    s_waitcnt vmcnt(0)
255; GFX10-NEXT:    ; return to shader part epilog
256main_body:
257  %s = extractelement <2 x i16> %coords_lo, i32 0
258  %slice = extractelement <2 x i16> %coords_lo, i32 1
259  %mip = extractelement <2 x i16> %coords_hi, i32 0
260  %v = call <4 x float> @llvm.amdgcn.image.load.mip.1darray.v4f32.i16(i32 15, i16 %s, i16 %slice, i16 %mip, <8 x i32> %rsrc, i32 0, i32 0)
261  ret <4 x float> %v
262}
263
264define amdgpu_ps <4 x float> @load_mip_2darray(<8 x i32> inreg %rsrc, <2 x i16> %coords_lo, <2 x i16> %coords_hi) {
265; GFX9-LABEL: load_mip_2darray:
266; GFX9:       ; %bb.0: ; %main_body
267; GFX9-NEXT:    image_load_mip v[0:3], v[0:1], s[0:7] dmask:0xf unorm a16 da
268; GFX9-NEXT:    s_waitcnt vmcnt(0)
269; GFX9-NEXT:    ; return to shader part epilog
270;
271; GFX10-LABEL: load_mip_2darray:
272; GFX10:       ; %bb.0: ; %main_body
273; GFX10-NEXT:    image_load_mip v[0:3], v[0:1], s[0:7] dmask:0xf dim:SQ_RSRC_IMG_2D_ARRAY unorm a16
274; GFX10-NEXT:    s_waitcnt vmcnt(0)
275; GFX10-NEXT:    ; return to shader part epilog
276main_body:
277  %s = extractelement <2 x i16> %coords_lo, i32 0
278  %t = extractelement <2 x i16> %coords_lo, i32 1
279  %slice = extractelement <2 x i16> %coords_hi, i32 0
280  %mip = extractelement <2 x i16> %coords_hi, i32 1
281  %v = call <4 x float> @llvm.amdgcn.image.load.mip.2darray.v4f32.i16(i32 15, i16 %s, i16 %t, i16 %slice, i16 %mip, <8 x i32> %rsrc, i32 0, i32 0)
282  ret <4 x float> %v
283}
284
285define amdgpu_ps void @store_1d(<8 x i32> inreg %rsrc, <4 x float> %vdata, <2 x i16> %coords) {
286; GFX9-LABEL: store_1d:
287; GFX9:       ; %bb.0: ; %main_body
288; GFX9-NEXT:    image_store v[0:3], v4, s[0:7] dmask:0xf unorm a16
289; GFX9-NEXT:    s_endpgm
290;
291; GFX10-LABEL: store_1d:
292; GFX10:       ; %bb.0: ; %main_body
293; GFX10-NEXT:    image_store v[0:3], v4, s[0:7] dmask:0xf dim:SQ_RSRC_IMG_1D unorm a16
294; GFX10-NEXT:    s_endpgm
295main_body:
296  %s = extractelement <2 x i16> %coords, i32 0
297  call void @llvm.amdgcn.image.store.1d.v4f32.i16(<4 x float> %vdata, i32 15, i16 %s, <8 x i32> %rsrc, i32 0, i32 0)
298  ret void
299}
300
301define amdgpu_ps void @store_2d(<8 x i32> inreg %rsrc, <4 x float> %vdata, <2 x i16> %coords) {
302; GFX9-LABEL: store_2d:
303; GFX9:       ; %bb.0: ; %main_body
304; GFX9-NEXT:    image_store v[0:3], v4, s[0:7] dmask:0xf unorm a16
305; GFX9-NEXT:    s_endpgm
306;
307; GFX10-LABEL: store_2d:
308; GFX10:       ; %bb.0: ; %main_body
309; GFX10-NEXT:    image_store v[0:3], v4, s[0:7] dmask:0xf dim:SQ_RSRC_IMG_2D unorm a16
310; GFX10-NEXT:    s_endpgm
311main_body:
312  %s = extractelement <2 x i16> %coords, i32 0
313  %t = extractelement <2 x i16> %coords, i32 1
314  call void @llvm.amdgcn.image.store.2d.v4f32.i16(<4 x float> %vdata, i32 15, i16 %s, i16 %t, <8 x i32> %rsrc, i32 0, i32 0)
315  ret void
316}
317
318define amdgpu_ps void @store_3d(<8 x i32> inreg %rsrc, <4 x float> %vdata, <2 x i16> %coords_lo, <2 x i16> %coords_hi) {
319; GFX9-LABEL: store_3d:
320; GFX9:       ; %bb.0: ; %main_body
321; GFX9-NEXT:    image_store v[0:3], v[4:5], s[0:7] dmask:0xf unorm a16
322; GFX9-NEXT:    s_endpgm
323;
324; GFX10-LABEL: store_3d:
325; GFX10:       ; %bb.0: ; %main_body
326; GFX10-NEXT:    image_store v[0:3], v[4:5], s[0:7] dmask:0xf dim:SQ_RSRC_IMG_3D unorm a16
327; GFX10-NEXT:    s_endpgm
328main_body:
329  %s = extractelement <2 x i16> %coords_lo, i32 0
330  %t = extractelement <2 x i16> %coords_lo, i32 1
331  %r = extractelement <2 x i16> %coords_hi, i32 0
332  call void @llvm.amdgcn.image.store.3d.v4f32.i16(<4 x float> %vdata, i32 15, i16 %s, i16 %t, i16 %r, <8 x i32> %rsrc, i32 0, i32 0)
333  ret void
334}
335
336define amdgpu_ps void @store_cube(<8 x i32> inreg %rsrc, <4 x float> %vdata, <2 x i16> %coords_lo, <2 x i16> %coords_hi) {
337; GFX9-LABEL: store_cube:
338; GFX9:       ; %bb.0: ; %main_body
339; GFX9-NEXT:    image_store v[0:3], v[4:5], s[0:7] dmask:0xf unorm a16 da
340; GFX9-NEXT:    s_endpgm
341;
342; GFX10-LABEL: store_cube:
343; GFX10:       ; %bb.0: ; %main_body
344; GFX10-NEXT:    image_store v[0:3], v[4:5], s[0:7] dmask:0xf dim:SQ_RSRC_IMG_CUBE unorm a16
345; GFX10-NEXT:    s_endpgm
346main_body:
347  %s = extractelement <2 x i16> %coords_lo, i32 0
348  %t = extractelement <2 x i16> %coords_lo, i32 1
349  %slice = extractelement <2 x i16> %coords_hi, i32 0
350  call void @llvm.amdgcn.image.store.cube.v4f32.i16(<4 x float> %vdata, i32 15, i16 %s, i16 %t, i16 %slice, <8 x i32> %rsrc, i32 0, i32 0)
351  ret void
352}
353
354define amdgpu_ps void @store_1darray(<8 x i32> inreg %rsrc, <4 x float> %vdata, <2 x i16> %coords) {
355; GFX9-LABEL: store_1darray:
356; GFX9:       ; %bb.0: ; %main_body
357; GFX9-NEXT:    image_store v[0:3], v4, s[0:7] dmask:0xf unorm a16 da
358; GFX9-NEXT:    s_endpgm
359;
360; GFX10-LABEL: store_1darray:
361; GFX10:       ; %bb.0: ; %main_body
362; GFX10-NEXT:    image_store v[0:3], v4, s[0:7] dmask:0xf dim:SQ_RSRC_IMG_1D_ARRAY unorm a16
363; GFX10-NEXT:    s_endpgm
364main_body:
365  %s = extractelement <2 x i16> %coords, i32 0
366  %slice = extractelement <2 x i16> %coords, i32 1
367  call void @llvm.amdgcn.image.store.1darray.v4f32.i16(<4 x float> %vdata, i32 15, i16 %s, i16 %slice, <8 x i32> %rsrc, i32 0, i32 0)
368  ret void
369}
370
371define amdgpu_ps void @store_2darray(<8 x i32> inreg %rsrc, <4 x float> %vdata, <2 x i16> %coords_lo, <2 x i16> %coords_hi) {
372; GFX9-LABEL: store_2darray:
373; GFX9:       ; %bb.0: ; %main_body
374; GFX9-NEXT:    image_store v[0:3], v[4:5], s[0:7] dmask:0xf unorm a16 da
375; GFX9-NEXT:    s_endpgm
376;
377; GFX10-LABEL: store_2darray:
378; GFX10:       ; %bb.0: ; %main_body
379; GFX10-NEXT:    image_store v[0:3], v[4:5], s[0:7] dmask:0xf dim:SQ_RSRC_IMG_2D_ARRAY unorm a16
380; GFX10-NEXT:    s_endpgm
381main_body:
382  %s = extractelement <2 x i16> %coords_lo, i32 0
383  %t = extractelement <2 x i16> %coords_lo, i32 1
384  %slice = extractelement <2 x i16> %coords_hi, i32 0
385  call void @llvm.amdgcn.image.store.2darray.v4f32.i16(<4 x float> %vdata, i32 15, i16 %s, i16 %t, i16 %slice, <8 x i32> %rsrc, i32 0, i32 0)
386  ret void
387}
388
389define amdgpu_ps void @store_2dmsaa(<8 x i32> inreg %rsrc, <4 x float> %vdata, <2 x i16> %coords_lo, <2 x i16> %coords_hi) {
390; GFX9-LABEL: store_2dmsaa:
391; GFX9:       ; %bb.0: ; %main_body
392; GFX9-NEXT:    image_store v[0:3], v[4:5], s[0:7] dmask:0xf unorm a16
393; GFX9-NEXT:    s_endpgm
394;
395; GFX10-LABEL: store_2dmsaa:
396; GFX10:       ; %bb.0: ; %main_body
397; GFX10-NEXT:    image_store v[0:3], v[4:5], s[0:7] dmask:0xf dim:SQ_RSRC_IMG_2D_MSAA unorm a16
398; GFX10-NEXT:    s_endpgm
399main_body:
400  %s = extractelement <2 x i16> %coords_lo, i32 0
401  %t = extractelement <2 x i16> %coords_lo, i32 1
402  %fragid = extractelement <2 x i16> %coords_hi, i32 0
403  call void @llvm.amdgcn.image.store.2dmsaa.v4f32.i16(<4 x float> %vdata, i32 15, i16 %s, i16 %t, i16 %fragid, <8 x i32> %rsrc, i32 0, i32 0)
404  ret void
405}
406
407define amdgpu_ps void @store_2darraymsaa(<8 x i32> inreg %rsrc, <4 x float> %vdata, <2 x i16> %coords_lo, <2 x i16> %coords_hi) {
408; GFX9-LABEL: store_2darraymsaa:
409; GFX9:       ; %bb.0: ; %main_body
410; GFX9-NEXT:    image_store v[0:3], v[4:5], s[0:7] dmask:0xf unorm a16 da
411; GFX9-NEXT:    s_endpgm
412;
413; GFX10-LABEL: store_2darraymsaa:
414; GFX10:       ; %bb.0: ; %main_body
415; GFX10-NEXT:    image_store v[0:3], v[4:5], s[0:7] dmask:0xf dim:SQ_RSRC_IMG_2D_MSAA_ARRAY unorm a16
416; GFX10-NEXT:    s_endpgm
417main_body:
418  %s = extractelement <2 x i16> %coords_lo, i32 0
419  %t = extractelement <2 x i16> %coords_lo, i32 1
420  %slice = extractelement <2 x i16> %coords_hi, i32 0
421  %fragid = extractelement <2 x i16> %coords_hi, i32 1
422  call void @llvm.amdgcn.image.store.2darraymsaa.v4f32.i16(<4 x float> %vdata, i32 15, i16 %s, i16 %t, i16 %slice, i16 %fragid, <8 x i32> %rsrc, i32 0, i32 0)
423  ret void
424}
425
426define amdgpu_ps void @store_mip_1d(<8 x i32> inreg %rsrc, <4 x float> %vdata, <2 x i16> %coords) {
427; GFX9-LABEL: store_mip_1d:
428; GFX9:       ; %bb.0: ; %main_body
429; GFX9-NEXT:    image_store_mip v[0:3], v4, s[0:7] dmask:0xf unorm a16
430; GFX9-NEXT:    s_endpgm
431;
432; GFX10-LABEL: store_mip_1d:
433; GFX10:       ; %bb.0: ; %main_body
434; GFX10-NEXT:    image_store_mip v[0:3], v4, s[0:7] dmask:0xf dim:SQ_RSRC_IMG_1D unorm a16
435; GFX10-NEXT:    s_endpgm
436main_body:
437  %s = extractelement <2 x i16> %coords, i32 0
438  %mip = extractelement <2 x i16> %coords, i32 1
439  call void @llvm.amdgcn.image.store.mip.1d.v4f32.i16(<4 x float> %vdata, i32 15, i16 %s, i16 %mip, <8 x i32> %rsrc, i32 0, i32 0)
440  ret void
441}
442
443define amdgpu_ps void @store_mip_2d(<8 x i32> inreg %rsrc, <4 x float> %vdata, <2 x i16> %coords_lo, <2 x i16> %coords_hi) {
444; GFX9-LABEL: store_mip_2d:
445; GFX9:       ; %bb.0: ; %main_body
446; GFX9-NEXT:    image_store_mip v[0:3], v[4:5], s[0:7] dmask:0xf unorm a16
447; GFX9-NEXT:    s_endpgm
448;
449; GFX10-LABEL: store_mip_2d:
450; GFX10:       ; %bb.0: ; %main_body
451; GFX10-NEXT:    image_store_mip v[0:3], v[4:5], s[0:7] dmask:0xf dim:SQ_RSRC_IMG_2D unorm a16
452; GFX10-NEXT:    s_endpgm
453main_body:
454  %s = extractelement <2 x i16> %coords_lo, i32 0
455  %t = extractelement <2 x i16> %coords_lo, i32 1
456  %mip = extractelement <2 x i16> %coords_hi, i32 0
457  call void @llvm.amdgcn.image.store.mip.2d.v4f32.i16(<4 x float> %vdata, i32 15, i16 %s, i16 %t, i16 %mip, <8 x i32> %rsrc, i32 0, i32 0)
458  ret void
459}
460
461define amdgpu_ps void @store_mip_3d(<8 x i32> inreg %rsrc, <4 x float> %vdata, <2 x i16> %coords_lo, <2 x i16> %coords_hi) {
462; GFX9-LABEL: store_mip_3d:
463; GFX9:       ; %bb.0: ; %main_body
464; GFX9-NEXT:    image_store_mip v[0:3], v[4:5], s[0:7] dmask:0xf unorm a16
465; GFX9-NEXT:    s_endpgm
466;
467; GFX10-LABEL: store_mip_3d:
468; GFX10:       ; %bb.0: ; %main_body
469; GFX10-NEXT:    image_store_mip v[0:3], v[4:5], s[0:7] dmask:0xf dim:SQ_RSRC_IMG_3D unorm a16
470; GFX10-NEXT:    s_endpgm
471main_body:
472  %s = extractelement <2 x i16> %coords_lo, i32 0
473  %t = extractelement <2 x i16> %coords_lo, i32 1
474  %r = extractelement <2 x i16> %coords_hi, i32 0
475  %mip = extractelement <2 x i16> %coords_hi, i32 1
476  call void @llvm.amdgcn.image.store.mip.3d.v4f32.i16(<4 x float> %vdata, i32 15, i16 %s, i16 %t, i16 %r, i16 %mip, <8 x i32> %rsrc, i32 0, i32 0)
477  ret void
478}
479
480define amdgpu_ps void @store_mip_cube(<8 x i32> inreg %rsrc, <4 x float> %vdata, <2 x i16> %coords_lo, <2 x i16> %coords_hi) {
481; GFX9-LABEL: store_mip_cube:
482; GFX9:       ; %bb.0: ; %main_body
483; GFX9-NEXT:    image_store_mip v[0:3], v[4:5], s[0:7] dmask:0xf unorm a16 da
484; GFX9-NEXT:    s_endpgm
485;
486; GFX10-LABEL: store_mip_cube:
487; GFX10:       ; %bb.0: ; %main_body
488; GFX10-NEXT:    image_store_mip v[0:3], v[4:5], s[0:7] dmask:0xf dim:SQ_RSRC_IMG_CUBE unorm a16
489; GFX10-NEXT:    s_endpgm
490main_body:
491  %s = extractelement <2 x i16> %coords_lo, i32 0
492  %t = extractelement <2 x i16> %coords_lo, i32 1
493  %slice = extractelement <2 x i16> %coords_hi, i32 0
494  %mip = extractelement <2 x i16> %coords_hi, i32 1
495  call void @llvm.amdgcn.image.store.mip.cube.v4f32.i16(<4 x float> %vdata, i32 15, i16 %s, i16 %t, i16 %slice, i16 %mip, <8 x i32> %rsrc, i32 0, i32 0)
496  ret void
497}
498
499define amdgpu_ps void @store_mip_1darray(<8 x i32> inreg %rsrc, <4 x float> %vdata, <2 x i16> %coords_lo, <2 x i16> %coords_hi) {
500; GFX9-LABEL: store_mip_1darray:
501; GFX9:       ; %bb.0: ; %main_body
502; GFX9-NEXT:    image_store_mip v[0:3], v[4:5], s[0:7] dmask:0xf unorm a16 da
503; GFX9-NEXT:    s_endpgm
504;
505; GFX10-LABEL: store_mip_1darray:
506; GFX10:       ; %bb.0: ; %main_body
507; GFX10-NEXT:    image_store_mip v[0:3], v[4:5], s[0:7] dmask:0xf dim:SQ_RSRC_IMG_1D_ARRAY unorm a16
508; GFX10-NEXT:    s_endpgm
509main_body:
510  %s = extractelement <2 x i16> %coords_lo, i32 0
511  %slice = extractelement <2 x i16> %coords_lo, i32 1
512  %mip = extractelement <2 x i16> %coords_hi, i32 0
513  call void @llvm.amdgcn.image.store.mip.1darray.v4f32.i16(<4 x float> %vdata, i32 15, i16 %s, i16 %slice, i16 %mip, <8 x i32> %rsrc, i32 0, i32 0)
514  ret void
515}
516
517define amdgpu_ps void @store_mip_2darray(<8 x i32> inreg %rsrc, <4 x float> %vdata, <2 x i16> %coords_lo, <2 x i16> %coords_hi) {
518; GFX9-LABEL: store_mip_2darray:
519; GFX9:       ; %bb.0: ; %main_body
520; GFX9-NEXT:    image_store_mip v[0:3], v[4:5], s[0:7] dmask:0xf unorm a16 da
521; GFX9-NEXT:    s_endpgm
522;
523; GFX10-LABEL: store_mip_2darray:
524; GFX10:       ; %bb.0: ; %main_body
525; GFX10-NEXT:    image_store_mip v[0:3], v[4:5], s[0:7] dmask:0xf dim:SQ_RSRC_IMG_2D_ARRAY unorm a16
526; GFX10-NEXT:    s_endpgm
527main_body:
528  %s = extractelement <2 x i16> %coords_lo, i32 0
529  %t = extractelement <2 x i16> %coords_lo, i32 1
530  %slice = extractelement <2 x i16> %coords_hi, i32 0
531  %mip = extractelement <2 x i16> %coords_hi, i32 1
532  call void @llvm.amdgcn.image.store.mip.2darray.v4f32.i16(<4 x float> %vdata, i32 15, i16 %s, i16 %t, i16 %slice, i16 %mip, <8 x i32> %rsrc, i32 0, i32 0)
533  ret void
534}
535
536define amdgpu_ps <4 x float> @getresinfo_1d(<8 x i32> inreg %rsrc, <2 x i16> %coords) {
537; GFX9-LABEL: getresinfo_1d:
538; GFX9:       ; %bb.0: ; %main_body
539; GFX9-NEXT:    image_get_resinfo v[0:3], v0, s[0:7] dmask:0xf unorm a16
540; GFX9-NEXT:    s_waitcnt vmcnt(0)
541; GFX9-NEXT:    ; return to shader part epilog
542;
543; GFX10-LABEL: getresinfo_1d:
544; GFX10:       ; %bb.0: ; %main_body
545; GFX10-NEXT:    image_get_resinfo v[0:3], v0, s[0:7] dmask:0xf dim:SQ_RSRC_IMG_1D unorm a16
546; GFX10-NEXT:    s_waitcnt vmcnt(0)
547; GFX10-NEXT:    ; return to shader part epilog
548main_body:
549  %mip = extractelement <2 x i16> %coords, i32 0
550  %v = call <4 x float> @llvm.amdgcn.image.getresinfo.1d.v4f32.i16(i32 15, i16 %mip, <8 x i32> %rsrc, i32 0, i32 0)
551  ret <4 x float> %v
552}
553
554define amdgpu_ps <4 x float> @getresinfo_2d(<8 x i32> inreg %rsrc, <2 x i16> %coords) {
555; GFX9-LABEL: getresinfo_2d:
556; GFX9:       ; %bb.0: ; %main_body
557; GFX9-NEXT:    image_get_resinfo v[0:3], v0, s[0:7] dmask:0xf unorm a16
558; GFX9-NEXT:    s_waitcnt vmcnt(0)
559; GFX9-NEXT:    ; return to shader part epilog
560;
561; GFX10-LABEL: getresinfo_2d:
562; GFX10:       ; %bb.0: ; %main_body
563; GFX10-NEXT:    image_get_resinfo v[0:3], v0, s[0:7] dmask:0xf dim:SQ_RSRC_IMG_2D unorm a16
564; GFX10-NEXT:    s_waitcnt vmcnt(0)
565; GFX10-NEXT:    ; return to shader part epilog
566main_body:
567  %mip = extractelement <2 x i16> %coords, i32 0
568  %v = call <4 x float> @llvm.amdgcn.image.getresinfo.2d.v4f32.i16(i32 15, i16 %mip, <8 x i32> %rsrc, i32 0, i32 0)
569  ret <4 x float> %v
570}
571
572define amdgpu_ps <4 x float> @getresinfo_3d(<8 x i32> inreg %rsrc, <2 x i16> %coords) {
573; GFX9-LABEL: getresinfo_3d:
574; GFX9:       ; %bb.0: ; %main_body
575; GFX9-NEXT:    image_get_resinfo v[0:3], v0, s[0:7] dmask:0xf unorm a16
576; GFX9-NEXT:    s_waitcnt vmcnt(0)
577; GFX9-NEXT:    ; return to shader part epilog
578;
579; GFX10-LABEL: getresinfo_3d:
580; GFX10:       ; %bb.0: ; %main_body
581; GFX10-NEXT:    image_get_resinfo v[0:3], v0, s[0:7] dmask:0xf dim:SQ_RSRC_IMG_3D unorm a16
582; GFX10-NEXT:    s_waitcnt vmcnt(0)
583; GFX10-NEXT:    ; return to shader part epilog
584main_body:
585  %mip = extractelement <2 x i16> %coords, i32 0
586  %v = call <4 x float> @llvm.amdgcn.image.getresinfo.3d.v4f32.i16(i32 15, i16 %mip, <8 x i32> %rsrc, i32 0, i32 0)
587  ret <4 x float> %v
588}
589
590define amdgpu_ps <4 x float> @getresinfo_cube(<8 x i32> inreg %rsrc, <2 x i16> %coords) {
591; GFX9-LABEL: getresinfo_cube:
592; GFX9:       ; %bb.0: ; %main_body
593; GFX9-NEXT:    image_get_resinfo v[0:3], v0, s[0:7] dmask:0xf unorm a16 da
594; GFX9-NEXT:    s_waitcnt vmcnt(0)
595; GFX9-NEXT:    ; return to shader part epilog
596;
597; GFX10-LABEL: getresinfo_cube:
598; GFX10:       ; %bb.0: ; %main_body
599; GFX10-NEXT:    image_get_resinfo v[0:3], v0, s[0:7] dmask:0xf dim:SQ_RSRC_IMG_CUBE unorm a16
600; GFX10-NEXT:    s_waitcnt vmcnt(0)
601; GFX10-NEXT:    ; return to shader part epilog
602main_body:
603  %mip = extractelement <2 x i16> %coords, i32 0
604  %v = call <4 x float> @llvm.amdgcn.image.getresinfo.cube.v4f32.i16(i32 15, i16 %mip, <8 x i32> %rsrc, i32 0, i32 0)
605  ret <4 x float> %v
606}
607
608define amdgpu_ps <4 x float> @getresinfo_1darray(<8 x i32> inreg %rsrc, <2 x i16> %coords) {
609; GFX9-LABEL: getresinfo_1darray:
610; GFX9:       ; %bb.0: ; %main_body
611; GFX9-NEXT:    image_get_resinfo v[0:3], v0, s[0:7] dmask:0xf unorm a16 da
612; GFX9-NEXT:    s_waitcnt vmcnt(0)
613; GFX9-NEXT:    ; return to shader part epilog
614;
615; GFX10-LABEL: getresinfo_1darray:
616; GFX10:       ; %bb.0: ; %main_body
617; GFX10-NEXT:    image_get_resinfo v[0:3], v0, s[0:7] dmask:0xf dim:SQ_RSRC_IMG_1D_ARRAY unorm a16
618; GFX10-NEXT:    s_waitcnt vmcnt(0)
619; GFX10-NEXT:    ; return to shader part epilog
620main_body:
621  %mip = extractelement <2 x i16> %coords, i32 0
622  %v = call <4 x float> @llvm.amdgcn.image.getresinfo.1darray.v4f32.i16(i32 15, i16 %mip, <8 x i32> %rsrc, i32 0, i32 0)
623  ret <4 x float> %v
624}
625
626define amdgpu_ps <4 x float> @getresinfo_2darray(<8 x i32> inreg %rsrc, <2 x i16> %coords) {
627; GFX9-LABEL: getresinfo_2darray:
628; GFX9:       ; %bb.0: ; %main_body
629; GFX9-NEXT:    image_get_resinfo v[0:3], v0, s[0:7] dmask:0xf unorm a16 da
630; GFX9-NEXT:    s_waitcnt vmcnt(0)
631; GFX9-NEXT:    ; return to shader part epilog
632;
633; GFX10-LABEL: getresinfo_2darray:
634; GFX10:       ; %bb.0: ; %main_body
635; GFX10-NEXT:    image_get_resinfo v[0:3], v0, s[0:7] dmask:0xf dim:SQ_RSRC_IMG_2D_ARRAY unorm a16
636; GFX10-NEXT:    s_waitcnt vmcnt(0)
637; GFX10-NEXT:    ; return to shader part epilog
638main_body:
639  %mip = extractelement <2 x i16> %coords, i32 0
640  %v = call <4 x float> @llvm.amdgcn.image.getresinfo.2darray.v4f32.i16(i32 15, i16 %mip, <8 x i32> %rsrc, i32 0, i32 0)
641  ret <4 x float> %v
642}
643
644define amdgpu_ps <4 x float> @getresinfo_2dmsaa(<8 x i32> inreg %rsrc, <2 x i16> %coords) {
645; GFX9-LABEL: getresinfo_2dmsaa:
646; GFX9:       ; %bb.0: ; %main_body
647; GFX9-NEXT:    image_get_resinfo v[0:3], v0, s[0:7] dmask:0xf unorm a16
648; GFX9-NEXT:    s_waitcnt vmcnt(0)
649; GFX9-NEXT:    ; return to shader part epilog
650;
651; GFX10-LABEL: getresinfo_2dmsaa:
652; GFX10:       ; %bb.0: ; %main_body
653; GFX10-NEXT:    image_get_resinfo v[0:3], v0, s[0:7] dmask:0xf dim:SQ_RSRC_IMG_2D_MSAA unorm a16
654; GFX10-NEXT:    s_waitcnt vmcnt(0)
655; GFX10-NEXT:    ; return to shader part epilog
656main_body:
657  %mip = extractelement <2 x i16> %coords, i32 0
658  %v = call <4 x float> @llvm.amdgcn.image.getresinfo.2dmsaa.v4f32.i16(i32 15, i16 %mip, <8 x i32> %rsrc, i32 0, i32 0)
659  ret <4 x float> %v
660}
661
662define amdgpu_ps <4 x float> @getresinfo_2darraymsaa(<8 x i32> inreg %rsrc, <2 x i16> %coords) {
663; GFX9-LABEL: getresinfo_2darraymsaa:
664; GFX9:       ; %bb.0: ; %main_body
665; GFX9-NEXT:    image_get_resinfo v[0:3], v0, s[0:7] dmask:0xf unorm a16 da
666; GFX9-NEXT:    s_waitcnt vmcnt(0)
667; GFX9-NEXT:    ; return to shader part epilog
668;
669; GFX10-LABEL: getresinfo_2darraymsaa:
670; GFX10:       ; %bb.0: ; %main_body
671; GFX10-NEXT:    image_get_resinfo v[0:3], v0, s[0:7] dmask:0xf dim:SQ_RSRC_IMG_2D_MSAA_ARRAY unorm a16
672; GFX10-NEXT:    s_waitcnt vmcnt(0)
673; GFX10-NEXT:    ; return to shader part epilog
674main_body:
675  %mip = extractelement <2 x i16> %coords, i32 0
676  %v = call <4 x float> @llvm.amdgcn.image.getresinfo.2darraymsaa.v4f32.i16(i32 15, i16 %mip, <8 x i32> %rsrc, i32 0, i32 0)
677  ret <4 x float> %v
678}
679
680define amdgpu_ps float @load_1d_V1(<8 x i32> inreg %rsrc, <2 x i16> %coords) {
681; GFX9-LABEL: load_1d_V1:
682; GFX9:       ; %bb.0: ; %main_body
683; GFX9-NEXT:    image_load v0, v0, s[0:7] dmask:0x8 unorm a16
684; GFX9-NEXT:    s_waitcnt vmcnt(0)
685; GFX9-NEXT:    ; return to shader part epilog
686;
687; GFX10-LABEL: load_1d_V1:
688; GFX10:       ; %bb.0: ; %main_body
689; GFX10-NEXT:    image_load v0, v0, s[0:7] dmask:0x8 dim:SQ_RSRC_IMG_1D unorm a16
690; GFX10-NEXT:    s_waitcnt vmcnt(0)
691; GFX10-NEXT:    ; return to shader part epilog
692main_body:
693  %s = extractelement <2 x i16> %coords, i32 0
694  %v = call float @llvm.amdgcn.image.load.1d.f32.i16(i32 8, i16 %s, <8 x i32> %rsrc, i32 0, i32 0)
695  ret float %v
696}
697
698define amdgpu_ps <2 x float> @load_1d_V2(<8 x i32> inreg %rsrc, <2 x i16> %coords) {
699; GFX9-LABEL: load_1d_V2:
700; GFX9:       ; %bb.0: ; %main_body
701; GFX9-NEXT:    image_load v[0:1], v0, s[0:7] dmask:0x9 unorm a16
702; GFX9-NEXT:    s_waitcnt vmcnt(0)
703; GFX9-NEXT:    ; return to shader part epilog
704;
705; GFX10-LABEL: load_1d_V2:
706; GFX10:       ; %bb.0: ; %main_body
707; GFX10-NEXT:    image_load v[0:1], v0, s[0:7] dmask:0x9 dim:SQ_RSRC_IMG_1D unorm a16
708; GFX10-NEXT:    s_waitcnt vmcnt(0)
709; GFX10-NEXT:    ; return to shader part epilog
710main_body:
711  %s = extractelement <2 x i16> %coords, i32 0
712  %v = call <2 x float> @llvm.amdgcn.image.load.1d.v2f32.i16(i32 9, i16 %s, <8 x i32> %rsrc, i32 0, i32 0)
713  ret <2 x float> %v
714}
715
716define amdgpu_ps void @store_1d_V1(<8 x i32> inreg %rsrc, float %vdata, <2 x i16> %coords) {
717; GFX9-LABEL: store_1d_V1:
718; GFX9:       ; %bb.0: ; %main_body
719; GFX9-NEXT:    image_store v0, v1, s[0:7] dmask:0x2 unorm a16
720; GFX9-NEXT:    s_endpgm
721;
722; GFX10-LABEL: store_1d_V1:
723; GFX10:       ; %bb.0: ; %main_body
724; GFX10-NEXT:    image_store v0, v1, s[0:7] dmask:0x2 dim:SQ_RSRC_IMG_1D unorm a16
725; GFX10-NEXT:    s_endpgm
726main_body:
727  %s = extractelement <2 x i16> %coords, i32 0
728  call void @llvm.amdgcn.image.store.1d.f32.i16(float %vdata, i32 2, i16 %s, <8 x i32> %rsrc, i32 0, i32 0)
729  ret void
730}
731
732define amdgpu_ps void @store_1d_V2(<8 x i32> inreg %rsrc, <2 x float> %vdata, <2 x i16> %coords) {
733; GFX9-LABEL: store_1d_V2:
734; GFX9:       ; %bb.0: ; %main_body
735; GFX9-NEXT:    image_store v[0:1], v2, s[0:7] dmask:0xc unorm a16
736; GFX9-NEXT:    s_endpgm
737;
738; GFX10-LABEL: store_1d_V2:
739; GFX10:       ; %bb.0: ; %main_body
740; GFX10-NEXT:    image_store v[0:1], v2, s[0:7] dmask:0xc dim:SQ_RSRC_IMG_1D unorm a16
741; GFX10-NEXT:    s_endpgm
742main_body:
743  %s = extractelement <2 x i16> %coords, i32 0
744  call void @llvm.amdgcn.image.store.1d.v2f32.i16(<2 x float> %vdata, i32 12, i16 %s, <8 x i32> %rsrc, i32 0, i32 0)
745  ret void
746}
747
748define amdgpu_ps <4 x float> @load_1d_glc(<8 x i32> inreg %rsrc, <2 x i16> %coords) {
749; GFX9-LABEL: load_1d_glc:
750; GFX9:       ; %bb.0: ; %main_body
751; GFX9-NEXT:    image_load v[0:3], v0, s[0:7] dmask:0xf unorm glc a16
752; GFX9-NEXT:    s_waitcnt vmcnt(0)
753; GFX9-NEXT:    ; return to shader part epilog
754;
755; GFX10-LABEL: load_1d_glc:
756; GFX10:       ; %bb.0: ; %main_body
757; GFX10-NEXT:    image_load v[0:3], v0, s[0:7] dmask:0xf dim:SQ_RSRC_IMG_1D unorm glc a16
758; GFX10-NEXT:    s_waitcnt vmcnt(0)
759; GFX10-NEXT:    ; return to shader part epilog
760main_body:
761  %s = extractelement <2 x i16> %coords, i32 0
762  %v = call <4 x float> @llvm.amdgcn.image.load.1d.v4f32.i16(i32 15, i16 %s, <8 x i32> %rsrc, i32 0, i32 1)
763  ret <4 x float> %v
764}
765
766define amdgpu_ps <4 x float> @load_1d_slc(<8 x i32> inreg %rsrc, <2 x i16> %coords) {
767; GFX9-LABEL: load_1d_slc:
768; GFX9:       ; %bb.0: ; %main_body
769; GFX9-NEXT:    image_load v[0:3], v0, s[0:7] dmask:0xf unorm slc a16
770; GFX9-NEXT:    s_waitcnt vmcnt(0)
771; GFX9-NEXT:    ; return to shader part epilog
772;
773; GFX10-LABEL: load_1d_slc:
774; GFX10:       ; %bb.0: ; %main_body
775; GFX10-NEXT:    image_load v[0:3], v0, s[0:7] dmask:0xf dim:SQ_RSRC_IMG_1D unorm slc a16
776; GFX10-NEXT:    s_waitcnt vmcnt(0)
777; GFX10-NEXT:    ; return to shader part epilog
778main_body:
779  %s = extractelement <2 x i16> %coords, i32 0
780  %v = call <4 x float> @llvm.amdgcn.image.load.1d.v4f32.i16(i32 15, i16 %s, <8 x i32> %rsrc, i32 0, i32 2)
781  ret <4 x float> %v
782}
783
784define amdgpu_ps <4 x float> @load_1d_glc_slc(<8 x i32> inreg %rsrc, <2 x i16> %coords) {
785; GFX9-LABEL: load_1d_glc_slc:
786; GFX9:       ; %bb.0: ; %main_body
787; GFX9-NEXT:    image_load v[0:3], v0, s[0:7] dmask:0xf unorm glc slc a16
788; GFX9-NEXT:    s_waitcnt vmcnt(0)
789; GFX9-NEXT:    ; return to shader part epilog
790;
791; GFX10-LABEL: load_1d_glc_slc:
792; GFX10:       ; %bb.0: ; %main_body
793; GFX10-NEXT:    image_load v[0:3], v0, s[0:7] dmask:0xf dim:SQ_RSRC_IMG_1D unorm glc slc a16
794; GFX10-NEXT:    s_waitcnt vmcnt(0)
795; GFX10-NEXT:    ; return to shader part epilog
796main_body:
797  %s = extractelement <2 x i16> %coords, i32 0
798  %v = call <4 x float> @llvm.amdgcn.image.load.1d.v4f32.i16(i32 15, i16 %s, <8 x i32> %rsrc, i32 0, i32 3)
799  ret <4 x float> %v
800}
801
802define amdgpu_ps void @store_1d_glc(<8 x i32> inreg %rsrc, <4 x float> %vdata, <2 x i16> %coords) {
803; GFX9-LABEL: store_1d_glc:
804; GFX9:       ; %bb.0: ; %main_body
805; GFX9-NEXT:    image_store v[0:3], v4, s[0:7] dmask:0xf unorm glc a16
806; GFX9-NEXT:    s_endpgm
807;
808; GFX10-LABEL: store_1d_glc:
809; GFX10:       ; %bb.0: ; %main_body
810; GFX10-NEXT:    image_store v[0:3], v4, s[0:7] dmask:0xf dim:SQ_RSRC_IMG_1D unorm glc a16
811; GFX10-NEXT:    s_endpgm
812main_body:
813  %s = extractelement <2 x i16> %coords, i32 0
814  call void @llvm.amdgcn.image.store.1d.v4f32.i16(<4 x float> %vdata, i32 15, i16 %s, <8 x i32> %rsrc, i32 0, i32 1)
815  ret void
816}
817
818define amdgpu_ps void @store_1d_slc(<8 x i32> inreg %rsrc, <4 x float> %vdata, <2 x i16> %coords) {
819; GFX9-LABEL: store_1d_slc:
820; GFX9:       ; %bb.0: ; %main_body
821; GFX9-NEXT:    image_store v[0:3], v4, s[0:7] dmask:0xf unorm slc a16
822; GFX9-NEXT:    s_endpgm
823;
824; GFX10-LABEL: store_1d_slc:
825; GFX10:       ; %bb.0: ; %main_body
826; GFX10-NEXT:    image_store v[0:3], v4, s[0:7] dmask:0xf dim:SQ_RSRC_IMG_1D unorm slc a16
827; GFX10-NEXT:    s_endpgm
828main_body:
829  %s = extractelement <2 x i16> %coords, i32 0
830  call void @llvm.amdgcn.image.store.1d.v4f32.i16(<4 x float> %vdata, i32 15, i16 %s, <8 x i32> %rsrc, i32 0, i32 2)
831  ret void
832}
833
834define amdgpu_ps void @store_1d_glc_slc(<8 x i32> inreg %rsrc, <4 x float> %vdata, <2 x i16> %coords) {
835; GFX9-LABEL: store_1d_glc_slc:
836; GFX9:       ; %bb.0: ; %main_body
837; GFX9-NEXT:    image_store v[0:3], v4, s[0:7] dmask:0xf unorm glc slc a16
838; GFX9-NEXT:    s_endpgm
839;
840; GFX10-LABEL: store_1d_glc_slc:
841; GFX10:       ; %bb.0: ; %main_body
842; GFX10-NEXT:    image_store v[0:3], v4, s[0:7] dmask:0xf dim:SQ_RSRC_IMG_1D unorm glc slc a16
843; GFX10-NEXT:    s_endpgm
844main_body:
845  %s = extractelement <2 x i16> %coords, i32 0
846  call void @llvm.amdgcn.image.store.1d.v4f32.i16(<4 x float> %vdata, i32 15, i16 %s, <8 x i32> %rsrc, i32 0, i32 3)
847  ret void
848}
849
850define amdgpu_ps <4 x float> @getresinfo_dmask0(<8 x i32> inreg %rsrc, <4 x float> %vdata, <2 x i16> %coords) #0 {
851; GFX9-LABEL: getresinfo_dmask0:
852; GFX9:       ; %bb.0: ; %main_body
853; GFX9-NEXT:    ; return to shader part epilog
854;
855; GFX10-LABEL: getresinfo_dmask0:
856; GFX10:       ; %bb.0: ; %main_body
857; GFX10-NEXT:    ; return to shader part epilog
858main_body:
859  %mip = extractelement <2 x i16> %coords, i32 0
860  %r = call <4 x float> @llvm.amdgcn.image.getresinfo.1d.v4f32.i16(i32 0, i16 %mip, <8 x i32> %rsrc, i32 0, i32 0)
861  ret <4 x float> %r
862}
863
864declare <4 x float> @llvm.amdgcn.image.load.1d.v4f32.i16(i32, i16, <8 x i32>, i32, i32) #1
865declare <4 x float> @llvm.amdgcn.image.load.2d.v4f32.i16(i32, i16, i16, <8 x i32>, i32, i32) #1
866declare <4 x float> @llvm.amdgcn.image.load.3d.v4f32.i16(i32, i16, i16, i16, <8 x i32>, i32, i32) #1
867declare <4 x float> @llvm.amdgcn.image.load.cube.v4f32.i16(i32, i16, i16, i16, <8 x i32>, i32, i32) #1
868declare <4 x float> @llvm.amdgcn.image.load.1darray.v4f32.i16(i32, i16, i16, <8 x i32>, i32, i32) #1
869declare <4 x float> @llvm.amdgcn.image.load.2darray.v4f32.i16(i32, i16, i16, i16, <8 x i32>, i32, i32) #1
870declare <4 x float> @llvm.amdgcn.image.load.2dmsaa.v4f32.i16(i32, i16, i16, i16, <8 x i32>, i32, i32) #1
871declare <4 x float> @llvm.amdgcn.image.load.2darraymsaa.v4f32.i16(i32, i16, i16, i16, i16, <8 x i32>, i32, i32) #1
872
873declare <4 x float> @llvm.amdgcn.image.load.mip.1d.v4f32.i16(i32, i16, i16, <8 x i32>, i32, i32) #1
874declare <4 x float> @llvm.amdgcn.image.load.mip.2d.v4f32.i16(i32, i16, i16, i16, <8 x i32>, i32, i32) #1
875declare <4 x float> @llvm.amdgcn.image.load.mip.3d.v4f32.i16(i32, i16, i16, i16, i16, <8 x i32>, i32, i32) #1
876declare <4 x float> @llvm.amdgcn.image.load.mip.cube.v4f32.i16(i32, i16, i16, i16, i16, <8 x i32>, i32, i32) #1
877declare <4 x float> @llvm.amdgcn.image.load.mip.1darray.v4f32.i16(i32, i16, i16, i16, <8 x i32>, i32, i32) #1
878declare <4 x float> @llvm.amdgcn.image.load.mip.2darray.v4f32.i16(i32, i16, i16, i16, i16, <8 x i32>, i32, i32) #1
879
880declare void @llvm.amdgcn.image.store.1d.v4f32.i16(<4 x float>, i32, i16, <8 x i32>, i32, i32) #0
881declare void @llvm.amdgcn.image.store.2d.v4f32.i16(<4 x float>, i32, i16, i16, <8 x i32>, i32, i32) #0
882declare void @llvm.amdgcn.image.store.3d.v4f32.i16(<4 x float>, i32, i16, i16, i16, <8 x i32>, i32, i32) #0
883declare void @llvm.amdgcn.image.store.cube.v4f32.i16(<4 x float>, i32, i16, i16, i16, <8 x i32>, i32, i32) #0
884declare void @llvm.amdgcn.image.store.1darray.v4f32.i16(<4 x float>, i32, i16, i16, <8 x i32>, i32, i32) #0
885declare void @llvm.amdgcn.image.store.2darray.v4f32.i16(<4 x float>, i32, i16, i16, i16, <8 x i32>, i32, i32) #0
886declare void @llvm.amdgcn.image.store.2dmsaa.v4f32.i16(<4 x float>, i32, i16, i16, i16, <8 x i32>, i32, i32) #0
887declare void @llvm.amdgcn.image.store.2darraymsaa.v4f32.i16(<4 x float>, i32, i16, i16, i16, i16, <8 x i32>, i32, i32) #0
888
889declare void @llvm.amdgcn.image.store.mip.1d.v4f32.i16(<4 x float>, i32, i16, i16, <8 x i32>, i32, i32) #0
890declare void @llvm.amdgcn.image.store.mip.2d.v4f32.i16(<4 x float>, i32, i16, i16, i16, <8 x i32>, i32, i32) #0
891declare void @llvm.amdgcn.image.store.mip.3d.v4f32.i16(<4 x float>, i32, i16, i16, i16, i16, <8 x i32>, i32, i32) #0
892declare void @llvm.amdgcn.image.store.mip.cube.v4f32.i16(<4 x float>, i32, i16, i16, i16, i16, <8 x i32>, i32, i32) #0
893declare void @llvm.amdgcn.image.store.mip.1darray.v4f32.i16(<4 x float>, i32, i16, i16, i16, <8 x i32>, i32, i32) #0
894declare void @llvm.amdgcn.image.store.mip.2darray.v4f32.i16(<4 x float>, i32, i16, i16, i16, i16, <8 x i32>, i32, i32) #0
895
896declare <4 x float> @llvm.amdgcn.image.getresinfo.1d.v4f32.i16(i32, i16, <8 x i32>, i32, i32) #2
897declare <4 x float> @llvm.amdgcn.image.getresinfo.2d.v4f32.i16(i32, i16, <8 x i32>, i32, i32) #2
898declare <4 x float> @llvm.amdgcn.image.getresinfo.3d.v4f32.i16(i32, i16, <8 x i32>, i32, i32) #2
899declare <4 x float> @llvm.amdgcn.image.getresinfo.cube.v4f32.i16(i32, i16, <8 x i32>, i32, i32) #2
900declare <4 x float> @llvm.amdgcn.image.getresinfo.1darray.v4f32.i16(i32, i16, <8 x i32>, i32, i32) #2
901declare <4 x float> @llvm.amdgcn.image.getresinfo.2darray.v4f32.i16(i32, i16, <8 x i32>, i32, i32) #2
902declare <4 x float> @llvm.amdgcn.image.getresinfo.2dmsaa.v4f32.i16(i32, i16, <8 x i32>, i32, i32) #2
903declare <4 x float> @llvm.amdgcn.image.getresinfo.2darraymsaa.v4f32.i16(i32, i16, <8 x i32>, i32, i32) #2
904
905declare float @llvm.amdgcn.image.load.1d.f32.i16(i32, i16, <8 x i32>, i32, i32) #1
906declare float @llvm.amdgcn.image.load.2d.f32.i16(i32, i16, i16, <8 x i32>, i32, i32) #1
907declare <2 x float> @llvm.amdgcn.image.load.1d.v2f32.i16(i32, i16, <8 x i32>, i32, i32) #1
908declare void @llvm.amdgcn.image.store.1d.f32.i16(float, i32, i16, <8 x i32>, i32, i32) #0
909declare void @llvm.amdgcn.image.store.1d.v2f32.i16(<2 x float>, i32, i16, <8 x i32>, i32, i32) #0
910
911attributes #0 = { nounwind }
912attributes #1 = { nounwind readonly }
913attributes #2 = { nounwind readnone }
914