diff options
Diffstat (limited to 'clang/test/SemaOpenCL')
-rw-r--r-- | clang/test/SemaOpenCL/extension-fp64-cl1.1.cl | 19 | ||||
-rw-r--r-- | clang/test/SemaOpenCL/extension-fp64.cl | 19 | ||||
-rw-r--r-- | clang/test/SemaOpenCL/extensions.cl | 36 | ||||
-rw-r--r-- | clang/test/SemaOpenCL/half.cl | 2 | ||||
-rw-r--r-- | clang/test/SemaOpenCL/invalid-kernel-parameters.cl | 2 | ||||
-rw-r--r-- | clang/test/SemaOpenCL/invalid-logical-ops-1.2.cl | 3 | ||||
-rw-r--r-- | clang/test/SemaOpenCL/optional-core-fp64-cl1.2.cl | 20 | ||||
-rw-r--r-- | clang/test/SemaOpenCL/optional-core-fp64-cl2.0.cl | 20 |
8 files changed, 81 insertions, 40 deletions
diff --git a/clang/test/SemaOpenCL/extension-fp64-cl1.1.cl b/clang/test/SemaOpenCL/extension-fp64-cl1.1.cl new file mode 100644 index 00000000000..7e852ae70eb --- /dev/null +++ b/clang/test/SemaOpenCL/extension-fp64-cl1.1.cl @@ -0,0 +1,19 @@ +// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL1.1 + +void f1(double da) { // expected-error {{type 'double' requires cl_khr_fp64 extension}} + double d; // expected-error {{type 'double' requires cl_khr_fp64 extension}} + (void) 1.0; // expected-warning {{double precision constant requires cl_khr_fp64}} +} + +#pragma OPENCL EXTENSION cl_khr_fp64 : enable + +void f2(void) { + double d; + (void) 1.0; +} + +#pragma OPENCL EXTENSION cl_khr_fp64 : disable + +void f3(void) { + double d; // expected-error {{type 'double' requires cl_khr_fp64 extension}} +} diff --git a/clang/test/SemaOpenCL/extension-fp64.cl b/clang/test/SemaOpenCL/extension-fp64.cl new file mode 100644 index 00000000000..e0c2b1ea4b5 --- /dev/null +++ b/clang/test/SemaOpenCL/extension-fp64.cl @@ -0,0 +1,19 @@ +// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only + +void f1(double da) { // expected-error {{type 'double' requires cl_khr_fp64 extension}} + double d; // expected-error {{type 'double' requires cl_khr_fp64 extension}} + (void) 1.0; // expected-warning {{double precision constant requires cl_khr_fp64}} +} + +#pragma OPENCL EXTENSION cl_khr_fp64 : enable + +void f2(void) { + double d; + (void) 1.0; +} + +#pragma OPENCL EXTENSION cl_khr_fp64 : disable + +void f3(void) { + double d; // expected-error {{type 'double' requires cl_khr_fp64 extension}} +} diff --git a/clang/test/SemaOpenCL/extensions.cl b/clang/test/SemaOpenCL/extensions.cl deleted file mode 100644 index 31224e0df77..00000000000 --- a/clang/test/SemaOpenCL/extensions.cl +++ /dev/null @@ -1,36 +0,0 @@ -// RUN: %clang_cc1 %s -triple spir-unknown-unknown -verify -pedantic -fsyntax-only -// RUN: %clang_cc1 %s -triple spir-unknown-unknown -verify -pedantic -fsyntax-only -cl-std=CL1.1 - -// Test with a target not supporting fp64. -// RUN: %clang_cc1 %s -triple r600-unknown-unknown -target-cpu r600 -verify -pedantic -fsyntax-only -DNOFP64 - -void f1(double da) { // expected-error {{type 'double' requires cl_khr_fp64 extension}} - double d; // expected-error {{type 'double' requires cl_khr_fp64 extension}} - (void) 1.0; // expected-warning {{double precision constant requires cl_khr_fp64}} -} - -#pragma OPENCL EXTENSION cl_khr_fp64 : enable -#ifdef NOFP64 -// expected-warning@-2{{unsupported OpenCL extension 'cl_khr_fp64' - ignoring}} -#endif - -void f2(void) { - double d; -#ifdef NOFP64 -// expected-error@-2{{use of type 'double' requires cl_khr_fp64 extension to be enabled}} -#endif - - (void) 1.0; -#ifdef NOFP64 -// expected-warning@-2{{double precision constant requires cl_khr_fp64, casting to single precision}} -#endif -} - -#pragma OPENCL EXTENSION cl_khr_fp64 : disable -#ifdef NOFP64 -// expected-warning@-2{{unsupported OpenCL extension 'cl_khr_fp64' - ignoring}} -#endif - -void f3(void) { - double d; // expected-error {{type 'double' requires cl_khr_fp64 extension}} -} diff --git a/clang/test/SemaOpenCL/half.cl b/clang/test/SemaOpenCL/half.cl index dd7bb9ab8c5..f8cc017bb85 100644 --- a/clang/test/SemaOpenCL/half.cl +++ b/clang/test/SemaOpenCL/half.cl @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -Wno-unused-value -triple spir-unknown-unknown +// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -Wno-unused-value #pragma OPENCL EXTENSION cl_khr_fp16 : disable constant float f = 1.0h; // expected-error{{half precision constant requires cl_khr_fp16}} diff --git a/clang/test/SemaOpenCL/invalid-kernel-parameters.cl b/clang/test/SemaOpenCL/invalid-kernel-parameters.cl index e2e48e83c6b..a30a27faa91 100644 --- a/clang/test/SemaOpenCL/invalid-kernel-parameters.cl +++ b/clang/test/SemaOpenCL/invalid-kernel-parameters.cl @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify %s -triple spir-unknown-unknown +// RUN: %clang_cc1 -fsyntax-only -verify %s #pragma OPENCL EXTENSION cl_khr_fp16 : enable diff --git a/clang/test/SemaOpenCL/invalid-logical-ops-1.2.cl b/clang/test/SemaOpenCL/invalid-logical-ops-1.2.cl index 96602ce6844..7ba1adbf53e 100644 --- a/clang/test/SemaOpenCL/invalid-logical-ops-1.2.cl +++ b/clang/test/SemaOpenCL/invalid-logical-ops-1.2.cl @@ -1,7 +1,6 @@ // RUN: %clang_cc1 %s -verify -cl-std=CL1.2 -triple x86_64-unknown-linux-gnu -#pragma OPENCL EXTENSION cl_khr_fp64 : enable // expected-warning{{OpenCL extension 'cl_khr_fp64' is core feature or supported optional core feature - ignoring}} - +#pragma OPENCL EXTENSION cl_khr_fp64 : enable typedef __attribute__((ext_vector_type(4))) float float4; typedef __attribute__((ext_vector_type(4))) double double4; typedef __attribute__((ext_vector_type(4))) int int4; diff --git a/clang/test/SemaOpenCL/optional-core-fp64-cl1.2.cl b/clang/test/SemaOpenCL/optional-core-fp64-cl1.2.cl new file mode 100644 index 00000000000..e0f7f1db4ff --- /dev/null +++ b/clang/test/SemaOpenCL/optional-core-fp64-cl1.2.cl @@ -0,0 +1,20 @@ +// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL1.2 +// expected-no-diagnostics + +void f1(double da) { + double d; + (void) 1.0; +} + +#pragma OPENCL EXTENSION cl_khr_fp64 : enable + +void f2(void) { + double d; + (void) 1.0; +} + +#pragma OPENCL EXTENSION cl_khr_fp64 : disable + +void f3(void) { + double d; +} diff --git a/clang/test/SemaOpenCL/optional-core-fp64-cl2.0.cl b/clang/test/SemaOpenCL/optional-core-fp64-cl2.0.cl new file mode 100644 index 00000000000..832529d4adf --- /dev/null +++ b/clang/test/SemaOpenCL/optional-core-fp64-cl2.0.cl @@ -0,0 +1,20 @@ +// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL2.0 +// expected-no-diagnostics + +void f1(double da) { + double d; + (void) 1.0; +} + +#pragma OPENCL EXTENSION cl_khr_fp64 : enable + +void f2(void) { + double d; + (void) 1.0; +} + +#pragma OPENCL EXTENSION cl_khr_fp64 : disable + +void f3(void) { + double d; +} |