[PATCH] D27403: [OpenCL] Added a LIT test for ensuring address space mangling is done the same both in OpenCL1.2 and OpenCL2.0.
Egor Churaev via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Dec 5 00:26:01 PST 2016
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);
+}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D27403.80233.patch
Type: text/x-patch
Size: 1719 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20161205/a96d10a7/attachment.bin>
More information about the cfe-commits
mailing list