1 // RUN
: %clang_cc1 -cl-std
=CL2.0 %s -triple
"spir-unknown-unknown" -emit-llvm -o - -O0 | FileCheck %s --check-prefix
=CHECK-SPIR
2 // RUN
: %clang_cc1 -cl-std
=CL2.0 %s -triple
"amdgcn--amdhsa" -emit-llvm -o - -O0 | FileCheck %s --check-prefix
=CHECK-AMDGCN
4 #define CLK_ADDRESS_CLAMP_TO_EDGE
2
5 #define CLK_NORMALIZED_COORDS_TRUE
1
6 #define CLK_FILTER_NEAREST
0x10
7 #define CLK_FILTER_LINEAR
0x20
9 constant sampler_t glb_smp
= CLK_ADDRESS_CLAMP_TO_EDGE|CLK_NORMALIZED_COORDS_TRUE|CLK_FILTER_NEAREST
;
11 void fnc1
(image1d_t img
) {}
12 // CHECK-SPIR
: @fnc1
(target("spirv.Image", void
, 0, 0, 0, 0, 0, 0, 0)
13 // CHECK-AMDGCN
: @fnc1
(ptr addrspace
(4)
15 void fnc1arr
(image1d_array_t img
) {}
16 // CHECK-SPIR
: @fnc1arr
(target("spirv.Image", void
, 0, 0, 1, 0, 0, 0, 0)
17 // CHECK-AMDGCN
: @fnc1arr
(ptr addrspace
(4)
19 void fnc1buff
(image1d_buffer_t img
) {}
20 // CHECK-SPIR
: @fnc1buff
(target("spirv.Image", void
, 5, 0, 0, 0, 0, 0, 0)
21 // CHECK-AMDGCN
: @fnc1buff
(ptr addrspace
(4)
23 void fnc2
(image2d_t img
) {}
24 // CHECK-SPIR
: @fnc2
(target("spirv.Image", void
, 1, 0, 0, 0, 0, 0, 0)
25 // CHECK-AMDGCN
: @fnc2
(ptr addrspace
(4)
27 void fnc2arr
(image2d_array_t img
) {}
28 // CHECK-SPIR
: @fnc2arr
(target("spirv.Image", void
, 1, 0, 1, 0, 0, 0, 0)
29 // CHECK-AMDGCN
: @fnc2arr
(ptr addrspace
(4)
31 void fnc3
(image3d_t img
) {}
32 // CHECK-SPIR
: @fnc3
(target("spirv.Image", void
, 2, 0, 0, 0, 0, 0, 0)
33 // CHECK-AMDGCN
: @fnc3
(ptr addrspace
(4)
35 void fnc4smp
(sampler_t s
) {}
36 // CHECK-SPIR-LABEL
: define
{{.
*}}void
@fnc4smp
(target("spirv.Sampler")
37 // CHECK-AMDGCN-LABEL
: define
{{.
*}}void
@fnc4smp
(ptr addrspace
(4)
39 kernel void foo
(image1d_t img
) {
40 sampler_t smp
= CLK_ADDRESS_CLAMP_TO_EDGE|CLK_NORMALIZED_COORDS_TRUE|CLK_FILTER_LINEAR
;
41 // CHECK-SPIR
: alloca target
("spirv.Sampler")
42 // CHECK-AMDGCN
: alloca ptr addrspace
(4)
44 // CHECK-SPIR
: alloca target
("spirv.Event")
45 // CHECK-AMDGCN
: alloca ptr addrspace
(5)
47 // CHECK-SPIR
: alloca target
("spirv.DeviceEvent")
48 // CHECK-AMDGCN
: alloca ptr addrspace
(1)
50 // CHECK-SPIR
: alloca target
("spirv.Queue")
51 // CHECK-AMDGCN
: alloca ptr addrspace
(1)
53 // CHECK-SPIR
: alloca target
("spirv.ReserveId")
54 // CHECK-AMDGCN
: alloca ptr addrspace
(1)
55 // CHECK-SPIR
: store target
("spirv.Sampler")
56 // CHECK-AMDGCN
: store ptr addrspace
(4)
58 // CHECK-SPIR
: call
{{.
*}}void
@fnc4smp
(target("spirv.Sampler")
59 // CHECK-AMDGCN
: call
{{.
*}}void
@fnc4smp
(ptr addrspace
(4)
61 // CHECK-SPIR
: call
{{.
*}}void
@fnc4smp
(target("spirv.Sampler")
62 // CHECK-AMDGCN
: call
{{.
*}}void
@fnc4smp
(ptr addrspace
(4)
65 kernel void foo_ro_pipe
(read_only pipe int p
) {}
66 // CHECK-SPIR
: @foo_ro_pipe
(target("spirv.Pipe", 0) %p
)
67 // CHECK_AMDGCN
: @foo_ro_pipe
(ptr addrspace
(1) %p
)
69 kernel void foo_wo_pipe
(write_only pipe int p
) {}
70 // CHECK-SPIR
: @foo_wo_pipe
(target("spirv.Pipe", 1) %p
)
71 // CHECK_AMDGCN
: @foo_wo_pipe
(ptr addrspace
(1) %p
)
73 void __attribute__
((overloadable)) bad1
(image1d_t b
, image2d_t c
, image2d_t d
) {}
74 // CHECK-SPIR-LABEL
: @{{_Z4bad114ocl_image1d_ro14ocl_image2d_roS0_|
"\\01\?bad1@@\$\$J0YAXPAUocl_image1d_ro@@PAUocl_image2d_ro@@1@Z"}}
75 // CHECK-AMDGCN-LABEL
: @{{_Z4bad114ocl_image1d_ro14ocl_image2d_roS0_|
"\\01\?bad1@@\$\$J0YAXPAUocl_image1d_ro@@PAUocl_image2d_ro@@1@Z"}}(ptr addrspace
(4){{.
*}}ptr addrspace
(4){{.
*}}ptr addrspace
(4){{.
*}})