summaryrefslogtreecommitdiffstats
path: root/test/SemaOpenCL
diff options
context:
space:
mode:
authorTom Stellard <thomas.stellard@amd.com>2014-10-16 15:29:19 +0000
committerTom Stellard <thomas.stellard@amd.com>2014-10-16 15:29:19 +0000
commit520113df8784cf844b14b26f6d8271ee5d465ad5 (patch)
treed5a04b776f26d2e983b0bbc8c9081d91eacaafb0 /test/SemaOpenCL
parent575a318f4fb9b2d1b5a488c3441a3be6a03d58dd (diff)
OpenCL: Emit global variables in the constant addr space as constant globals
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219929 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaOpenCL')
-rw-r--r--test/SemaOpenCL/address-spaces.cl5
-rw-r--r--test/SemaOpenCL/extern.cl2
2 files changed, 5 insertions, 2 deletions
diff --git a/test/SemaOpenCL/address-spaces.cl b/test/SemaOpenCL/address-spaces.cl
index b188ea4576..7026d1bc08 100644
--- a/test/SemaOpenCL/address-spaces.cl
+++ b/test/SemaOpenCL/address-spaces.cl
@@ -12,14 +12,16 @@ __kernel void foo(__global int *gip) {
ip = &ci; // expected-error {{assigning '__constant int *' to 'int *' changes address space of pointer}}
}
-void explicit_cast(global int* g, local int* l, constant int* c, private int* p)
+void explicit_cast(global int* g, local int* l, constant int* c, private int* p, const constant int *cc)
{
g = (global int*) l; // expected-error {{casting '__local int *' to type '__global int *' changes address space of pointer}}
g = (global int*) c; // expected-error {{casting '__constant int *' to type '__global int *' changes address space of pointer}}
+ g = (global int*) cc; // expected-error {{casting 'const __constant int *' to type '__global int *' changes address space of pointer}}
g = (global int*) p; // expected-error {{casting 'int *' to type '__global int *' changes address space of pointer}}
l = (local int*) g; // expected-error {{casting '__global int *' to type '__local int *' changes address space of pointer}}
l = (local int*) c; // expected-error {{casting '__constant int *' to type '__local int *' changes address space of pointer}}
+ l = (local int*) cc; // expected-error {{casting 'const __constant int *' to type '__local int *' changes address space of pointer}}
l = (local int*) p; // expected-error {{casting 'int *' to type '__local int *' changes address space of pointer}}
c = (constant int*) g; // expected-error {{casting '__global int *' to type '__constant int *' changes address space of pointer}}
@@ -29,6 +31,7 @@ void explicit_cast(global int* g, local int* l, constant int* c, private int* p)
p = (private int*) g; // expected-error {{casting '__global int *' to type 'int *' changes address space of pointer}}
p = (private int*) l; // expected-error {{casting '__local int *' to type 'int *' changes address space of pointer}}
p = (private int*) c; // expected-error {{casting '__constant int *' to type 'int *' changes address space of pointer}}
+ p = (private int*) cc; // expected-error {{casting 'const __constant int *' to type 'int *' changes address space of pointer}}
}
void ok_explicit_casts(global int *g, global int* g2, local int* l, local int* l2, private int* p, private int* p2)
diff --git a/test/SemaOpenCL/extern.cl b/test/SemaOpenCL/extern.cl
index 5b88d70793..b2e4857e28 100644
--- a/test/SemaOpenCL/extern.cl
+++ b/test/SemaOpenCL/extern.cl
@@ -1,7 +1,7 @@
// RUN: %clang_cc1 -x cl -cl-std=CL1.2 -emit-llvm -ffake-address-space-map %s -o - -verify | FileCheck %s
// expected-no-diagnostics
-// CHECK: @foo = external addrspace(3) global float
+// CHECK: @foo = external addrspace(3) constant float
extern constant float foo;
kernel void test(global float* buf) {