summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
authorDavid Tweed <david.tweed@arm.com>2013-09-13 12:04:22 +0000
committerDavid Tweed <david.tweed@arm.com>2013-09-13 12:04:22 +0000
commit31d09b0cef3c93629e1af8bdf4fff2a1c64a6e68 (patch)
treeedb34cde9e648b432ee65233f27de487d8454339 /clang/test
parent3c0e5567a98322ea356aa358c481510985bf273c (diff)
downloadbcm5719-llvm-31d09b0cef3c93629e1af8bdf4fff2a1c64a6e68.tar.gz
bcm5719-llvm-31d09b0cef3c93629e1af8bdf4fff2a1c64a6e68.zip
Certain multi-platform languages, such as OpenCL, have the concept of
address spaces which is both (1) a "semantic" concept and (2) possibly a hardware level restriction. It is desirable to be able to discard/merge the LLVM-level address spaces on arguments for which there is no difference to the current backend while keeping track of the semantic address spaces in a funciton prototype. To do this enable addition of the address space into the name-mangling process. Add some tests to document this behaviour against inadvertent changes. Patch by Michele Scandale! llvm-svn: 190684
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/CodeGenOpenCL/address-spaces-mangling.cl30
-rw-r--r--clang/test/CodeGenOpenCL/local.cl4
2 files changed, 32 insertions, 2 deletions
diff --git a/clang/test/CodeGenOpenCL/address-spaces-mangling.cl b/clang/test/CodeGenOpenCL/address-spaces-mangling.cl
new file mode 100644
index 00000000000..3c7a5183636
--- /dev/null
+++ b/clang/test/CodeGenOpenCL/address-spaces-mangling.cl
@@ -0,0 +1,30 @@
+// RUN: %clang_cc1 %s -ffake-address-space-map -faddress-space-map-mangling=yes -emit-llvm -o - | FileCheck -check-prefix=ASMANG %s
+// RUN: %clang_cc1 %s -ffake-address-space-map -faddress-space-map-mangling=no -emit-llvm -o - | FileCheck -check-prefix=NOASMANG %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.
+__attribute__((overloadable))
+void ff(int *arg) { }
+// ASMANG: @_Z2ffPi
+// NOASMANG: @_Z2ffPi
+
+__attribute__((overloadable))
+void f(private int *arg) { }
+// ASMANG: @_Z1fPi
+// NOASMANG: @_Z1fPi
+
+__attribute__((overloadable))
+void f(global int *arg) { }
+// ASMANG: @_Z1fPU3AS1i
+// NOASMANG: @_Z1fPU8CLglobali
+
+__attribute__((overloadable))
+void f(local int *arg) { }
+// ASMANG: @_Z1fPU3AS2i
+// NOASMANG: @_Z1fPU7CLlocali
+
+__attribute__((overloadable))
+void f(constant int *arg) { }
+// ASMANG: @_Z1fPU3AS3i
+// NOASMANG: @_Z1fPU10CLconstanti
diff --git a/clang/test/CodeGenOpenCL/local.cl b/clang/test/CodeGenOpenCL/local.cl
index 852fa438f50..b5c67d9af9c 100644
--- a/clang/test/CodeGenOpenCL/local.cl
+++ b/clang/test/CodeGenOpenCL/local.cl
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -ffake-address-space-map -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -ffake-address-space-map -faddress-space-map-mangling=no -emit-llvm -o - | FileCheck %s
__kernel void foo(void) {
// CHECK: @foo.i = internal addrspace(2)
@@ -6,7 +6,7 @@ __kernel void foo(void) {
++i;
}
-// CHECK-LABEL: define void @_Z3barPU3AS2i
+// CHECK-LABEL: define void @_Z3barPU7CLlocali
__kernel void __attribute__((__overloadable__)) bar(local int *x) {
*x = 5;
}
OpenPOWER on IntegriCloud