1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 -verify-machineinstrs < %s | FileCheck -check-prefixes=GFX9 %s
3; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1010 -verify-machineinstrs < %s | FileCheck -check-prefixes=GFX10 %s
4; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1100 -verify-machineinstrs < %s | FileCheck -check-prefix=GFX11 %s
5
6declare void @extern_func() #2
7
8define <4 x float> @non_preserved_vgpr_tuple8(<8 x i32> %rsrc, <4 x i32> %samp, float %bias, float %zcompare, float %s, float %t, float %clamp) {
9; The vgpr tuple8 operand in image_gather4_c_b_cl instruction needs not be
10; preserved across the call and should get 8 scratch registers.
11; GFX9-LABEL: non_preserved_vgpr_tuple8:
12; GFX9:       ; %bb.0: ; %main_body
13; GFX9-NEXT:    s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
14; GFX9-NEXT:    s_or_saveexec_b64 s[4:5], -1
15; GFX9-NEXT:    buffer_store_dword v40, off, s[0:3], s32 offset:16 ; 4-byte Folded Spill
16; GFX9-NEXT:    s_mov_b64 exec, s[4:5]
17; GFX9-NEXT:    v_writelane_b32 v40, s33, 2
18; GFX9-NEXT:    s_mov_b32 s33, s32
19; GFX9-NEXT:    v_mov_b32_e32 v36, v16
20; GFX9-NEXT:    v_mov_b32_e32 v35, v15
21; GFX9-NEXT:    v_mov_b32_e32 v34, v14
22; GFX9-NEXT:    v_mov_b32_e32 v33, v13
23; GFX9-NEXT:    v_mov_b32_e32 v32, v12
24; GFX9-NEXT:    buffer_store_dword v41, off, s[0:3], s33 offset:12 ; 4-byte Folded Spill
25; GFX9-NEXT:    buffer_store_dword v42, off, s[0:3], s33 offset:8 ; 4-byte Folded Spill
26; GFX9-NEXT:    buffer_store_dword v43, off, s[0:3], s33 offset:4 ; 4-byte Folded Spill
27; GFX9-NEXT:    buffer_store_dword v44, off, s[0:3], s33 ; 4-byte Folded Spill
28; GFX9-NEXT:    ;;#ASMSTART
29; GFX9-NEXT:    ;;#ASMEND
30; GFX9-NEXT:    ;;#ASMSTART
31; GFX9-NEXT:    ;;#ASMEND
32; GFX9-NEXT:    ;;#ASMSTART
33; GFX9-NEXT:    ;;#ASMEND
34; GFX9-NEXT:    ;;#ASMSTART
35; GFX9-NEXT:    ;;#ASMEND
36; GFX9-NEXT:    image_gather4_c_b_cl v[41:44], v[32:36], s[4:11], s[4:7] dmask:0x1
37; GFX9-NEXT:    s_addk_i32 s32, 0x800
38; GFX9-NEXT:    s_getpc_b64 s[4:5]
39; GFX9-NEXT:    s_add_u32 s4, s4, extern_func@gotpcrel32@lo+4
40; GFX9-NEXT:    s_addc_u32 s5, s5, extern_func@gotpcrel32@hi+12
41; GFX9-NEXT:    s_load_dwordx2 s[4:5], s[4:5], 0x0
42; GFX9-NEXT:    v_writelane_b32 v40, s30, 0
43; GFX9-NEXT:    v_writelane_b32 v40, s31, 1
44; GFX9-NEXT:    s_waitcnt lgkmcnt(0)
45; GFX9-NEXT:    s_swappc_b64 s[30:31], s[4:5]
46; GFX9-NEXT:    v_mov_b32_e32 v0, v41
47; GFX9-NEXT:    v_mov_b32_e32 v1, v42
48; GFX9-NEXT:    v_mov_b32_e32 v2, v43
49; GFX9-NEXT:    v_mov_b32_e32 v3, v44
50; GFX9-NEXT:    buffer_load_dword v44, off, s[0:3], s33 ; 4-byte Folded Reload
51; GFX9-NEXT:    buffer_load_dword v43, off, s[0:3], s33 offset:4 ; 4-byte Folded Reload
52; GFX9-NEXT:    buffer_load_dword v42, off, s[0:3], s33 offset:8 ; 4-byte Folded Reload
53; GFX9-NEXT:    buffer_load_dword v41, off, s[0:3], s33 offset:12 ; 4-byte Folded Reload
54; GFX9-NEXT:    v_readlane_b32 s31, v40, 1
55; GFX9-NEXT:    v_readlane_b32 s30, v40, 0
56; GFX9-NEXT:    s_addk_i32 s32, 0xf800
57; GFX9-NEXT:    v_readlane_b32 s33, v40, 2
58; GFX9-NEXT:    s_or_saveexec_b64 s[4:5], -1
59; GFX9-NEXT:    buffer_load_dword v40, off, s[0:3], s32 offset:16 ; 4-byte Folded Reload
60; GFX9-NEXT:    s_mov_b64 exec, s[4:5]
61; GFX9-NEXT:    s_waitcnt vmcnt(0)
62; GFX9-NEXT:    s_setpc_b64 s[30:31]
63;
64; GFX10-LABEL: non_preserved_vgpr_tuple8:
65; GFX10:       ; %bb.0: ; %main_body
66; GFX10-NEXT:    s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
67; GFX10-NEXT:    s_waitcnt_vscnt null, 0x0
68; GFX10-NEXT:    s_or_saveexec_b32 s4, -1
69; GFX10-NEXT:    buffer_store_dword v40, off, s[0:3], s32 offset:16 ; 4-byte Folded Spill
70; GFX10-NEXT:    s_waitcnt_depctr 0xffe3
71; GFX10-NEXT:    s_mov_b32 exec_lo, s4
72; GFX10-NEXT:    v_mov_b32_e32 v36, v16
73; GFX10-NEXT:    v_mov_b32_e32 v35, v15
74; GFX10-NEXT:    v_mov_b32_e32 v34, v14
75; GFX10-NEXT:    v_mov_b32_e32 v33, v13
76; GFX10-NEXT:    v_mov_b32_e32 v32, v12
77; GFX10-NEXT:    v_writelane_b32 v40, s33, 2
78; GFX10-NEXT:    s_mov_b32 s33, s32
79; GFX10-NEXT:    buffer_store_dword v41, off, s[0:3], s33 offset:12 ; 4-byte Folded Spill
80; GFX10-NEXT:    buffer_store_dword v42, off, s[0:3], s33 offset:8 ; 4-byte Folded Spill
81; GFX10-NEXT:    buffer_store_dword v43, off, s[0:3], s33 offset:4 ; 4-byte Folded Spill
82; GFX10-NEXT:    buffer_store_dword v44, off, s[0:3], s33 ; 4-byte Folded Spill
83; GFX10-NEXT:    ;;#ASMSTART
84; GFX10-NEXT:    ;;#ASMEND
85; GFX10-NEXT:    ;;#ASMSTART
86; GFX10-NEXT:    ;;#ASMEND
87; GFX10-NEXT:    ;;#ASMSTART
88; GFX10-NEXT:    ;;#ASMEND
89; GFX10-NEXT:    ;;#ASMSTART
90; GFX10-NEXT:    ;;#ASMEND
91; GFX10-NEXT:    image_gather4_c_b_cl v[41:44], v[32:36], s[4:11], s[4:7] dmask:0x1 dim:SQ_RSRC_IMG_2D
92; GFX10-NEXT:    s_addk_i32 s32, 0x400
93; GFX10-NEXT:    s_waitcnt_depctr 0xffe3
94; GFX10-NEXT:    s_getpc_b64 s[4:5]
95; GFX10-NEXT:    s_add_u32 s4, s4, extern_func@gotpcrel32@lo+4
96; GFX10-NEXT:    s_addc_u32 s5, s5, extern_func@gotpcrel32@hi+12
97; GFX10-NEXT:    v_writelane_b32 v40, s30, 0
98; GFX10-NEXT:    s_load_dwordx2 s[4:5], s[4:5], 0x0
99; GFX10-NEXT:    v_writelane_b32 v40, s31, 1
100; GFX10-NEXT:    s_waitcnt lgkmcnt(0)
101; GFX10-NEXT:    s_swappc_b64 s[30:31], s[4:5]
102; GFX10-NEXT:    v_mov_b32_e32 v0, v41
103; GFX10-NEXT:    v_mov_b32_e32 v1, v42
104; GFX10-NEXT:    v_mov_b32_e32 v2, v43
105; GFX10-NEXT:    v_mov_b32_e32 v3, v44
106; GFX10-NEXT:    s_clause 0x3
107; GFX10-NEXT:    buffer_load_dword v44, off, s[0:3], s33
108; GFX10-NEXT:    buffer_load_dword v43, off, s[0:3], s33 offset:4
109; GFX10-NEXT:    buffer_load_dword v42, off, s[0:3], s33 offset:8
110; GFX10-NEXT:    buffer_load_dword v41, off, s[0:3], s33 offset:12
111; GFX10-NEXT:    v_readlane_b32 s31, v40, 1
112; GFX10-NEXT:    v_readlane_b32 s30, v40, 0
113; GFX10-NEXT:    s_addk_i32 s32, 0xfc00
114; GFX10-NEXT:    v_readlane_b32 s33, v40, 2
115; GFX10-NEXT:    s_or_saveexec_b32 s4, -1
116; GFX10-NEXT:    buffer_load_dword v40, off, s[0:3], s32 offset:16 ; 4-byte Folded Reload
117; GFX10-NEXT:    s_waitcnt_depctr 0xffe3
118; GFX10-NEXT:    s_mov_b32 exec_lo, s4
119; GFX10-NEXT:    s_waitcnt vmcnt(0)
120; GFX10-NEXT:    s_setpc_b64 s[30:31]
121;
122; GFX11-LABEL: non_preserved_vgpr_tuple8:
123; GFX11:       ; %bb.0: ; %main_body
124; GFX11-NEXT:    s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
125; GFX11-NEXT:    s_waitcnt_vscnt null, 0x0
126; GFX11-NEXT:    s_or_saveexec_b32 s0, -1
127; GFX11-NEXT:    scratch_store_b32 off, v40, s32 offset:16 ; 4-byte Folded Spill
128; GFX11-NEXT:    s_mov_b32 exec_lo, s0
129; GFX11-NEXT:    v_dual_mov_b32 v36, v16 :: v_dual_mov_b32 v35, v15
130; GFX11-NEXT:    v_dual_mov_b32 v34, v14 :: v_dual_mov_b32 v33, v13
131; GFX11-NEXT:    v_mov_b32_e32 v32, v12
132; GFX11-NEXT:    v_writelane_b32 v40, s33, 2
133; GFX11-NEXT:    s_mov_b32 s33, s32
134; GFX11-NEXT:    s_clause 0x3
135; GFX11-NEXT:    scratch_store_b32 off, v41, s33 offset:12
136; GFX11-NEXT:    scratch_store_b32 off, v42, s33 offset:8
137; GFX11-NEXT:    scratch_store_b32 off, v43, s33 offset:4
138; GFX11-NEXT:    scratch_store_b32 off, v44, s33
139; GFX11-NEXT:    ;;#ASMSTART
140; GFX11-NEXT:    ;;#ASMEND
141; GFX11-NEXT:    ;;#ASMSTART
142; GFX11-NEXT:    ;;#ASMEND
143; GFX11-NEXT:    ;;#ASMSTART
144; GFX11-NEXT:    ;;#ASMEND
145; GFX11-NEXT:    ;;#ASMSTART
146; GFX11-NEXT:    ;;#ASMEND
147; GFX11-NEXT:    image_gather4_c_b_cl v[41:44], v[32:36], s[0:7], s[0:3] dmask:0x1 dim:SQ_RSRC_IMG_2D
148; GFX11-NEXT:    s_add_i32 s32, s32, 32
149; GFX11-NEXT:    s_getpc_b64 s[0:1]
150; GFX11-NEXT:    s_add_u32 s0, s0, extern_func@gotpcrel32@lo+4
151; GFX11-NEXT:    s_addc_u32 s1, s1, extern_func@gotpcrel32@hi+12
152; GFX11-NEXT:    v_writelane_b32 v40, s30, 0
153; GFX11-NEXT:    s_load_b64 s[0:1], s[0:1], 0x0
154; GFX11-NEXT:    v_writelane_b32 v40, s31, 1
155; GFX11-NEXT:    s_waitcnt lgkmcnt(0)
156; GFX11-NEXT:    s_swappc_b64 s[30:31], s[0:1]
157; GFX11-NEXT:    v_dual_mov_b32 v0, v41 :: v_dual_mov_b32 v1, v42
158; GFX11-NEXT:    v_dual_mov_b32 v2, v43 :: v_dual_mov_b32 v3, v44
159; GFX11-NEXT:    s_clause 0x3
160; GFX11-NEXT:    scratch_load_b32 v44, off, s33
161; GFX11-NEXT:    scratch_load_b32 v43, off, s33 offset:4
162; GFX11-NEXT:    scratch_load_b32 v42, off, s33 offset:8
163; GFX11-NEXT:    scratch_load_b32 v41, off, s33 offset:12
164; GFX11-NEXT:    v_readlane_b32 s31, v40, 1
165; GFX11-NEXT:    v_readlane_b32 s30, v40, 0
166; GFX11-NEXT:    s_addk_i32 s32, 0xffe0
167; GFX11-NEXT:    v_readlane_b32 s33, v40, 2
168; GFX11-NEXT:    s_or_saveexec_b32 s0, -1
169; GFX11-NEXT:    scratch_load_b32 v40, off, s32 offset:16 ; 4-byte Folded Reload
170; GFX11-NEXT:    s_mov_b32 exec_lo, s0
171; GFX11-NEXT:    s_waitcnt vmcnt(0)
172; GFX11-NEXT:    s_setpc_b64 s[30:31]
173
174
175
176
177
178
179
180
181
182
183main_body:
184  call void asm sideeffect "", "~{v0},~{v1},~{v2},~{v3},~{v4},~{v5},~{v6},~{v7}"() #0
185  call void asm sideeffect "", "~{v8},~{v9},~{v10},~{v11},~{v12},~{v13},~{v14},~{v15}"() #0
186  call void asm sideeffect "", "~{v16},~{v17},~{v18},~{v19},~{v20},~{v21},~{v22},~{v23}"() #0
187  call void asm sideeffect "", "~{v24},~{v25},~{v26},~{v27},~{v28},~{v29},~{v30},~{v31}"() #0
188  %v = call <4 x float> @llvm.amdgcn.image.gather4.c.b.cl.2d.v4f32.f32.f32(i32 1, float %bias, float %zcompare, float %s, float %t, float %clamp, <8 x i32> undef, <4 x i32> undef, i1 false, i32 0, i32 0)
189  call void @extern_func()
190  ret <4 x float> %v
191}
192
193define <4 x float> @call_preserved_vgpr_tuple8(<8 x i32> %rsrc, <4 x i32> %samp, float %bias, float %zcompare, float %s, float %t, float %clamp) {
194; The vgpr tuple8 operand in image_gather4_c_b_cl instruction needs to be preserved
195; across the call and should get allcoated to 8 CSRs.
196; Only the lower 5 sub-registers of the tuple are preserved.
197; The upper 3 sub-registers are unused.
198; GFX9-LABEL: call_preserved_vgpr_tuple8:
199; GFX9:       ; %bb.0: ; %main_body
200; GFX9-NEXT:    s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
201; GFX9-NEXT:    s_or_saveexec_b64 s[4:5], -1
202; GFX9-NEXT:    buffer_store_dword v40, off, s[0:3], s32 offset:20 ; 4-byte Folded Spill
203; GFX9-NEXT:    s_mov_b64 exec, s[4:5]
204; GFX9-NEXT:    v_writelane_b32 v40, s33, 2
205; GFX9-NEXT:    s_mov_b32 s33, s32
206; GFX9-NEXT:    buffer_store_dword v41, off, s[0:3], s33 offset:16 ; 4-byte Folded Spill
207; GFX9-NEXT:    buffer_store_dword v42, off, s[0:3], s33 offset:12 ; 4-byte Folded Spill
208; GFX9-NEXT:    buffer_store_dword v43, off, s[0:3], s33 offset:8 ; 4-byte Folded Spill
209; GFX9-NEXT:    buffer_store_dword v44, off, s[0:3], s33 offset:4 ; 4-byte Folded Spill
210; GFX9-NEXT:    buffer_store_dword v45, off, s[0:3], s33 ; 4-byte Folded Spill
211; GFX9-NEXT:    v_mov_b32_e32 v45, v16
212; GFX9-NEXT:    v_mov_b32_e32 v44, v15
213; GFX9-NEXT:    v_mov_b32_e32 v43, v14
214; GFX9-NEXT:    v_mov_b32_e32 v42, v13
215; GFX9-NEXT:    v_mov_b32_e32 v41, v12
216; GFX9-NEXT:    image_gather4_c_b_cl v[0:3], v[41:45], s[4:11], s[4:7] dmask:0x1
217; GFX9-NEXT:    s_addk_i32 s32, 0x800
218; GFX9-NEXT:    s_getpc_b64 s[4:5]
219; GFX9-NEXT:    s_add_u32 s4, s4, extern_func@gotpcrel32@lo+4
220; GFX9-NEXT:    s_addc_u32 s5, s5, extern_func@gotpcrel32@hi+12
221; GFX9-NEXT:    s_load_dwordx2 s[4:5], s[4:5], 0x0
222; GFX9-NEXT:    v_writelane_b32 v40, s30, 0
223; GFX9-NEXT:    v_writelane_b32 v40, s31, 1
224; GFX9-NEXT:    s_waitcnt vmcnt(0)
225; GFX9-NEXT:    global_store_dwordx4 v[0:1], v[0:3], off
226; GFX9-NEXT:    s_waitcnt lgkmcnt(0)
227; GFX9-NEXT:    s_swappc_b64 s[30:31], s[4:5]
228; GFX9-NEXT:    image_gather4_c_b_cl v[0:3], v[41:45], s[4:11], s[4:7] dmask:0x1
229; GFX9-NEXT:    s_nop 0
230; GFX9-NEXT:    buffer_load_dword v45, off, s[0:3], s33 ; 4-byte Folded Reload
231; GFX9-NEXT:    buffer_load_dword v44, off, s[0:3], s33 offset:4 ; 4-byte Folded Reload
232; GFX9-NEXT:    buffer_load_dword v43, off, s[0:3], s33 offset:8 ; 4-byte Folded Reload
233; GFX9-NEXT:    buffer_load_dword v42, off, s[0:3], s33 offset:12 ; 4-byte Folded Reload
234; GFX9-NEXT:    buffer_load_dword v41, off, s[0:3], s33 offset:16 ; 4-byte Folded Reload
235; GFX9-NEXT:    v_readlane_b32 s31, v40, 1
236; GFX9-NEXT:    v_readlane_b32 s30, v40, 0
237; GFX9-NEXT:    s_addk_i32 s32, 0xf800
238; GFX9-NEXT:    v_readlane_b32 s33, v40, 2
239; GFX9-NEXT:    s_or_saveexec_b64 s[4:5], -1
240; GFX9-NEXT:    buffer_load_dword v40, off, s[0:3], s32 offset:20 ; 4-byte Folded Reload
241; GFX9-NEXT:    s_mov_b64 exec, s[4:5]
242; GFX9-NEXT:    s_waitcnt vmcnt(0)
243; GFX9-NEXT:    s_setpc_b64 s[30:31]
244;
245; GFX10-LABEL: call_preserved_vgpr_tuple8:
246; GFX10:       ; %bb.0: ; %main_body
247; GFX10-NEXT:    s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
248; GFX10-NEXT:    s_waitcnt_vscnt null, 0x0
249; GFX10-NEXT:    s_or_saveexec_b32 s4, -1
250; GFX10-NEXT:    buffer_store_dword v40, off, s[0:3], s32 offset:20 ; 4-byte Folded Spill
251; GFX10-NEXT:    s_waitcnt_depctr 0xffe3
252; GFX10-NEXT:    s_mov_b32 exec_lo, s4
253; GFX10-NEXT:    v_writelane_b32 v40, s33, 2
254; GFX10-NEXT:    s_mov_b32 s33, s32
255; GFX10-NEXT:    buffer_store_dword v41, off, s[0:3], s33 offset:16 ; 4-byte Folded Spill
256; GFX10-NEXT:    buffer_store_dword v42, off, s[0:3], s33 offset:12 ; 4-byte Folded Spill
257; GFX10-NEXT:    buffer_store_dword v43, off, s[0:3], s33 offset:8 ; 4-byte Folded Spill
258; GFX10-NEXT:    buffer_store_dword v44, off, s[0:3], s33 offset:4 ; 4-byte Folded Spill
259; GFX10-NEXT:    buffer_store_dword v45, off, s[0:3], s33 ; 4-byte Folded Spill
260; GFX10-NEXT:    image_gather4_c_b_cl v[0:3], v[12:16], s[4:11], s[4:7] dmask:0x1 dim:SQ_RSRC_IMG_2D
261; GFX10-NEXT:    s_addk_i32 s32, 0x400
262; GFX10-NEXT:    s_waitcnt_depctr 0xffe3
263; GFX10-NEXT:    s_getpc_b64 s[4:5]
264; GFX10-NEXT:    s_add_u32 s4, s4, extern_func@gotpcrel32@lo+4
265; GFX10-NEXT:    s_addc_u32 s5, s5, extern_func@gotpcrel32@hi+12
266; GFX10-NEXT:    v_writelane_b32 v40, s30, 0
267; GFX10-NEXT:    s_load_dwordx2 s[4:5], s[4:5], 0x0
268; GFX10-NEXT:    v_mov_b32_e32 v41, v16
269; GFX10-NEXT:    v_mov_b32_e32 v42, v15
270; GFX10-NEXT:    v_mov_b32_e32 v43, v14
271; GFX10-NEXT:    v_writelane_b32 v40, s31, 1
272; GFX10-NEXT:    v_mov_b32_e32 v44, v13
273; GFX10-NEXT:    v_mov_b32_e32 v45, v12
274; GFX10-NEXT:    s_waitcnt vmcnt(0)
275; GFX10-NEXT:    global_store_dwordx4 v[0:1], v[0:3], off
276; GFX10-NEXT:    s_waitcnt lgkmcnt(0)
277; GFX10-NEXT:    s_swappc_b64 s[30:31], s[4:5]
278; GFX10-NEXT:    image_gather4_c_b_cl v[0:3], [v45, v44, v43, v42, v41], s[4:11], s[4:7] dmask:0x1 dim:SQ_RSRC_IMG_2D
279; GFX10-NEXT:    s_clause 0x4
280; GFX10-NEXT:    buffer_load_dword v45, off, s[0:3], s33
281; GFX10-NEXT:    buffer_load_dword v44, off, s[0:3], s33 offset:4
282; GFX10-NEXT:    buffer_load_dword v43, off, s[0:3], s33 offset:8
283; GFX10-NEXT:    buffer_load_dword v42, off, s[0:3], s33 offset:12
284; GFX10-NEXT:    buffer_load_dword v41, off, s[0:3], s33 offset:16
285; GFX10-NEXT:    v_readlane_b32 s31, v40, 1
286; GFX10-NEXT:    v_readlane_b32 s30, v40, 0
287; GFX10-NEXT:    s_addk_i32 s32, 0xfc00
288; GFX10-NEXT:    v_readlane_b32 s33, v40, 2
289; GFX10-NEXT:    s_or_saveexec_b32 s4, -1
290; GFX10-NEXT:    buffer_load_dword v40, off, s[0:3], s32 offset:20 ; 4-byte Folded Reload
291; GFX10-NEXT:    s_waitcnt_depctr 0xffe3
292; GFX10-NEXT:    s_mov_b32 exec_lo, s4
293; GFX10-NEXT:    s_waitcnt vmcnt(0)
294; GFX10-NEXT:    s_setpc_b64 s[30:31]
295;
296; GFX11-LABEL: call_preserved_vgpr_tuple8:
297; GFX11:       ; %bb.0: ; %main_body
298; GFX11-NEXT:    s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
299; GFX11-NEXT:    s_waitcnt_vscnt null, 0x0
300; GFX11-NEXT:    s_or_saveexec_b32 s0, -1
301; GFX11-NEXT:    scratch_store_b32 off, v40, s32 offset:20 ; 4-byte Folded Spill
302; GFX11-NEXT:    s_mov_b32 exec_lo, s0
303; GFX11-NEXT:    v_writelane_b32 v40, s33, 2
304; GFX11-NEXT:    s_mov_b32 s33, s32
305; GFX11-NEXT:    s_clause 0x4
306; GFX11-NEXT:    scratch_store_b32 off, v41, s33 offset:16
307; GFX11-NEXT:    scratch_store_b32 off, v42, s33 offset:12
308; GFX11-NEXT:    scratch_store_b32 off, v43, s33 offset:8
309; GFX11-NEXT:    scratch_store_b32 off, v44, s33 offset:4
310; GFX11-NEXT:    scratch_store_b32 off, v45, s33
311; GFX11-NEXT:    image_gather4_c_b_cl v[0:3], v[12:16], s[0:7], s[0:3] dmask:0x1 dim:SQ_RSRC_IMG_2D
312; GFX11-NEXT:    s_add_i32 s32, s32, 32
313; GFX11-NEXT:    s_getpc_b64 s[0:1]
314; GFX11-NEXT:    s_add_u32 s0, s0, extern_func@gotpcrel32@lo+4
315; GFX11-NEXT:    s_addc_u32 s1, s1, extern_func@gotpcrel32@hi+12
316; GFX11-NEXT:    v_writelane_b32 v40, s30, 0
317; GFX11-NEXT:    s_load_b64 s[0:1], s[0:1], 0x0
318; GFX11-NEXT:    v_dual_mov_b32 v41, v16 :: v_dual_mov_b32 v42, v15
319; GFX11-NEXT:    v_dual_mov_b32 v43, v14 :: v_dual_mov_b32 v44, v13
320; GFX11-NEXT:    v_writelane_b32 v40, s31, 1
321; GFX11-NEXT:    v_mov_b32_e32 v45, v12
322; GFX11-NEXT:    s_waitcnt vmcnt(0)
323; GFX11-NEXT:    global_store_b128 v[0:1], v[0:3], off
324; GFX11-NEXT:    s_waitcnt lgkmcnt(0)
325; GFX11-NEXT:    s_swappc_b64 s[30:31], s[0:1]
326; GFX11-NEXT:    image_gather4_c_b_cl v[0:3], [v45, v44, v43, v42, v41], s[0:7], s[0:3] dmask:0x1 dim:SQ_RSRC_IMG_2D
327; GFX11-NEXT:    s_clause 0x4
328; GFX11-NEXT:    scratch_load_b32 v45, off, s33
329; GFX11-NEXT:    scratch_load_b32 v44, off, s33 offset:4
330; GFX11-NEXT:    scratch_load_b32 v43, off, s33 offset:8
331; GFX11-NEXT:    scratch_load_b32 v42, off, s33 offset:12
332; GFX11-NEXT:    scratch_load_b32 v41, off, s33 offset:16
333; GFX11-NEXT:    v_readlane_b32 s31, v40, 1
334; GFX11-NEXT:    v_readlane_b32 s30, v40, 0
335; GFX11-NEXT:    s_addk_i32 s32, 0xffe0
336; GFX11-NEXT:    v_readlane_b32 s33, v40, 2
337; GFX11-NEXT:    s_or_saveexec_b32 s0, -1
338; GFX11-NEXT:    scratch_load_b32 v40, off, s32 offset:20 ; 4-byte Folded Reload
339; GFX11-NEXT:    s_mov_b32 exec_lo, s0
340; GFX11-NEXT:    s_waitcnt vmcnt(0)
341; GFX11-NEXT:    s_setpc_b64 s[30:31]
342
343
344
345
346
347
348
349main_body:
350  %v = call <4 x float> @llvm.amdgcn.image.gather4.c.b.cl.2d.v4f32.f32.f32(i32 1, float %bias, float %zcompare, float %s, float %t, float %clamp, <8 x i32> undef, <4 x i32> undef, i1 false, i32 0, i32 0)
351  store <4 x float> %v, <4 x float> addrspace(1)* undef
352  call void @extern_func()
353  %v1 = call <4 x float> @llvm.amdgcn.image.gather4.c.b.cl.2d.v4f32.f32.f32(i32 1, float %bias, float %zcompare, float %s, float %t, float %clamp, <8 x i32> undef, <4 x i32> undef, i1 false, i32 0, i32 0)
354  ret <4 x float> %v1
355}
356
357declare <4 x float> @llvm.amdgcn.image.gather4.c.b.cl.2d.v4f32.f32.f32(i32 immarg, float, float, float, float, float, <8 x i32>, <4 x i32>, i1 immarg, i32 immarg, i32 immarg) #1
358
359attributes #0 = { nounwind writeonly }
360attributes #1 = { nounwind readonly }
361attributes #2 = { "amdgpu-no-dispatch-id" "amdgpu-no-dispatch-ptr" "amdgpu-no-implicitarg-ptr" "amdgpu-no-queue-ptr" "amdgpu-no-workgroup-id-x" "amdgpu-no-workgroup-id-y" "amdgpu-no-workgroup-id-z" "amdgpu-no-workitem-id-x" "amdgpu-no-workitem-id-y" "amdgpu-no-workitem-id-z" }
362