1 ; RUN: llc -march=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(%opencl.image2d_t addrspace(1)* %in, ; read_only
11 i32 addrspace(1)* %out) {
13 %0 = call i32 @llvm.OpenCL.image.get.resource.id.2d(
14 %opencl.image2d_t addrspace(1)* %in) #0
15 store i32 %0, i32 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(%opencl.image3d_t addrspace(1)* %in, ; read_only
25 i32 addrspace(1)* %out) {
27 %0 = call i32 @llvm.OpenCL.image.get.resource.id.3d(
28 %opencl.image3d_t addrspace(1)* %in) #0
29 store i32 %0, i32 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(%opencl.image2d_t addrspace(1)* %in, ; write_only
41 i32 addrspace(1)* %out) {
43 %0 = call i32 @llvm.OpenCL.image.get.resource.id.2d(
44 %opencl.image2d_t addrspace(1)* %in) #0
45 store i32 %0, i32 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(%opencl.image3d_t addrspace(1)* %in, ; write_only
55 i32 addrspace(1)* %out) {
57 %0 = call i32 @llvm.OpenCL.image.get.resource.id.3d(
58 %opencl.image3d_t addrspace(1)* %in) #0
59 store i32 %0, i32 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(%opencl.image2d_t addrspace(1)* %in1, ; read_only
71 %opencl.image2d_t addrspace(1)* %in2, ; read_only
72 i32 addrspace(1)* %out) {
74 %0 = call i32 @llvm.OpenCL.image.get.resource.id.2d(
75 %opencl.image2d_t addrspace(1)* %in1) #0
76 store i32 %0, i32 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(%opencl.image2d_t addrspace(1)* %in1, ; read_only
86 %opencl.image2d_t addrspace(1)* %in2, ; read_only
87 i32 addrspace(1)* %out) {
89 %0 = call i32 @llvm.OpenCL.image.get.resource.id.2d(
90 %opencl.image2d_t addrspace(1)* %in2) #0
91 store i32 %0, i32 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(%opencl.image3d_t addrspace(1)* %in1, ; read_only
101 %opencl.image3d_t addrspace(1)* %in2, ; read_only
102 i32 addrspace(1)* %out) {
104 %0 = call i32 @llvm.OpenCL.image.get.resource.id.3d(
105 %opencl.image3d_t addrspace(1)* %in1) #0
106 store i32 %0, i32 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(%opencl.image3d_t addrspace(1)* %in1, ; read_only
116 %opencl.image3d_t addrspace(1)* %in2, ; read_only
117 i32 addrspace(1)* %out) {
119 %0 = call i32 @llvm.OpenCL.image.get.resource.id.3d(
120 %opencl.image3d_t addrspace(1)* %in2) #0
121 store i32 %0, i32 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(%opencl.image2d_t addrspace(1)* %in1, ; write_only
133 %opencl.image2d_t addrspace(1)* %in2, ; write_only
134 i32 addrspace(1)* %out) {
136 %0 = call i32 @llvm.OpenCL.image.get.resource.id.2d(
137 %opencl.image2d_t addrspace(1)* %in1) #0
138 store i32 %0, i32 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(%opencl.image2d_t addrspace(1)* %in1, ; write_only
148 %opencl.image2d_t addrspace(1)* %in2, ; write_only
149 i32 addrspace(1)* %out) {
151 %0 = call i32 @llvm.OpenCL.image.get.resource.id.2d(
152 %opencl.image2d_t addrspace(1)* %in2) #0
153 store i32 %0, i32 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(%opencl.image3d_t addrspace(1)* %in1, ; write_only
163 %opencl.image3d_t addrspace(1)* %in2, ; write_only
164 i32 addrspace(1)* %out) {
166 %0 = call i32 @llvm.OpenCL.image.get.resource.id.3d(
167 %opencl.image3d_t addrspace(1)* %in1) #0
168 store i32 %0, i32 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(%opencl.image3d_t addrspace(1)* %in1, ; write_only
178 %opencl.image3d_t addrspace(1)* %in2, ; write_only
179 i32 addrspace(1)* %out) {
181 %0 = call i32 @llvm.OpenCL.image.get.resource.id.3d(
182 %opencl.image3d_t addrspace(1)* %in2) #0
183 store i32 %0, i32 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(%opencl.image2d_t addrspace(1)* %in1, ; read_only
195 %opencl.image3d_t addrspace(1)* %in2, ; read_only
196 %opencl.image2d_t addrspace(1)* %in3, ; read_only
197 i32 addrspace(1)* %out) {
199 %0 = call i32 @llvm.OpenCL.image.get.resource.id.2d(
200 %opencl.image2d_t addrspace(1)* %in3) #0
201 store i32 %0, i32 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(%opencl.image3d_t addrspace(1)* %in1, ; read_only
212 %opencl.image2d_t addrspace(1)* %in2, ; read_only
213 %opencl.image3d_t addrspace(1)* %in3, ; read_only
214 i32 addrspace(1)* %out) {
216 %0 = call i32 @llvm.OpenCL.image.get.resource.id.3d(
217 %opencl.image3d_t addrspace(1)* %in3) #0
218 store i32 %0, i32 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(%opencl.image2d_t addrspace(1)* %in1, ; write_only
230 %opencl.image3d_t addrspace(1)* %in2, ; write_only
231 %opencl.image2d_t addrspace(1)* %in3, ; write_only
232 i32 addrspace(1)* %out) {
234 %0 = call i32 @llvm.OpenCL.image.get.resource.id.2d(
235 %opencl.image2d_t addrspace(1)* %in3) #0
236 store i32 %0, i32 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(%opencl.image3d_t addrspace(1)* %in1, ; write_only
247 %opencl.image2d_t addrspace(1)* %in2, ; write_only
248 %opencl.image3d_t addrspace(1)* %in3, ; write_only
249 i32 addrspace(1)* %out) {
251 %0 = call i32 @llvm.OpenCL.image.get.resource.id.3d(
252 %opencl.image3d_t addrspace(1)* %in3) #0
253 store i32 %0, i32 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(%opencl.image2d_t addrspace(1)* %in1, ; write_only
265 %opencl.image3d_t addrspace(1)* %in2, ; read_only
266 %opencl.image2d_t addrspace(1)* %in3, ; read_only
267 i32 addrspace(1)* %out) {
269 %0 = call i32 @llvm.OpenCL.image.get.resource.id.2d(
270 %opencl.image2d_t addrspace(1)* %in3) #0
271 store i32 %0, i32 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(%opencl.image3d_t addrspace(1)* %in1, ; write_only
281 %opencl.image2d_t addrspace(1)* %in2, ; read_only
282 %opencl.image3d_t addrspace(1)* %in3, ; read_only
283 i32 addrspace(1)* %out) {
285 %0 = call i32 @llvm.OpenCL.image.get.resource.id.3d(
286 %opencl.image3d_t addrspace(1)* %in3) #0
287 store i32 %0, i32 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(%opencl.image2d_t addrspace(1)* %in1, ; write_only
297 %opencl.image3d_t addrspace(1)* %in2, ; read_only
298 %opencl.image2d_t addrspace(1)* %in3, ; write_only
299 i32 addrspace(1)* %out) {
301 %0 = call i32 @llvm.OpenCL.image.get.resource.id.2d(
302 %opencl.image2d_t addrspace(1)* %in3) #0
303 store i32 %0, i32 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(%opencl.image3d_t addrspace(1)* %in1, ; write_only
313 %opencl.image2d_t addrspace(1)* %in2, ; read_only
314 %opencl.image3d_t addrspace(1)* %in3, ; write_only
315 i32 addrspace(1)* %out) {
317 %0 = call i32 @llvm.OpenCL.image.get.resource.id.3d(
318 %opencl.image3d_t addrspace(1)* %in3) #0
319 store i32 %0, i32 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(%opencl.image2d_t addrspace(1)*) #0
328 declare i32 @llvm.OpenCL.image.get.resource.id.3d(%opencl.image3d_t 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 = !{void (%opencl.image2d_t addrspace(1)*, i32 addrspace(1)*)* @test_2d_rd_1_0,
335 !110, !120, !130, !140, !150}
336 !1 = !{void (%opencl.image3d_t addrspace(1)*, i32 addrspace(1)*)* @test_3d_rd_1_0,
337 !110, !120, !131, !141, !150}
338 !2 = !{void (%opencl.image2d_t addrspace(1)*, i32 addrspace(1)*)* @test_2d_wr_1_0,
339 !110, !121, !130, !140, !150}
340 !3 = !{void (%opencl.image3d_t addrspace(1)*, i32 addrspace(1)*)* @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 = !{void (%opencl.image2d_t addrspace(1)*, %opencl.image2d_t addrspace(1)*,
352 i32 addrspace(1)*)* @test_2d_rd_2_0, !112, !122, !132, !142, !152}
353 !5 = !{void (%opencl.image2d_t addrspace(1)*, %opencl.image2d_t addrspace(1)*,
354 i32 addrspace(1)*)* @test_2d_rd_2_1, !112, !122, !132, !142, !152}
355 !6 = !{void (%opencl.image3d_t addrspace(1)*, %opencl.image3d_t addrspace(1)*,
356 i32 addrspace(1)*)* @test_3d_rd_2_0, !112, !122, !133, !143, !152}
357 !7 = !{void (%opencl.image3d_t addrspace(1)*, %opencl.image3d_t addrspace(1)*,
358 i32 addrspace(1)*)* @test_3d_rd_2_1, !112, !122, !133, !143, !152}
359 !8 = !{void (%opencl.image2d_t addrspace(1)*, %opencl.image2d_t addrspace(1)*,
360 i32 addrspace(1)*)* @test_2d_wr_2_0, !112, !123, !132, !142, !152}
361 !9 = !{void (%opencl.image2d_t addrspace(1)*, %opencl.image2d_t addrspace(1)*,
362 i32 addrspace(1)*)* @test_2d_wr_2_1, !112, !123, !132, !142, !152}
363 !10 = !{void (%opencl.image3d_t addrspace(1)*, %opencl.image3d_t addrspace(1)*,
364 i32 addrspace(1)*)* @test_3d_wr_2_0, !112, !123, !133, !143, !152}
365 !11 = !{void (%opencl.image3d_t addrspace(1)*, %opencl.image3d_t addrspace(1)*,
366 i32 addrspace(1)*)* @test_3d_wr_2_1, !112, !123, !133, !143, !152}
367 !112 = !{!"kernel_arg_addr_space", i32 1, i32 1, i32 1}
368 !122 = !{!"kernel_arg_access_qual", !"read_only", !"read_only", !"none"}
369 !123 = !{!"kernel_arg_access_qual", !"write_only", !"write_only", !"none"}
370 !132 = !{!"kernel_arg_type", !"image2d_t", !"image2d_t", !"int*"}
371 !133 = !{!"kernel_arg_type", !"image3d_t", !"image3d_t", !"int*"}
372 !142 = !{!"kernel_arg_base_type", !"image2d_t", !"image2d_t", !"int*"}
373 !143 = !{!"kernel_arg_base_type", !"image3d_t", !"image3d_t", !"int*"}
374 !152 = !{!"kernel_arg_type_qual", !"", !"", !""}
376 !12 = !{void (%opencl.image2d_t addrspace(1)*, %opencl.image3d_t addrspace(1)*,
377 %opencl.image2d_t addrspace(1)*, i32 addrspace(1)*)* @test_2d_rd_3_0,
378 !114, !124, !134, !144, !154}
379 !13 = !{void (%opencl.image3d_t addrspace(1)*, %opencl.image2d_t addrspace(1)*,
380 %opencl.image3d_t addrspace(1)*, i32 addrspace(1)*)* @test_3d_rd_3_0,
381 !114, !124, !135, !145, !154}
382 !14 = !{void (%opencl.image2d_t addrspace(1)*, %opencl.image3d_t addrspace(1)*,
383 %opencl.image2d_t addrspace(1)*, i32 addrspace(1)*)* @test_2d_wr_3_0,
384 !114, !125, !134, !144, !154}
385 !15 = !{void (%opencl.image3d_t addrspace(1)*, %opencl.image2d_t addrspace(1)*,
386 %opencl.image3d_t addrspace(1)*, i32 addrspace(1)*)* @test_3d_wr_3_0,
387 !114, !125, !135, !145, !154}
388 !16 = !{void (%opencl.image2d_t addrspace(1)*, %opencl.image3d_t addrspace(1)*,
389 %opencl.image2d_t addrspace(1)*, i32 addrspace(1)*)* @test_2d_mix_3_0,
390 !114, !126, !134, !144, !154}
391 !17 = !{void (%opencl.image3d_t addrspace(1)*, %opencl.image2d_t addrspace(1)*,
392 %opencl.image3d_t addrspace(1)*, i32 addrspace(1)*)* @test_3d_mix_3_0,
393 !114, !126, !135, !145, !154}
394 !18 = !{void (%opencl.image2d_t addrspace(1)*, %opencl.image3d_t addrspace(1)*,
395 %opencl.image2d_t addrspace(1)*, i32 addrspace(1)*)* @test_2d_mix_3_1,
396 !114, !127, !134, !144, !154}
397 !19 = !{void (%opencl.image3d_t addrspace(1)*, %opencl.image2d_t addrspace(1)*,
398 %opencl.image3d_t addrspace(1)*, i32 addrspace(1)*)* @test_3d_mix_3_1,
399 !114, !127, !135, !145, !154}
400 !114 = !{!"kernel_arg_addr_space", i32 1, i32 1, i32 1, i32 1}
401 !124 = !{!"kernel_arg_access_qual", !"read_only", !"read_only", !"read_only", !"none"}
402 !125 = !{!"kernel_arg_access_qual", !"write_only", !"write_only", !"write_only", !"none"}
403 !126 = !{!"kernel_arg_access_qual", !"write_only", !"read_only", !"read_only", !"none"}
404 !127 = !{!"kernel_arg_access_qual", !"write_only", !"read_only", !"write_only", !"none"}
405 !134 = !{!"kernel_arg_type", !"image2d_t", !"image3d_t", !"image2d_t", !"int*"}
406 !135 = !{!"kernel_arg_type", !"image3d_t", !"image2d_t", !"image3d_t", !"int*"}
407 !144 = !{!"kernel_arg_base_type", !"image2d_t", !"image3d_t", !"image2d_t", !"int*"}
408 !145 = !{!"kernel_arg_base_type", !"image3d_t", !"image2d_t", !"image3d_t", !"int*"}
409 !154 = !{!"kernel_arg_type_qual", !"", !"", !"", !""}