1 ; RUN: llc -mtriple=r600 -mcpu=juniper < %s | FileCheck -check-prefix=EG -check-prefix=FUNC %s
3 ; === 1 image arg, read_only ===================================================
5 ; FUNC-LABEL: {{^}}test_2d_rd_1_0:
6 ; EG: MEM_RAT_CACHELESS STORE_RAW [[VAL:T[0-9]+\.X]]
7 ; EG: MOV [[VAL]], literal.x
10 define amdgpu_kernel void @test_2d_rd_1_0(ptr addrspace(1) %in, ; read_only
11 ptr addrspace(1) %out) {
13 %0 = call i32 @llvm.OpenCL.image.get.resource.id.2d(
14 ptr addrspace(1) %in) #0
15 store i32 %0, ptr addrspace(1) %out
19 ; FUNC-LABEL: {{^}}test_3d_rd_1_0:
20 ; EG: MEM_RAT_CACHELESS STORE_RAW [[VAL:T[0-9]+\.X]]
21 ; EG: MOV [[VAL]], literal.x
24 define amdgpu_kernel void @test_3d_rd_1_0(ptr addrspace(1) %in, ; read_only
25 ptr addrspace(1) %out) {
27 %0 = call i32 @llvm.OpenCL.image.get.resource.id.3d(
28 ptr addrspace(1) %in) #0
29 store i32 %0, ptr addrspace(1) %out
33 ; === 1 image arg, write_only ==================================================
35 ; FUNC-LABEL: {{^}}test_2d_wr_1_0:
36 ; EG: MEM_RAT_CACHELESS STORE_RAW [[VAL:T[0-9]+\.X]]
37 ; EG: MOV [[VAL]], literal.x
40 define amdgpu_kernel void @test_2d_wr_1_0(ptr addrspace(1) %in, ; write_only
41 ptr addrspace(1) %out) {
43 %0 = call i32 @llvm.OpenCL.image.get.resource.id.2d(
44 ptr addrspace(1) %in) #0
45 store i32 %0, ptr addrspace(1) %out
49 ; FUNC-LABEL: {{^}}test_3d_wr_1_0:
50 ; EG: MEM_RAT_CACHELESS STORE_RAW [[VAL:T[0-9]+\.X]]
51 ; EG: MOV [[VAL]], literal.x
54 define amdgpu_kernel void @test_3d_wr_1_0(ptr addrspace(1) %in, ; write_only
55 ptr addrspace(1) %out) {
57 %0 = call i32 @llvm.OpenCL.image.get.resource.id.3d(
58 ptr addrspace(1) %in) #0
59 store i32 %0, ptr addrspace(1) %out
63 ; === 2 image args, read_only ==================================================
65 ; FUNC-LABEL: {{^}}test_2d_rd_2_0:
66 ; EG: MEM_RAT_CACHELESS STORE_RAW [[VAL:T[0-9]+\.X]]
67 ; EG: MOV [[VAL]], literal.x
70 define amdgpu_kernel void @test_2d_rd_2_0(ptr addrspace(1) %in1, ; read_only
71 ptr addrspace(1) %in2, ; read_only
72 ptr addrspace(1) %out) {
74 %0 = call i32 @llvm.OpenCL.image.get.resource.id.2d(
75 ptr addrspace(1) %in1) #0
76 store i32 %0, ptr addrspace(1) %out
80 ; FUNC-LABEL: {{^}}test_2d_rd_2_1:
81 ; EG: MEM_RAT_CACHELESS STORE_RAW [[VAL:T[0-9]+\.X]]
82 ; EG: MOV [[VAL]], literal.x
85 define amdgpu_kernel void @test_2d_rd_2_1(ptr addrspace(1) %in1, ; read_only
86 ptr addrspace(1) %in2, ; read_only
87 ptr addrspace(1) %out) {
89 %0 = call i32 @llvm.OpenCL.image.get.resource.id.2d(
90 ptr addrspace(1) %in2) #0
91 store i32 %0, ptr addrspace(1) %out
95 ; FUNC-LABEL: {{^}}test_3d_rd_2_0:
96 ; EG: MEM_RAT_CACHELESS STORE_RAW [[VAL:T[0-9]+\.X]]
97 ; EG: MOV [[VAL]], literal.x
100 define amdgpu_kernel void @test_3d_rd_2_0(ptr addrspace(1) %in1, ; read_only
101 ptr addrspace(1) %in2, ; read_only
102 ptr addrspace(1) %out) {
104 %0 = call i32 @llvm.OpenCL.image.get.resource.id.3d(
105 ptr addrspace(1) %in1) #0
106 store i32 %0, ptr addrspace(1) %out
110 ; FUNC-LABEL: {{^}}test_3d_rd_2_1:
111 ; EG: MEM_RAT_CACHELESS STORE_RAW [[VAL:T[0-9]+\.X]]
112 ; EG: MOV [[VAL]], literal.x
115 define amdgpu_kernel void @test_3d_rd_2_1(ptr addrspace(1) %in1, ; read_only
116 ptr addrspace(1) %in2, ; read_only
117 ptr addrspace(1) %out) {
119 %0 = call i32 @llvm.OpenCL.image.get.resource.id.3d(
120 ptr addrspace(1) %in2) #0
121 store i32 %0, ptr addrspace(1) %out
125 ; === 2 image args, write_only =================================================
127 ; FUNC-LABEL: {{^}}test_2d_wr_2_0:
128 ; EG: MEM_RAT_CACHELESS STORE_RAW [[VAL:T[0-9]+\.X]]
129 ; EG: MOV [[VAL]], literal.x
132 define amdgpu_kernel void @test_2d_wr_2_0(ptr addrspace(1) %in1, ; write_only
133 ptr addrspace(1) %in2, ; write_only
134 ptr addrspace(1) %out) {
136 %0 = call i32 @llvm.OpenCL.image.get.resource.id.2d(
137 ptr addrspace(1) %in1) #0
138 store i32 %0, ptr addrspace(1) %out
142 ; FUNC-LABEL: {{^}}test_2d_wr_2_1:
143 ; EG: MEM_RAT_CACHELESS STORE_RAW [[VAL:T[0-9]+\.X]]
144 ; EG: MOV [[VAL]], literal.x
147 define amdgpu_kernel void @test_2d_wr_2_1(ptr addrspace(1) %in1, ; write_only
148 ptr addrspace(1) %in2, ; write_only
149 ptr addrspace(1) %out) {
151 %0 = call i32 @llvm.OpenCL.image.get.resource.id.2d(
152 ptr addrspace(1) %in2) #0
153 store i32 %0, ptr addrspace(1) %out
157 ; FUNC-LABEL: {{^}}test_3d_wr_2_0:
158 ; EG: MEM_RAT_CACHELESS STORE_RAW [[VAL:T[0-9]+\.X]]
159 ; EG: MOV [[VAL]], literal.x
162 define amdgpu_kernel void @test_3d_wr_2_0(ptr addrspace(1) %in1, ; write_only
163 ptr addrspace(1) %in2, ; write_only
164 ptr addrspace(1) %out) {
166 %0 = call i32 @llvm.OpenCL.image.get.resource.id.3d(
167 ptr addrspace(1) %in1) #0
168 store i32 %0, ptr addrspace(1) %out
172 ; FUNC-LABEL: {{^}}test_3d_wr_2_1:
173 ; EG: MEM_RAT_CACHELESS STORE_RAW [[VAL:T[0-9]+\.X]]
174 ; EG: MOV [[VAL]], literal.x
177 define amdgpu_kernel void @test_3d_wr_2_1(ptr addrspace(1) %in1, ; write_only
178 ptr addrspace(1) %in2, ; write_only
179 ptr addrspace(1) %out) {
181 %0 = call i32 @llvm.OpenCL.image.get.resource.id.3d(
182 ptr addrspace(1) %in2) #0
183 store i32 %0, ptr addrspace(1) %out
187 ; === 3 image args, read_only ==================================================
189 ; FUNC-LABEL: {{^}}test_2d_rd_3_0:
190 ; EG: MEM_RAT_CACHELESS STORE_RAW [[VAL:T[0-9]+\.X]]
191 ; EG: MOV [[VAL]], literal.x
194 define amdgpu_kernel void @test_2d_rd_3_0(ptr addrspace(1) %in1, ; read_only
195 ptr addrspace(1) %in2, ; read_only
196 ptr addrspace(1) %in3, ; read_only
197 ptr addrspace(1) %out) {
199 %0 = call i32 @llvm.OpenCL.image.get.resource.id.2d(
200 ptr addrspace(1) %in3) #0
201 store i32 %0, ptr addrspace(1) %out
206 ; FUNC-LABEL: {{^}}test_3d_rd_3_0:
207 ; EG: MEM_RAT_CACHELESS STORE_RAW [[VAL:T[0-9]+\.X]]
208 ; EG: MOV [[VAL]], literal.x
211 define amdgpu_kernel void @test_3d_rd_3_0(ptr addrspace(1) %in1, ; read_only
212 ptr addrspace(1) %in2, ; read_only
213 ptr addrspace(1) %in3, ; read_only
214 ptr addrspace(1) %out) {
216 %0 = call i32 @llvm.OpenCL.image.get.resource.id.3d(
217 ptr addrspace(1) %in3) #0
218 store i32 %0, ptr addrspace(1) %out
222 ; === 3 image args, write_only =================================================
224 ; FUNC-LABEL: {{^}}test_2d_wr_3_0:
225 ; EG: MEM_RAT_CACHELESS STORE_RAW [[VAL:T[0-9]+\.X]]
226 ; EG: MOV [[VAL]], literal.x
229 define amdgpu_kernel void @test_2d_wr_3_0(ptr addrspace(1) %in1, ; write_only
230 ptr addrspace(1) %in2, ; write_only
231 ptr addrspace(1) %in3, ; write_only
232 ptr addrspace(1) %out) {
234 %0 = call i32 @llvm.OpenCL.image.get.resource.id.2d(
235 ptr addrspace(1) %in3) #0
236 store i32 %0, ptr addrspace(1) %out
241 ; FUNC-LABEL: {{^}}test_3d_wr_3_0:
242 ; EG: MEM_RAT_CACHELESS STORE_RAW [[VAL:T[0-9]+\.X]]
243 ; EG: MOV [[VAL]], literal.x
246 define amdgpu_kernel void @test_3d_wr_3_0(ptr addrspace(1) %in1, ; write_only
247 ptr addrspace(1) %in2, ; write_only
248 ptr addrspace(1) %in3, ; write_only
249 ptr addrspace(1) %out) {
251 %0 = call i32 @llvm.OpenCL.image.get.resource.id.3d(
252 ptr addrspace(1) %in3) #0
253 store i32 %0, ptr addrspace(1) %out
257 ; === 3 image args, mixed ======================================================
259 ; FUNC-LABEL: {{^}}test_2d_mix_3_0:
260 ; EG: MEM_RAT_CACHELESS STORE_RAW [[VAL:T[0-9]+\.X]]
261 ; EG: MOV [[VAL]], literal.x
264 define amdgpu_kernel void @test_2d_mix_3_0(ptr addrspace(1) %in1, ; write_only
265 ptr addrspace(1) %in2, ; read_only
266 ptr addrspace(1) %in3, ; read_only
267 ptr addrspace(1) %out) {
269 %0 = call i32 @llvm.OpenCL.image.get.resource.id.2d(
270 ptr addrspace(1) %in3) #0
271 store i32 %0, ptr addrspace(1) %out
275 ; FUNC-LABEL: {{^}}test_3d_mix_3_0:
276 ; EG: MEM_RAT_CACHELESS STORE_RAW [[VAL:T[0-9]+\.X]]
277 ; EG: MOV [[VAL]], literal.x
280 define amdgpu_kernel void @test_3d_mix_3_0(ptr addrspace(1) %in1, ; write_only
281 ptr addrspace(1) %in2, ; read_only
282 ptr addrspace(1) %in3, ; read_only
283 ptr addrspace(1) %out) {
285 %0 = call i32 @llvm.OpenCL.image.get.resource.id.3d(
286 ptr addrspace(1) %in3) #0
287 store i32 %0, ptr addrspace(1) %out
291 ; FUNC-LABEL: {{^}}test_2d_mix_3_1:
292 ; EG: MEM_RAT_CACHELESS STORE_RAW [[VAL:T[0-9]+\.X]]
293 ; EG: MOV [[VAL]], literal.x
296 define amdgpu_kernel void @test_2d_mix_3_1(ptr addrspace(1) %in1, ; write_only
297 ptr addrspace(1) %in2, ; read_only
298 ptr addrspace(1) %in3, ; write_only
299 ptr addrspace(1) %out) {
301 %0 = call i32 @llvm.OpenCL.image.get.resource.id.2d(
302 ptr addrspace(1) %in3) #0
303 store i32 %0, ptr addrspace(1) %out
307 ; FUNC-LABEL: {{^}}test_3d_mix_3_1:
308 ; EG: MEM_RAT_CACHELESS STORE_RAW [[VAL:T[0-9]+\.X]]
309 ; EG: MOV [[VAL]], literal.x
312 define amdgpu_kernel void @test_3d_mix_3_1(ptr addrspace(1) %in1, ; write_only
313 ptr addrspace(1) %in2, ; read_only
314 ptr addrspace(1) %in3, ; write_only
315 ptr addrspace(1) %out) {
317 %0 = call i32 @llvm.OpenCL.image.get.resource.id.3d(
318 ptr addrspace(1) %in3) #0
319 store i32 %0, ptr addrspace(1) %out
324 %opencl.image2d_t = type opaque
325 %opencl.image3d_t = type opaque
327 declare i32 @llvm.OpenCL.image.get.resource.id.2d(ptr addrspace(1)) #0
328 declare i32 @llvm.OpenCL.image.get.resource.id.3d(ptr addrspace(1)) #0
330 attributes #0 = { readnone }
332 !opencl.kernels = !{!0, !1, !2, !3, !4, !5, !6, !7, !8, !9, !10, !11, !12, !13,
333 !14, !15, !16, !17, !18, !19}
334 !0 = !{ptr @test_2d_rd_1_0,
335 !110, !120, !130, !140, !150}
336 !1 = !{ptr @test_3d_rd_1_0,
337 !110, !120, !131, !141, !150}
338 !2 = !{ptr @test_2d_wr_1_0,
339 !110, !121, !130, !140, !150}
340 !3 = !{ptr @test_3d_wr_1_0,
341 !110, !121, !131, !141, !150}
342 !110 = !{!"kernel_arg_addr_space", i32 1, i32 1}
343 !120 = !{!"kernel_arg_access_qual", !"read_only", !"none"}
344 !121 = !{!"kernel_arg_access_qual", !"write_only", !"none"}
345 !130 = !{!"kernel_arg_type", !"image2d_t", !"int*"}
346 !131 = !{!"kernel_arg_type", !"image3d_t", !"int*"}
347 !140 = !{!"kernel_arg_base_type", !"image2d_t", !"int*"}
348 !141 = !{!"kernel_arg_base_type", !"image3d_t", !"int*"}
349 !150 = !{!"kernel_arg_type_qual", !"", !""}
351 !4 = !{ptr @test_2d_rd_2_0, !112, !122, !132, !142, !152}
352 !5 = !{ptr @test_2d_rd_2_1, !112, !122, !132, !142, !152}
353 !6 = !{ptr @test_3d_rd_2_0, !112, !122, !133, !143, !152}
354 !7 = !{ptr @test_3d_rd_2_1, !112, !122, !133, !143, !152}
355 !8 = !{ptr @test_2d_wr_2_0, !112, !123, !132, !142, !152}
356 !9 = !{ptr @test_2d_wr_2_1, !112, !123, !132, !142, !152}
357 !10 = !{ptr @test_3d_wr_2_0, !112, !123, !133, !143, !152}
358 !11 = !{ptr @test_3d_wr_2_1, !112, !123, !133, !143, !152}
359 !112 = !{!"kernel_arg_addr_space", i32 1, i32 1, i32 1}
360 !122 = !{!"kernel_arg_access_qual", !"read_only", !"read_only", !"none"}
361 !123 = !{!"kernel_arg_access_qual", !"write_only", !"write_only", !"none"}
362 !132 = !{!"kernel_arg_type", !"image2d_t", !"image2d_t", !"int*"}
363 !133 = !{!"kernel_arg_type", !"image3d_t", !"image3d_t", !"int*"}
364 !142 = !{!"kernel_arg_base_type", !"image2d_t", !"image2d_t", !"int*"}
365 !143 = !{!"kernel_arg_base_type", !"image3d_t", !"image3d_t", !"int*"}
366 !152 = !{!"kernel_arg_type_qual", !"", !"", !""}
368 !12 = !{ptr @test_2d_rd_3_0,
369 !114, !124, !134, !144, !154}
370 !13 = !{ptr @test_3d_rd_3_0,
371 !114, !124, !135, !145, !154}
372 !14 = !{ptr @test_2d_wr_3_0,
373 !114, !125, !134, !144, !154}
374 !15 = !{ptr @test_3d_wr_3_0,
375 !114, !125, !135, !145, !154}
376 !16 = !{ptr @test_2d_mix_3_0,
377 !114, !126, !134, !144, !154}
378 !17 = !{ptr @test_3d_mix_3_0,
379 !114, !126, !135, !145, !154}
380 !18 = !{ptr @test_2d_mix_3_1,
381 !114, !127, !134, !144, !154}
382 !19 = !{ptr @test_3d_mix_3_1,
383 !114, !127, !135, !145, !154}
384 !114 = !{!"kernel_arg_addr_space", i32 1, i32 1, i32 1, i32 1}
385 !124 = !{!"kernel_arg_access_qual", !"read_only", !"read_only", !"read_only", !"none"}
386 !125 = !{!"kernel_arg_access_qual", !"write_only", !"write_only", !"write_only", !"none"}
387 !126 = !{!"kernel_arg_access_qual", !"write_only", !"read_only", !"read_only", !"none"}
388 !127 = !{!"kernel_arg_access_qual", !"write_only", !"read_only", !"write_only", !"none"}
389 !134 = !{!"kernel_arg_type", !"image2d_t", !"image3d_t", !"image2d_t", !"int*"}
390 !135 = !{!"kernel_arg_type", !"image3d_t", !"image2d_t", !"image3d_t", !"int*"}
391 !144 = !{!"kernel_arg_base_type", !"image2d_t", !"image3d_t", !"image2d_t", !"int*"}
392 !145 = !{!"kernel_arg_base_type", !"image3d_t", !"image2d_t", !"image3d_t", !"int*"}
393 !154 = !{!"kernel_arg_type_qual", !"", !"", !"", !""}