summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaOpenCL/overload_addrspace_resolution.cl
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test/SemaOpenCL/overload_addrspace_resolution.cl')
-rw-r--r--clang/test/SemaOpenCL/overload_addrspace_resolution.cl29
1 files changed, 29 insertions, 0 deletions
diff --git a/clang/test/SemaOpenCL/overload_addrspace_resolution.cl b/clang/test/SemaOpenCL/overload_addrspace_resolution.cl
new file mode 100644
index 00000000000..fa7b6144a20
--- /dev/null
+++ b/clang/test/SemaOpenCL/overload_addrspace_resolution.cl
@@ -0,0 +1,29 @@
+// RUN: %clang_cc1 -cl-std=CL2.0 -emit-llvm -o - %s | FileCheck %s
+
+void __attribute__((overloadable)) foo(global int *a, global int *b);
+void __attribute__((overloadable)) foo(generic int *a, generic int *b);
+void __attribute__((overloadable)) bar(generic int *global *a, generic int *global *b);
+void __attribute__((overloadable)) bar(generic int *generic *a, generic int *generic *b);
+
+void kernel ker() {
+ global int *a;
+ global int *b;
+ generic int *c;
+ local int *d;
+ generic int *generic *gengen;
+ generic int *local *genloc;
+ generic int *global *genglob;
+ // CHECK: call void @_Z3fooPU8CLglobaliS0_(i32* undef, i32* undef)
+ foo(a, b);
+ // CHECK: call void @_Z3fooPU9CLgenericiS0_(i32* undef, i32* undef)
+ foo(b, c);
+ // CHECK: call void @_Z3fooPU9CLgenericiS0_(i32* undef, i32* undef)
+ foo(a, d);
+
+ // CHECK: call void @_Z3barPU9CLgenericPU9CLgenericiS2_(i32** undef, i32** undef)
+ bar(gengen, genloc);
+ // CHECK: call void @_Z3barPU9CLgenericPU9CLgenericiS2_(i32** undef, i32** undef)
+ bar(gengen, genglob);
+ // CHECK: call void @_Z3barPU8CLglobalPU9CLgenericiS2_(i32** undef, i32** undef)
+ bar(genglob, genglob);
+}
OpenPOWER on IntegriCloud