echuraev created this revision.
echuraev added a reviewer: Anastasia.
echuraev added subscribers: bader, cfe-commits, yaxunl.

https://reviews.llvm.org/D27403

Files:
  test/CodeGenOpenCL/address-spaces-mangling.cl


Index: test/CodeGenOpenCL/address-spaces-mangling.cl
===================================================================
--- test/CodeGenOpenCL/address-spaces-mangling.cl
+++ test/CodeGenOpenCL/address-spaces-mangling.cl
@@ -1,6 +1,10 @@
 // RUN: %clang_cc1 %s -ffake-address-space-map 
-faddress-space-map-mangling=yes -triple %itanium_abi_triple -emit-llvm -o - | 
FileCheck -check-prefix=ASMANG %s
 // RUN: %clang_cc1 %s -ffake-address-space-map -faddress-space-map-mangling=no 
-triple %itanium_abi_triple -emit-llvm -o - | FileCheck -check-prefix=NOASMANG 
%s
 
+// We check that the address spaces are mangled the same in both version of 
OpenCL
+// RUN: %clang_cc1 %s -triple spir-unknown-unknown -cl-std=CL2.0 -emit-llvm -o 
- | FileCheck -check-prefix=OCL %s
+// RUN: %clang_cc1 %s -triple spir-unknown-unknown -cl-std=CL1.2 -emit-llvm -o 
- | FileCheck -check-prefix=OCL %s
+
 // We can't name this f as private is equivalent to default
 // no specifier given address space so we get multiple definition
 // warnings, but we do want it for comparison purposes.
@@ -28,3 +32,20 @@
 void f(constant int *arg) { }
 // ASMANG: @_Z1fPU3AS3i
 // NOASMANG: @_Z1fPU10CLconstanti
+
+__attribute__((overloadable)) void foo(private char *);
+__attribute__((overloadable)) void foo(global char *);
+__attribute__((overloadable)) void foo(constant char *);
+__attribute__((overloadable)) void foo(local char *);
+
+void bar(global char *gp, constant char *cp, local char *lp) {
+  private char* pp;
+  // OCL: call spir_func void @_Z3fooPc
+  foo(pp);
+  // OCL: call spir_func void @_Z3fooPU3AS1c
+  foo(gp);
+  // OCL: call spir_func void @_Z3fooPU3AS2c
+  foo(cp);
+  // OCL: call spir_func void @_Z3fooPU3AS3c
+  foo(lp);
+}


Index: test/CodeGenOpenCL/address-spaces-mangling.cl
===================================================================
--- test/CodeGenOpenCL/address-spaces-mangling.cl
+++ test/CodeGenOpenCL/address-spaces-mangling.cl
@@ -1,6 +1,10 @@
 // RUN: %clang_cc1 %s -ffake-address-space-map -faddress-space-map-mangling=yes -triple %itanium_abi_triple -emit-llvm -o - | FileCheck -check-prefix=ASMANG %s
 // RUN: %clang_cc1 %s -ffake-address-space-map -faddress-space-map-mangling=no -triple %itanium_abi_triple -emit-llvm -o - | FileCheck -check-prefix=NOASMANG %s
 
+// We check that the address spaces are mangled the same in both version of OpenCL
+// RUN: %clang_cc1 %s -triple spir-unknown-unknown -cl-std=CL2.0 -emit-llvm -o - | FileCheck -check-prefix=OCL %s
+// RUN: %clang_cc1 %s -triple spir-unknown-unknown -cl-std=CL1.2 -emit-llvm -o - | FileCheck -check-prefix=OCL %s
+
 // We can't name this f as private is equivalent to default
 // no specifier given address space so we get multiple definition
 // warnings, but we do want it for comparison purposes.
@@ -28,3 +32,20 @@
 void f(constant int *arg) { }
 // ASMANG: @_Z1fPU3AS3i
 // NOASMANG: @_Z1fPU10CLconstanti
+
+__attribute__((overloadable)) void foo(private char *);
+__attribute__((overloadable)) void foo(global char *);
+__attribute__((overloadable)) void foo(constant char *);
+__attribute__((overloadable)) void foo(local char *);
+
+void bar(global char *gp, constant char *cp, local char *lp) {
+  private char* pp;
+  // OCL: call spir_func void @_Z3fooPc
+  foo(pp);
+  // OCL: call spir_func void @_Z3fooPU3AS1c
+  foo(gp);
+  // OCL: call spir_func void @_Z3fooPU3AS2c
+  foo(cp);
+  // OCL: call spir_func void @_Z3fooPU3AS3c
+  foo(lp);
+}
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to