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, 40 insertions, 81 deletions
diff --git a/clang/test/SemaOpenCL/extension-fp64-cl1.1.cl b/clang/test/SemaOpenCL/extension-fp64-cl1.1.cl deleted file mode 100644 index 7e852ae70eb..00000000000 --- a/clang/test/SemaOpenCL/extension-fp64-cl1.1.cl +++ /dev/null @@ -1,19 +0,0 @@ -// 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 deleted file mode 100644 index e0c2b1ea4b5..00000000000 --- a/clang/test/SemaOpenCL/extension-fp64.cl +++ /dev/null @@ -1,19 +0,0 @@ -// 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 new file mode 100644 index 00000000000..31224e0df77 --- /dev/null +++ b/clang/test/SemaOpenCL/extensions.cl @@ -0,0 +1,36 @@ +// 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 f8cc017bb85..dd7bb9ab8c5 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 +// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -Wno-unused-value -triple spir-unknown-unknown #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 a30a27faa91..e2e48e83c6b 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 +// RUN: %clang_cc1 -fsyntax-only -verify %s -triple spir-unknown-unknown #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 7ba1adbf53e..96602ce6844 100644 --- a/clang/test/SemaOpenCL/invalid-logical-ops-1.2.cl +++ b/clang/test/SemaOpenCL/invalid-logical-ops-1.2.cl @@ -1,6 +1,7 @@ // RUN: %clang_cc1 %s -verify -cl-std=CL1.2 -triple x86_64-unknown-linux-gnu -#pragma OPENCL EXTENSION cl_khr_fp64 : enable +#pragma OPENCL EXTENSION cl_khr_fp64 : enable // expected-warning{{OpenCL extension 'cl_khr_fp64' is core feature or supported optional core feature - ignoring}} + 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 deleted file mode 100644 index e0f7f1db4ff..00000000000 --- a/clang/test/SemaOpenCL/optional-core-fp64-cl1.2.cl +++ /dev/null @@ -1,20 +0,0 @@ -// 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 deleted file mode 100644 index 832529d4adf..00000000000 --- a/clang/test/SemaOpenCL/optional-core-fp64-cl2.0.cl +++ /dev/null @@ -1,20 +0,0 @@ -// 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; -} |