1 // RUN
: %clang_cc1 -cl-std
=CL2.0 %s -triple
"spir-unknown-unknown" -emit-llvm -o - -O0 | FileCheck %s --check-prefixes
=CHECK-COM
,CHECK-SPIR
2 // RUN
: %clang_cc1 -cl-std
=CL2.0 %s -triple
"amdgcn--amdhsa" -emit-llvm -o - -O0 | FileCheck %s --check-prefixes
=CHECK-COM
,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
;
10 // CHECK-COM-NOT
: constant i32
12 void fnc1
(image1d_t img
) {}
13 // CHECK-SPIR
: @fnc1
(ptr addrspace
(1)
14 // CHECK-AMDGCN
: @fnc1
(ptr addrspace
(4)
16 void fnc1arr
(image1d_array_t img
) {}
17 // CHECK-SPIR
: @fnc1arr
(ptr addrspace
(1)
18 // CHECK-AMDGCN
: @fnc1arr
(ptr addrspace
(4)
20 void fnc1buff
(image1d_buffer_t img
) {}
21 // CHECK-SPIR
: @fnc1buff
(ptr addrspace
(1)
22 // CHECK-AMDGCN
: @fnc1buff
(ptr addrspace
(4)
24 void fnc2
(image2d_t img
) {}
25 // CHECK-SPIR
: @fnc2
(ptr addrspace
(1)
26 // CHECK-AMDGCN
: @fnc2
(ptr addrspace
(4)
28 void fnc2arr
(image2d_array_t img
) {}
29 // CHECK-SPIR
: @fnc2arr
(ptr addrspace
(1)
30 // CHECK-AMDGCN
: @fnc2arr
(ptr addrspace
(4)
32 void fnc3
(image3d_t img
) {}
33 // CHECK-SPIR
: @fnc3
(ptr addrspace
(1)
34 // CHECK-AMDGCN
: @fnc3
(ptr addrspace
(4)
36 void fnc4smp
(sampler_t s
) {}
37 // CHECK-SPIR-LABEL
: define
{{.
*}}void
@fnc4smp
(ptr addrspace
(2)
38 // CHECK-AMDGCN-LABEL
: define
{{.
*}}void
@fnc4smp
(ptr addrspace
(4)
40 kernel void foo
(image1d_t img
) {
41 sampler_t smp
= CLK_ADDRESS_CLAMP_TO_EDGE|CLK_NORMALIZED_COORDS_TRUE|CLK_FILTER_LINEAR
;
42 // CHECK-SPIR
: alloca ptr addrspace
(2)
43 // CHECK-AMDGCN
: alloca ptr addrspace
(4)
45 // CHECK-SPIR
: alloca ptr
46 // CHECK-AMDGCN
: alloca ptr addrspace
(5)
48 // CHECK-SPIR
: alloca ptr
49 // CHECK-AMDGCN
: alloca ptr addrspace
(1)
51 // CHECK-SPIR
: alloca ptr
52 // CHECK-AMDGCN
: alloca ptr addrspace
(1)
54 // CHECK-SPIR
: alloca ptr
55 // CHECK-AMDGCN
: alloca ptr addrspace
(1)
56 // CHECK-SPIR
: store ptr addrspace
(2)
57 // CHECK-AMDGCN
: store ptr addrspace
(4)
59 // CHECK-SPIR
: call
{{.
*}}void
@fnc4smp
(ptr addrspace
(2)
60 // CHECK-AMDGCN
: call
{{.
*}}void
@fnc4smp
(ptr addrspace
(4)
62 // CHECK-SPIR
: call
{{.
*}}void
@fnc4smp
(ptr addrspace
(2)
63 // CHECK-AMDGCN
: call
{{.
*}}void
@fnc4smp
(ptr addrspace
(4)
66 kernel void foo_ro_pipe
(read_only pipe int p
) {}
67 // CHECK-SPIR
: @foo_ro_pipe
(ptr addrspace
(1) %p
)
68 // CHECK_AMDGCN
: @foo_ro_pipe
(ptr addrspace
(1) %p
)
70 kernel void foo_wo_pipe
(write_only pipe int p
) {}
71 // CHECK-SPIR
: @foo_wo_pipe
(ptr addrspace
(1) %p
)
72 // CHECK_AMDGCN
: @foo_wo_pipe
(ptr addrspace
(1) %p
)
74 void __attribute__
((overloadable)) bad1
(image1d_t b
, image2d_t c
, image2d_t d
) {}
75 // CHECK-SPIR-LABEL
: @{{_Z4bad114ocl_image1d_ro14ocl_image2d_roS0_|
"\\01\?bad1@@\$\$J0YAXPAUocl_image1d_ro@@PAUocl_image2d_ro@@1@Z"}}
76 // 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){{.
*}})