diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2012-04-14 14:01:31 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2012-04-14 14:01:31 +0000 |
| commit | dbe13110f59f48b4dbb7552b3ac2935acdeece7f (patch) | |
| tree | be1815eb79b42ff482a8562b13c2dcbf0c5dcbee /test/SemaOpenCL | |
| parent | 9da628931ebf2609493570f87824ca22402cc65f (diff) | |
Notes
Diffstat (limited to 'test/SemaOpenCL')
| -rw-r--r-- | test/SemaOpenCL/address-spaces.cl | 13 | ||||
| -rw-r--r-- | test/SemaOpenCL/local.cl | 6 | ||||
| -rw-r--r-- | test/SemaOpenCL/vec_compare.cl | 11 | ||||
| -rw-r--r-- | test/SemaOpenCL/vector_literals_const.cl | 26 |
4 files changed, 50 insertions, 6 deletions
diff --git a/test/SemaOpenCL/address-spaces.cl b/test/SemaOpenCL/address-spaces.cl new file mode 100644 index 000000000000..6ab10b3507f7 --- /dev/null +++ b/test/SemaOpenCL/address-spaces.cl @@ -0,0 +1,13 @@ +// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only + +__constant int ci = 1; + +__kernel void foo(__global int *gip) { + __local int li; + __local int lj = 2; // expected-error {{'__local' variable cannot have an initializer}} + + int *ip; + ip = gip; // expected-error {{assigning '__global int *' to 'int *' changes address space of pointer}} + ip = &li; // expected-error {{assigning '__local int *' to 'int *' changes address space of pointer}} + ip = &ci; // expected-error {{assigning '__constant int *' to 'int *' changes address space of pointer}} +} diff --git a/test/SemaOpenCL/local.cl b/test/SemaOpenCL/local.cl deleted file mode 100644 index 8637cfff30d1..000000000000 --- a/test/SemaOpenCL/local.cl +++ /dev/null @@ -1,6 +0,0 @@ -// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only - -__kernel void foo(void) { - __local int i; - __local int j = 2; // expected-error {{'__local' variable cannot have an initializer}} -} diff --git a/test/SemaOpenCL/vec_compare.cl b/test/SemaOpenCL/vec_compare.cl new file mode 100644 index 000000000000..dd91aa592ab2 --- /dev/null +++ b/test/SemaOpenCL/vec_compare.cl @@ -0,0 +1,11 @@ +// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only + +typedef __attribute__((ext_vector_type(2))) unsigned int uint2; +typedef __attribute__((ext_vector_type(2))) int int2; + +void unsignedCompareOps() +{ + uint2 A, B; + int2 result = A != B; +} + diff --git a/test/SemaOpenCL/vector_literals_const.cl b/test/SemaOpenCL/vector_literals_const.cl new file mode 100644 index 000000000000..e761816db4b7 --- /dev/null +++ b/test/SemaOpenCL/vector_literals_const.cl @@ -0,0 +1,26 @@ +// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only + +typedef int int2 __attribute((ext_vector_type(2))); +typedef int int3 __attribute((ext_vector_type(3))); +typedef int int4 __attribute((ext_vector_type(4))); + +__constant int4 i_1_1_1_1 = (int4)(1,2,3,4); +__constant int4 i_2_1_1 = (int4)((int2)(1,2),3,4); +__constant int4 i_1_2_1 = (int4)(1,(int2)(2,3),4); +__constant int4 i_1_1_2 = (int4)(1,2,(int2)(3,4)); +__constant int4 i_2_2 = (int4)((int2)(1,2),(int2)(3,4)); +__constant int4 i_3_1 = (int4)((int3)(1,2,3),4); +__constant int4 i_1_3 = (int4)(1,(int3)(2,3,4)); + +typedef float float2 __attribute((ext_vector_type(2))); +typedef float float3 __attribute((ext_vector_type(3))); +typedef float float4 __attribute((ext_vector_type(4))); + +__constant float4 f_1_1_1_1 = (float4)(1,2,3,4); +__constant float4 f_2_1_1 = (float4)((float2)(1,2),3,4); +__constant float4 f_1_2_1 = (float4)(1,(float2)(2,3),4); +__constant float4 f_1_1_2 = (float4)(1,2,(float2)(3,4)); +__constant float4 f_2_2 = (float4)((float2)(1,2),(float2)(3,4)); +__constant float4 f_3_1 = (float4)((float3)(1,2,3),4); +__constant float4 f_1_3 = (float4)(1,(float3)(2,3,4)); + |
