1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -global-isel -mtriple=amdgcn-mesa-mesa3d -mcpu=tahiti -verify-machineinstrs < %s | FileCheck -check-prefix=GFX6 %s
3 ; RUN: llc -global-isel -mtriple=amdgcn-mesa-mesa3d -mcpu=gfx1010 -verify-machineinstrs < %s | FileCheck -check-prefixes=GFX10PLUS,GFX10 %s
4 ; RUN: llc -global-isel -mtriple=amdgcn-mesa-mesa3d -mcpu=gfx1100 -verify-machineinstrs < %s | FileCheck -check-prefixes=GFX10PLUS,GFX11 %s
6 define amdgpu_ps <4 x float> @load_3d_v4f32_xyzw(<8 x i32> inreg %rsrc, i32 %s, i32 %t, i32 %r) {
7 ; GFX6-LABEL: load_3d_v4f32_xyzw:
9 ; GFX6-NEXT: s_mov_b32 s0, s2
10 ; GFX6-NEXT: s_mov_b32 s1, s3
11 ; GFX6-NEXT: s_mov_b32 s2, s4
12 ; GFX6-NEXT: s_mov_b32 s3, s5
13 ; GFX6-NEXT: s_mov_b32 s4, s6
14 ; GFX6-NEXT: s_mov_b32 s5, s7
15 ; GFX6-NEXT: s_mov_b32 s6, s8
16 ; GFX6-NEXT: s_mov_b32 s7, s9
17 ; GFX6-NEXT: image_load v[0:3], v[0:2], s[0:7] dmask:0xf unorm
18 ; GFX6-NEXT: s_waitcnt vmcnt(0)
19 ; GFX6-NEXT: ; return to shader part epilog
21 ; GFX10PLUS-LABEL: load_3d_v4f32_xyzw:
23 ; GFX10PLUS-NEXT: s_mov_b32 s0, s2
24 ; GFX10PLUS-NEXT: s_mov_b32 s1, s3
25 ; GFX10PLUS-NEXT: s_mov_b32 s2, s4
26 ; GFX10PLUS-NEXT: s_mov_b32 s3, s5
27 ; GFX10PLUS-NEXT: s_mov_b32 s4, s6
28 ; GFX10PLUS-NEXT: s_mov_b32 s5, s7
29 ; GFX10PLUS-NEXT: s_mov_b32 s6, s8
30 ; GFX10PLUS-NEXT: s_mov_b32 s7, s9
31 ; GFX10PLUS-NEXT: image_load v[0:3], v[0:2], s[0:7] dmask:0xf dim:SQ_RSRC_IMG_3D unorm
32 ; GFX10PLUS-NEXT: s_waitcnt vmcnt(0)
33 ; GFX10PLUS-NEXT: ; return to shader part epilog
34 %v = call <4 x float> @llvm.amdgcn.image.load.3d.v4f32.i32(i32 15, i32 %s, i32 %t, i32 %r, <8 x i32> %rsrc, i32 0, i32 0)
38 define amdgpu_ps <4 x float> @load_3d_v4f32_xyzw_tfe(<8 x i32> inreg %rsrc, ptr addrspace(1) inreg %out, i32 %s, i32 %t, i32 %r) {
39 ; GFX6-LABEL: load_3d_v4f32_xyzw_tfe:
41 ; GFX6-NEXT: v_mov_b32_e32 v5, v0
42 ; GFX6-NEXT: v_mov_b32_e32 v0, 0
43 ; GFX6-NEXT: s_mov_b32 s0, s2
44 ; GFX6-NEXT: s_mov_b32 s1, s3
45 ; GFX6-NEXT: s_mov_b32 s2, s4
46 ; GFX6-NEXT: s_mov_b32 s3, s5
47 ; GFX6-NEXT: s_mov_b32 s4, s6
48 ; GFX6-NEXT: s_mov_b32 s5, s7
49 ; GFX6-NEXT: s_mov_b32 s6, s8
50 ; GFX6-NEXT: s_mov_b32 s7, s9
51 ; GFX6-NEXT: v_mov_b32_e32 v6, v1
52 ; GFX6-NEXT: v_mov_b32_e32 v7, v2
53 ; GFX6-NEXT: v_mov_b32_e32 v1, v0
54 ; GFX6-NEXT: v_mov_b32_e32 v2, v0
55 ; GFX6-NEXT: v_mov_b32_e32 v3, v0
56 ; GFX6-NEXT: v_mov_b32_e32 v4, v0
57 ; GFX6-NEXT: image_load v[0:4], v[5:7], s[0:7] dmask:0xf unorm tfe
58 ; GFX6-NEXT: s_mov_b32 s8, s10
59 ; GFX6-NEXT: s_mov_b32 s9, s11
60 ; GFX6-NEXT: s_mov_b32 s10, -1
61 ; GFX6-NEXT: s_mov_b32 s11, 0xf000
62 ; GFX6-NEXT: s_waitcnt vmcnt(0)
63 ; GFX6-NEXT: buffer_store_dword v4, off, s[8:11], 0
64 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0)
65 ; GFX6-NEXT: ; return to shader part epilog
67 ; GFX10-LABEL: load_3d_v4f32_xyzw_tfe:
69 ; GFX10-NEXT: v_mov_b32_e32 v8, 0
70 ; GFX10-NEXT: v_mov_b32_e32 v5, v0
71 ; GFX10-NEXT: v_mov_b32_e32 v6, v1
72 ; GFX10-NEXT: v_mov_b32_e32 v7, v2
73 ; GFX10-NEXT: s_mov_b32 s0, s2
74 ; GFX10-NEXT: v_mov_b32_e32 v9, v8
75 ; GFX10-NEXT: v_mov_b32_e32 v10, v8
76 ; GFX10-NEXT: v_mov_b32_e32 v11, v8
77 ; GFX10-NEXT: v_mov_b32_e32 v12, v8
78 ; GFX10-NEXT: s_mov_b32 s1, s3
79 ; GFX10-NEXT: s_mov_b32 s2, s4
80 ; GFX10-NEXT: s_mov_b32 s3, s5
81 ; GFX10-NEXT: s_mov_b32 s4, s6
82 ; GFX10-NEXT: s_mov_b32 s5, s7
83 ; GFX10-NEXT: s_mov_b32 s6, s8
84 ; GFX10-NEXT: s_mov_b32 s7, s9
85 ; GFX10-NEXT: v_mov_b32_e32 v0, v8
86 ; GFX10-NEXT: v_mov_b32_e32 v1, v9
87 ; GFX10-NEXT: v_mov_b32_e32 v2, v10
88 ; GFX10-NEXT: v_mov_b32_e32 v3, v11
89 ; GFX10-NEXT: v_mov_b32_e32 v4, v12
90 ; GFX10-NEXT: image_load v[0:4], v[5:7], s[0:7] dmask:0xf dim:SQ_RSRC_IMG_3D unorm tfe
91 ; GFX10-NEXT: s_waitcnt vmcnt(0)
92 ; GFX10-NEXT: global_store_dword v8, v4, s[10:11]
93 ; GFX10-NEXT: ; return to shader part epilog
95 ; GFX11-LABEL: load_3d_v4f32_xyzw_tfe:
97 ; GFX11-NEXT: v_dual_mov_b32 v7, v2 :: v_dual_mov_b32 v8, 0
98 ; GFX11-NEXT: v_dual_mov_b32 v5, v0 :: v_dual_mov_b32 v6, v1
99 ; GFX11-NEXT: s_mov_b32 s0, s2
100 ; GFX11-NEXT: s_mov_b32 s1, s3
101 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2)
102 ; GFX11-NEXT: v_mov_b32_e32 v9, v8
103 ; GFX11-NEXT: v_mov_b32_e32 v10, v8
104 ; GFX11-NEXT: v_mov_b32_e32 v11, v8
105 ; GFX11-NEXT: v_mov_b32_e32 v12, v8
106 ; GFX11-NEXT: s_mov_b32 s2, s4
107 ; GFX11-NEXT: s_mov_b32 s3, s5
108 ; GFX11-NEXT: s_mov_b32 s4, s6
109 ; GFX11-NEXT: s_mov_b32 s5, s7
110 ; GFX11-NEXT: s_mov_b32 s6, s8
111 ; GFX11-NEXT: s_mov_b32 s7, s9
112 ; GFX11-NEXT: v_dual_mov_b32 v0, v8 :: v_dual_mov_b32 v1, v9
113 ; GFX11-NEXT: v_dual_mov_b32 v2, v10 :: v_dual_mov_b32 v3, v11
114 ; GFX11-NEXT: v_mov_b32_e32 v4, v12
115 ; GFX11-NEXT: image_load v[0:4], v[5:7], s[0:7] dmask:0xf dim:SQ_RSRC_IMG_3D unorm tfe
116 ; GFX11-NEXT: s_waitcnt vmcnt(0)
117 ; GFX11-NEXT: global_store_b32 v8, v4, s[10:11]
118 ; GFX11-NEXT: ; return to shader part epilog
119 %v = call { <4 x float>, i32 } @llvm.amdgcn.image.load.3d.sl_v4f32i32s.i32(i32 15, i32 %s, i32 %t, i32 %r, <8 x i32> %rsrc, i32 1, i32 0)
120 %v.vec = extractvalue { <4 x float>, i32 } %v, 0
121 %v.err = extractvalue { <4 x float>, i32 } %v, 1
122 store i32 %v.err, ptr addrspace(1) %out, align 4
123 ret <4 x float> %v.vec
126 define amdgpu_ps <4 x float> @load_3d_v4f32_xyzw_tfe_lwe(<8 x i32> inreg %rsrc, ptr addrspace(1) inreg %out, i32 %s, i32 %t, i32 %r) {
127 ; GFX6-LABEL: load_3d_v4f32_xyzw_tfe_lwe:
129 ; GFX6-NEXT: v_mov_b32_e32 v5, v0
130 ; GFX6-NEXT: v_mov_b32_e32 v0, 0
131 ; GFX6-NEXT: s_mov_b32 s0, s2
132 ; GFX6-NEXT: s_mov_b32 s1, s3
133 ; GFX6-NEXT: s_mov_b32 s2, s4
134 ; GFX6-NEXT: s_mov_b32 s3, s5
135 ; GFX6-NEXT: s_mov_b32 s4, s6
136 ; GFX6-NEXT: s_mov_b32 s5, s7
137 ; GFX6-NEXT: s_mov_b32 s6, s8
138 ; GFX6-NEXT: s_mov_b32 s7, s9
139 ; GFX6-NEXT: v_mov_b32_e32 v6, v1
140 ; GFX6-NEXT: v_mov_b32_e32 v7, v2
141 ; GFX6-NEXT: v_mov_b32_e32 v1, v0
142 ; GFX6-NEXT: v_mov_b32_e32 v2, v0
143 ; GFX6-NEXT: v_mov_b32_e32 v3, v0
144 ; GFX6-NEXT: v_mov_b32_e32 v4, v0
145 ; GFX6-NEXT: image_load v[0:4], v[5:7], s[0:7] dmask:0xf unorm tfe lwe
146 ; GFX6-NEXT: s_mov_b32 s8, s10
147 ; GFX6-NEXT: s_mov_b32 s9, s11
148 ; GFX6-NEXT: s_mov_b32 s10, -1
149 ; GFX6-NEXT: s_mov_b32 s11, 0xf000
150 ; GFX6-NEXT: s_waitcnt vmcnt(0)
151 ; GFX6-NEXT: buffer_store_dword v4, off, s[8:11], 0
152 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0)
153 ; GFX6-NEXT: ; return to shader part epilog
155 ; GFX10-LABEL: load_3d_v4f32_xyzw_tfe_lwe:
157 ; GFX10-NEXT: v_mov_b32_e32 v8, 0
158 ; GFX10-NEXT: v_mov_b32_e32 v5, v0
159 ; GFX10-NEXT: v_mov_b32_e32 v6, v1
160 ; GFX10-NEXT: v_mov_b32_e32 v7, v2
161 ; GFX10-NEXT: s_mov_b32 s0, s2
162 ; GFX10-NEXT: v_mov_b32_e32 v9, v8
163 ; GFX10-NEXT: v_mov_b32_e32 v10, v8
164 ; GFX10-NEXT: v_mov_b32_e32 v11, v8
165 ; GFX10-NEXT: v_mov_b32_e32 v12, v8
166 ; GFX10-NEXT: s_mov_b32 s1, s3
167 ; GFX10-NEXT: s_mov_b32 s2, s4
168 ; GFX10-NEXT: s_mov_b32 s3, s5
169 ; GFX10-NEXT: s_mov_b32 s4, s6
170 ; GFX10-NEXT: s_mov_b32 s5, s7
171 ; GFX10-NEXT: s_mov_b32 s6, s8
172 ; GFX10-NEXT: s_mov_b32 s7, s9
173 ; GFX10-NEXT: v_mov_b32_e32 v0, v8
174 ; GFX10-NEXT: v_mov_b32_e32 v1, v9
175 ; GFX10-NEXT: v_mov_b32_e32 v2, v10
176 ; GFX10-NEXT: v_mov_b32_e32 v3, v11
177 ; GFX10-NEXT: v_mov_b32_e32 v4, v12
178 ; GFX10-NEXT: image_load v[0:4], v[5:7], s[0:7] dmask:0xf dim:SQ_RSRC_IMG_3D unorm tfe lwe
179 ; GFX10-NEXT: s_waitcnt vmcnt(0)
180 ; GFX10-NEXT: global_store_dword v8, v4, s[10:11]
181 ; GFX10-NEXT: ; return to shader part epilog
183 ; GFX11-LABEL: load_3d_v4f32_xyzw_tfe_lwe:
185 ; GFX11-NEXT: v_dual_mov_b32 v7, v2 :: v_dual_mov_b32 v8, 0
186 ; GFX11-NEXT: v_dual_mov_b32 v5, v0 :: v_dual_mov_b32 v6, v1
187 ; GFX11-NEXT: s_mov_b32 s0, s2
188 ; GFX11-NEXT: s_mov_b32 s1, s3
189 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2)
190 ; GFX11-NEXT: v_mov_b32_e32 v9, v8
191 ; GFX11-NEXT: v_mov_b32_e32 v10, v8
192 ; GFX11-NEXT: v_mov_b32_e32 v11, v8
193 ; GFX11-NEXT: v_mov_b32_e32 v12, v8
194 ; GFX11-NEXT: s_mov_b32 s2, s4
195 ; GFX11-NEXT: s_mov_b32 s3, s5
196 ; GFX11-NEXT: s_mov_b32 s4, s6
197 ; GFX11-NEXT: s_mov_b32 s5, s7
198 ; GFX11-NEXT: s_mov_b32 s6, s8
199 ; GFX11-NEXT: s_mov_b32 s7, s9
200 ; GFX11-NEXT: v_dual_mov_b32 v0, v8 :: v_dual_mov_b32 v1, v9
201 ; GFX11-NEXT: v_dual_mov_b32 v2, v10 :: v_dual_mov_b32 v3, v11
202 ; GFX11-NEXT: v_mov_b32_e32 v4, v12
203 ; GFX11-NEXT: image_load v[0:4], v[5:7], s[0:7] dmask:0xf dim:SQ_RSRC_IMG_3D unorm tfe lwe
204 ; GFX11-NEXT: s_waitcnt vmcnt(0)
205 ; GFX11-NEXT: global_store_b32 v8, v4, s[10:11]
206 ; GFX11-NEXT: ; return to shader part epilog
207 %v = call { <4 x float>, i32 } @llvm.amdgcn.image.load.3d.sl_v4f32i32s.i32(i32 15, i32 %s, i32 %t, i32 %r, <8 x i32> %rsrc, i32 3, i32 0)
208 %v.vec = extractvalue { <4 x float>, i32 } %v, 0
209 %v.err = extractvalue { <4 x float>, i32 } %v, 1
210 store i32 %v.err, ptr addrspace(1) %out, align 4
211 ret <4 x float> %v.vec
214 declare <4 x float> @llvm.amdgcn.image.load.3d.v4f32.i32(i32 immarg, i32, i32, i32, <8 x i32>, i32 immarg, i32 immarg) #0
215 declare { <4 x float>, i32 } @llvm.amdgcn.image.load.3d.sl_v4f32i32s.i32(i32 immarg, i32, i32, i32, <8 x i32>, i32 immarg, i32 immarg) #0
217 attributes #0 = { nounwind readonly }