summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/CodeGenOpenCL/builtins-r600.cl2
-rw-r--r--clang/test/CodeGenOpenCL/fpmath.cl2
-rw-r--r--clang/test/CodeGenOpenCL/half.cl2
-rw-r--r--clang/test/Lexer/opencl-half-literal.cl2
-rw-r--r--clang/test/Misc/languageOptsOpenCL.cl2
-rw-r--r--clang/test/PCH/opencl-extensions.cl4
-rw-r--r--clang/test/Parser/opencl-astype.cl2
-rw-r--r--clang/test/Parser/opencl-atomics-cl20.cl26
-rw-r--r--clang/test/Parser/opencl-pragma.cl2
-rw-r--r--clang/test/Parser/opencl-storage-class.cl2
-rw-r--r--clang/test/SemaOpenCL/extension-fp64-cl1.1.cl19
-rw-r--r--clang/test/SemaOpenCL/extension-fp64.cl19
-rw-r--r--clang/test/SemaOpenCL/extensions.cl36
-rw-r--r--clang/test/SemaOpenCL/half.cl2
-rw-r--r--clang/test/SemaOpenCL/invalid-kernel-parameters.cl2
-rw-r--r--clang/test/SemaOpenCL/invalid-logical-ops-1.2.cl3
-rw-r--r--clang/test/SemaOpenCL/optional-core-fp64-cl1.2.cl20
-rw-r--r--clang/test/SemaOpenCL/optional-core-fp64-cl2.0.cl20
18 files changed, 64 insertions, 103 deletions
diff --git a/clang/test/CodeGenOpenCL/builtins-r600.cl b/clang/test/CodeGenOpenCL/builtins-r600.cl
index 001dc06f597..6369f3d83db 100644
--- a/clang/test/CodeGenOpenCL/builtins-r600.cl
+++ b/clang/test/CodeGenOpenCL/builtins-r600.cl
@@ -1,5 +1,5 @@
// REQUIRES: amdgpu-registered-target
-// RUN: %clang_cc1 -triple r600-unknown-unknown -S -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple r600-unknown-unknown -target-cpu rv670 -S -emit-llvm -o - %s | FileCheck %s
#pragma OPENCL EXTENSION cl_khr_fp64 : enable
diff --git a/clang/test/CodeGenOpenCL/fpmath.cl b/clang/test/CodeGenOpenCL/fpmath.cl
index ef4da845529..88df3bf166a 100644
--- a/clang/test/CodeGenOpenCL/fpmath.cl
+++ b/clang/test/CodeGenOpenCL/fpmath.cl
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -emit-llvm -o - -triple spir-unknown-unknown | FileCheck %s
typedef __attribute__(( ext_vector_type(4) )) float float4;
diff --git a/clang/test/CodeGenOpenCL/half.cl b/clang/test/CodeGenOpenCL/half.cl
index bd5ae7f6499..9acabf0a2a8 100644
--- a/clang/test/CodeGenOpenCL/half.cl
+++ b/clang/test/CodeGenOpenCL/half.cl
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -emit-llvm -o - -triple spir-unknown-unknown | FileCheck %s
#pragma OPENCL EXTENSION cl_khr_fp16 : enable
diff --git a/clang/test/Lexer/opencl-half-literal.cl b/clang/test/Lexer/opencl-half-literal.cl
index 2415ee4fd8c..42ca5146b1f 100644
--- a/clang/test/Lexer/opencl-half-literal.cl
+++ b/clang/test/Lexer/opencl-half-literal.cl
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -fsyntax-only -verify
+// RUN: %clang_cc1 %s -fsyntax-only -verify -triple spir-unknown-unknown
#pragma OPENCL EXTENSION cl_khr_fp16 : enable
diff --git a/clang/test/Misc/languageOptsOpenCL.cl b/clang/test/Misc/languageOptsOpenCL.cl
index 82a8f3614f3..9651f01a7dc 100644
--- a/clang/test/Misc/languageOptsOpenCL.cl
+++ b/clang/test/Misc/languageOptsOpenCL.cl
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -x cl %s -verify
+// RUN: %clang_cc1 -x cl %s -verify -triple spir-unknown-unknown
// expected-no-diagnostics
// Test the forced language options for OpenCL are set correctly.
diff --git a/clang/test/PCH/opencl-extensions.cl b/clang/test/PCH/opencl-extensions.cl
index a22b007f9d5..d6d541658a1 100644
--- a/clang/test/PCH/opencl-extensions.cl
+++ b/clang/test/PCH/opencl-extensions.cl
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -emit-pch -o %t %s
-// RUN: %clang_cc1 -include-pch %t -fsyntax-only %s
+// RUN: %clang_cc1 -emit-pch -o %t %s -triple spir-unknown-unknown
+// RUN: %clang_cc1 -include-pch %t -fsyntax-only %s -triple spir-unknown-unknown
#ifndef HEADER
#define HEADER
diff --git a/clang/test/Parser/opencl-astype.cl b/clang/test/Parser/opencl-astype.cl
index 72f98a4ace9..903c42ee8c1 100644
--- a/clang/test/Parser/opencl-astype.cl
+++ b/clang/test/Parser/opencl-astype.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_fp64 : enable
void test_astype() {
diff --git a/clang/test/Parser/opencl-atomics-cl20.cl b/clang/test/Parser/opencl-atomics-cl20.cl
index cb2f59721ac..20f969645fe 100644
--- a/clang/test/Parser/opencl-atomics-cl20.cl
+++ b/clang/test/Parser/opencl-atomics-cl20.cl
@@ -1,11 +1,14 @@
-// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only
-// RUN: %clang_cc1 %s -verify -fsyntax-only -cl-std=CL2.0 -DCL20
-// RUN: %clang_cc1 %s -verify -fsyntax-only -cl-std=CL2.0 -DCL20 -DEXT
+// RUN: %clang_cc1 %s -triple spir-unknown-unknown -verify -pedantic -fsyntax-only
+// RUN: %clang_cc1 %s -triple spir-unknown-unknown -verify -fsyntax-only -cl-std=CL2.0 -DCL20
+// RUN: %clang_cc1 %s -triple spir-unknown-unknown -verify -fsyntax-only -cl-std=CL2.0 -DCL20 -DEXT
#ifdef EXT
#pragma OPENCL EXTENSION cl_khr_int64_base_atomics:enable
#pragma OPENCL EXTENSION cl_khr_int64_extended_atomics:enable
#pragma OPENCL EXTENSION cl_khr_fp64:enable
+#if __OPENCL_C_VERSION__ >= CL_VERSION_1_2
+// expected-warning@-2{{OpenCL extension 'cl_khr_fp64' is core feature or supported optional core feature - ignoring}}
+#endif
#endif
void atomic_types_test() {
@@ -44,15 +47,14 @@ void atomic_types_test() {
// expected-error@-28 {{use of type 'atomic_ulong' (aka '_Atomic(unsigned long)') requires cl_khr_int64_extended_atomics extension to be enabled}}
// expected-error@-27 {{use of type 'atomic_double' (aka '_Atomic(double)') requires cl_khr_int64_base_atomics extension to be enabled}}
// expected-error@-28 {{use of type 'atomic_double' (aka '_Atomic(double)') requires cl_khr_int64_extended_atomics extension to be enabled}}
-// expected-error@-29 {{use of type 'atomic_double' (aka '_Atomic(double)') requires cl_khr_fp64 extension to be enabled}}
-// expected-error-re@-28 {{use of type 'atomic_intptr_t' (aka '_Atomic({{.+}})') requires cl_khr_int64_base_atomics extension to be enabled}}
-// expected-error-re@-29 {{use of type 'atomic_intptr_t' (aka '_Atomic({{.+}})') requires cl_khr_int64_extended_atomics extension to be enabled}}
-// expected-error-re@-29 {{use of type 'atomic_uintptr_t' (aka '_Atomic({{.+}})') requires cl_khr_int64_base_atomics extension to be enabled}}
-// expected-error-re@-30 {{use of type 'atomic_uintptr_t' (aka '_Atomic({{.+}})') requires cl_khr_int64_extended_atomics extension to be enabled}}
-// expected-error-re@-30 {{use of type 'atomic_size_t' (aka '_Atomic({{.+}})') requires cl_khr_int64_base_atomics extension to be enabled}}
-// expected-error-re@-31 {{use of type 'atomic_size_t' (aka '_Atomic({{.+}})') requires cl_khr_int64_extended_atomics extension to be enabled}}
-// expected-error-re@-31 {{use of type 'atomic_ptrdiff_t' (aka '_Atomic({{.+}})') requires cl_khr_int64_base_atomics extension to be enabled}}
-// expected-error-re@-32 {{use of type 'atomic_ptrdiff_t' (aka '_Atomic({{.+}})') requires cl_khr_int64_extended_atomics extension to be enabled}}
+// expected-error-re@-27 {{use of type 'atomic_intptr_t' (aka '_Atomic({{.+}})') requires cl_khr_int64_base_atomics extension to be enabled}}
+// expected-error-re@-28 {{use of type 'atomic_intptr_t' (aka '_Atomic({{.+}})') requires cl_khr_int64_extended_atomics extension to be enabled}}
+// expected-error-re@-28 {{use of type 'atomic_uintptr_t' (aka '_Atomic({{.+}})') requires cl_khr_int64_base_atomics extension to be enabled}}
+// expected-error-re@-29 {{use of type 'atomic_uintptr_t' (aka '_Atomic({{.+}})') requires cl_khr_int64_extended_atomics extension to be enabled}}
+// expected-error-re@-29 {{use of type 'atomic_size_t' (aka '_Atomic({{.+}})') requires cl_khr_int64_base_atomics extension to be enabled}}
+// expected-error-re@-30 {{use of type 'atomic_size_t' (aka '_Atomic({{.+}})') requires cl_khr_int64_extended_atomics extension to be enabled}}
+// expected-error-re@-30 {{use of type 'atomic_ptrdiff_t' (aka '_Atomic({{.+}})') requires cl_khr_int64_base_atomics extension to be enabled}}
+// expected-error-re@-31 {{use of type 'atomic_ptrdiff_t' (aka '_Atomic({{.+}})') requires cl_khr_int64_extended_atomics extension to be enabled}}
#endif
#ifdef CL20
diff --git a/clang/test/Parser/opencl-pragma.cl b/clang/test/Parser/opencl-pragma.cl
index 4c48b2a496f..b002b0854a4 100644
--- a/clang/test/Parser/opencl-pragma.cl
+++ b/clang/test/Parser/opencl-pragma.cl
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -verify -pedantic -Wno-empty-translation-unit -fsyntax-only
+// RUN: %clang_cc1 %s -verify -pedantic -Wno-empty-translation-unit -fsyntax-only -triple spir-unknown-unknown
#pragma OPENCL EXTENSION cl_khr_fp16 : enable
diff --git a/clang/test/Parser/opencl-storage-class.cl b/clang/test/Parser/opencl-storage-class.cl
index 6316ba7701d..a8ebc1af399 100644
--- a/clang/test/Parser/opencl-storage-class.cl
+++ b/clang/test/Parser/opencl-storage-class.cl
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -verify -fsyntax-only
+// RUN: %clang_cc1 %s -verify -fsyntax-only -triple spir-unknown-unknown
void test_storage_class_specs()
{
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;
-}
OpenPOWER on IntegriCloud