]> granicus.if.org Git - clang/commitdiff
Revert "[OpenCL] Add supported OpenCL extensions to target info."
authorYaxun Liu <Yaxun.Liu@amd.com>
Fri, 13 May 2016 17:16:26 +0000 (17:16 +0000)
committerYaxun Liu <Yaxun.Liu@amd.com>
Fri, 13 May 2016 17:16:26 +0000 (17:16 +0000)
Revert r269431 due to build failure caused by warning msg:

  llvm/tools/clang/lib/Basic/Targets.cpp:2090:9: error: 'setSupportedOpenCLOpts' overrides a member function but is not marked 'override' [-Werror,-Winconsistent-missing-override]
   void setSupportedOpenCLOpts() {

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@269435 91177308-0d34-0410-b5e6-96231b3b80d8

28 files changed:
include/clang/Basic/DiagnosticParseKinds.td
include/clang/Basic/LangOptions.h
include/clang/Basic/OpenCLExtensions.def
include/clang/Basic/OpenCLOptions.h [deleted file]
include/clang/Basic/TargetInfo.h
include/clang/Basic/TargetOptions.h
lib/Basic/Targets.cpp
lib/Frontend/InitPreprocessor.cpp
lib/Parse/ParsePragma.cpp
lib/Sema/Sema.cpp
test/CodeGenOpenCL/builtins-r600.cl
test/CodeGenOpenCL/fpmath.cl
test/CodeGenOpenCL/half.cl
test/Lexer/opencl-half-literal.cl
test/Misc/languageOptsOpenCL.cl
test/PCH/opencl-extensions.cl
test/Parser/opencl-astype.cl
test/Parser/opencl-atomics-cl20.cl
test/Parser/opencl-pragma.cl
test/Parser/opencl-storage-class.cl
test/SemaOpenCL/extension-fp64-cl1.1.cl [new file with mode: 0644]
test/SemaOpenCL/extension-fp64.cl [new file with mode: 0644]
test/SemaOpenCL/extensions.cl [deleted file]
test/SemaOpenCL/half.cl
test/SemaOpenCL/invalid-kernel-parameters.cl
test/SemaOpenCL/invalid-logical-ops-1.2.cl
test/SemaOpenCL/optional-core-fp64-cl1.2.cl [new file with mode: 0644]
test/SemaOpenCL/optional-core-fp64-cl2.0.cl [new file with mode: 0644]

index f54e3f3eaae11b6a13315999fdf1dfa4927246d2..c3eea00e1be4125c8a005c61d92e81e55a9783f6 100644 (file)
@@ -926,10 +926,6 @@ def warn_pragma_expected_enable_disable : Warning<
   "expected 'enable' or 'disable' - ignoring">, InGroup<IgnoredPragmas>;
 def warn_pragma_unknown_extension : Warning<
   "unknown OpenCL extension %0 - ignoring">, InGroup<IgnoredPragmas>;
-def warn_pragma_unsupported_extension : Warning<
-  "unsupported OpenCL extension %0 - ignoring">, InGroup<IgnoredPragmas>;
-def warn_pragma_extension_is_core : Warning<
-  "OpenCL extension %0 is core feature or supported optional core feature - ignoring">, InGroup<IgnoredPragmas>;
 
 // OpenCL errors.
 def err_opencl_taking_function_address_parser : Error<
index 4da7a56cb3dfc200d165820df3cb78b9fef36652..a069a8f8b8f47aa68f207ebc2296b898d3c88bd2 100644 (file)
@@ -160,6 +160,18 @@ public:
     fp_contract(LangOpts.DefaultFPContract) {}
 };
 
+/// \brief OpenCL volatile options
+class OpenCLOptions {
+public:
+#define OPENCLEXT(nm)  unsigned nm : 1;
+#include "clang/Basic/OpenCLExtensions.def"
+
+  OpenCLOptions() {
+#define OPENCLEXT(nm)   nm = 0;
+#include "clang/Basic/OpenCLExtensions.def"
+  }
+};
+
 /// \brief Describes the kind of translation unit being processed.
 enum TranslationUnitKind {
   /// \brief The translation unit is a complete translation unit.
index 70c45bba302cdbe8ddcdb20de4cfc2424d0d4393..91fd9195b190295980c7ab38a89faf6735fbf996 100644 (file)
 //
 //===----------------------------------------------------------------------===//
 
-// Macro OPENCLEXT or OPENCLEXT_INTERNAL can be defined to enumerate the
-// OpenCL extensions listed in this file.
-//
-// If the extensions are to be enumerated without the supported OpenCL version,
-// define OPENCLEXT(ext) where ext is the name of the extension.
-//
-// If the extensions are to be enumerated with supported OpenCL version,
-// define OPENCLEXT_INTERNAL(ext, avail, core) where
-//   ext - name of the extension or optional core feature.
-//   avail - minimum OpenCL version supporting it.
-//   core - minimum OpenCL version when the extension becomes optional core
-//          feature or core feature. ~0U indicates not a core feature or an
-//          optional core feature.
-
-#ifndef OPENCLEXT_INTERNAL
-#ifndef OPENCLEXT
-#pragma error "macro OPENCLEXT or OPENCLEXT_INTERNAL is required"
-#else
-#define OPENCLEXT_INTERNAL(ext, ...) OPENCLEXT(ext)
-#endif // OPENCLEXT
-#endif // OPENCLEXT_INTERNAL
-
-// OpenCL 1.0.
-OPENCLEXT_INTERNAL(cl_khr_3d_image_writes, 100, 120)
-OPENCLEXT_INTERNAL(cl_khr_byte_addressable_store, 100, 110)
-OPENCLEXT_INTERNAL(cl_khr_fp16, 100, ~0U)
-OPENCLEXT_INTERNAL(cl_khr_fp64, 100, 120)
-OPENCLEXT_INTERNAL(cl_khr_global_int32_base_atomics, 100, 110)
-OPENCLEXT_INTERNAL(cl_khr_global_int32_extended_atomics, 100, 110)
-OPENCLEXT_INTERNAL(cl_khr_gl_sharing, 100, ~0U)
-OPENCLEXT_INTERNAL(cl_khr_icd, 100, ~0U)
-OPENCLEXT_INTERNAL(cl_khr_local_int32_base_atomics, 100, 110)
-OPENCLEXT_INTERNAL(cl_khr_local_int32_extended_atomics, 100, 110)
-
 // OpenCL 1.1.
-OPENCLEXT_INTERNAL(cl_khr_d3d10_sharing, 110, ~0U)
-OPENCLEXT_INTERNAL(cl_khr_gl_event, 110, ~0U)
-OPENCLEXT_INTERNAL(cl_khr_int64_base_atomics, 110, ~0U)
-OPENCLEXT_INTERNAL(cl_khr_int64_extended_atomics, 110, ~0U)
-
-// OpenCL 1.2.
-OPENCLEXT_INTERNAL(cl_khr_d3d11_sharing, 120, ~0U)
-OPENCLEXT_INTERNAL(cl_khr_depth_images, 120, ~0U)
-OPENCLEXT_INTERNAL(cl_khr_dx9_media_sharing, 120, ~0U)
-OPENCLEXT_INTERNAL(cl_khr_gl_depth_images, 120, ~0U)
-OPENCLEXT_INTERNAL(cl_khr_spir, 120, ~0U)
-
-// OpenCL 2.0.
-OPENCLEXT_INTERNAL(cl_khr_egl_event, 200, ~0U)
-OPENCLEXT_INTERNAL(cl_khr_egl_image, 200, ~0U)
-OPENCLEXT_INTERNAL(cl_khr_gl_msaa_sharing, 200, ~0U)
-OPENCLEXT_INTERNAL(cl_khr_initialize_memory, 200, ~0U)
-OPENCLEXT_INTERNAL(cl_khr_srgb_image_writes, 200, ~0U)
-OPENCLEXT_INTERNAL(cl_khr_subgroups, 200, ~0U)
-OPENCLEXT_INTERNAL(cl_khr_terminate_context, 200, ~0U)
+OPENCLEXT(cl_khr_fp64)
+OPENCLEXT(cl_khr_int64_base_atomics)
+OPENCLEXT(cl_khr_int64_extended_atomics)
+OPENCLEXT(cl_khr_fp16)
+OPENCLEXT(cl_khr_gl_sharing)
+OPENCLEXT(cl_khr_gl_event)
+OPENCLEXT(cl_khr_d3d10_sharing)
+OPENCLEXT(cl_khr_global_int32_base_atomics)
+OPENCLEXT(cl_khr_global_int32_extended_atomics)
+OPENCLEXT(cl_khr_local_int32_base_atomics)
+OPENCLEXT(cl_khr_local_int32_extended_atomics)
+OPENCLEXT(cl_khr_byte_addressable_store)
+OPENCLEXT(cl_khr_3d_image_writes)
+
+// OpenCL 2.0
+OPENCLEXT(cl_khr_gl_msaa_sharing)
 
 // Clang Extensions.
-OPENCLEXT_INTERNAL(cl_clang_storage_class_specifiers, 100, ~0U)
-
-#undef OPENCLEXT_INTERNAL
+OPENCLEXT(cl_clang_storage_class_specifiers)
 
-#ifdef OPENCLEXT
 #undef OPENCLEXT
-#endif
diff --git a/include/clang/Basic/OpenCLOptions.h b/include/clang/Basic/OpenCLOptions.h
deleted file mode 100644 (file)
index 4aaa3d7..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-//===--- OpenCLOptions.h ----------------------------------------*- C++ -*-===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-///
-/// \file
-/// \brief Defines the clang::OpenCLOptions class.
-///
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_CLANG_BASIC_OPENCLOPTIONS_H
-#define LLVM_CLANG_BASIC_OPENCLOPTIONS_H
-
-#include <string>
-#include <vector>
-
-namespace clang {
-
-/// \brief OpenCL supported extensions and optional core features
-class OpenCLOptions {
-public:
-#define OPENCLEXT(nm) unsigned nm : 1;
-#include "clang/Basic/OpenCLExtensions.def"
-
-  OpenCLOptions() {
-#define OPENCLEXT(nm)   nm = 0;
-#include "clang/Basic/OpenCLExtensions.def"
-  }
-
-  // Enable all options.
-  void setAll() {
-#define OPENCLEXT(nm)   nm = 1;
-#include "clang/Basic/OpenCLExtensions.def"
-  }
-
-  // Is supported with OpenCL version \p OCLVer.
-#define OPENCLEXT_INTERNAL(Ext, Avail, ...) \
-  bool is_##Ext##_supported(unsigned OCLVer) const { \
-    return Ext && OCLVer >= Avail; \
-  }
-#include "clang/Basic/OpenCLExtensions.def"
-
-
-  // Is supported OpenCL extension with OpenCL version \p OCLVer.
-  // For supported optional core feature, return false.
-#define OPENCLEXT_INTERNAL(Ext, Avail, Core) \
-  bool is_##Ext##_supported_extension(unsigned CLVer) const { \
-    return is_##Ext##_supported(CLVer) && (Core == ~0U || CLVer < Core); \
-  }
-#include "clang/Basic/OpenCLExtensions.def"
-
-  // Is supported OpenCL core features with OpenCL version \p OCLVer.
-  // For supported extension, return false.
-#define OPENCLEXT_INTERNAL(Ext, Avail, Core) \
-  bool is_##Ext##_supported_core(unsigned CLVer) const { \
-    return is_##Ext##_supported(CLVer) && Core != ~0U && CLVer >= Core; \
-  }
-#include "clang/Basic/OpenCLExtensions.def"
-
-};
-
-}  // end namespace clang
-
-#endif
index 950e8b9a4a6de69e3df71168920759de4dba45a8..cf76daee713ab7a04195db82d70e896582200f64 100644 (file)
@@ -969,19 +969,6 @@ public:
   /// \brief Whether target allows to overalign ABI-specified prefered alignment
   virtual bool allowsLargerPreferedTypeAlignment() const { return true; }
 
-  /// \brief Set supported OpenCL extensions and optional core features.
-  virtual void setSupportedOpenCLOpts() {}
-
-  /// \brief Get supported OpenCL extensions and optional core features.
-  OpenCLOptions &getSupportedOpenCLOpts() {
-    return getTargetOpts().SupportedOpenCLOptions;
-  }
-
-  /// \brief Get const supported OpenCL extensions and optional core features.
-  const OpenCLOptions &getSupportedOpenCLOpts() const {
-      return getTargetOpts().SupportedOpenCLOptions;
-  }
-
 protected:
   virtual uint64_t getPointerWidthV(unsigned AddrSpace) const {
     return PointerWidth;
index fde294c922515ff7e3954ef142239417cb5bb02d..81fb7b21170df938823fb9b9a4d4692485414f67 100644 (file)
@@ -17,7 +17,6 @@
 
 #include <string>
 #include <vector>
-#include "clang/Basic/OpenCLOptions.h"
 
 namespace clang {
 
@@ -55,9 +54,6 @@ public:
   std::vector<std::string> Features;
 
   std::vector<std::string> Reciprocals;
-
-  /// Supported OpenCL extensions and optional core features.
-  OpenCLOptions SupportedOpenCLOptions;
 };
 
 }  // end namespace clang
index b1b12e468bff4f95e537fa3355015140f119a83a..4ca67ac08caa66894e66fb611bb55da7409ce3a4 100644 (file)
@@ -1999,6 +1999,17 @@ public:
       Builder.defineMacro("__HAS_FMAF__");
     if (hasLDEXPF)
       Builder.defineMacro("__HAS_LDEXPF__");
+    if (hasFP64 && Opts.OpenCL)
+      Builder.defineMacro("cl_khr_fp64");
+    if (Opts.OpenCL) {
+      if (GPU >= GK_NORTHERN_ISLANDS) {
+        Builder.defineMacro("cl_khr_byte_addressable_store");
+        Builder.defineMacro("cl_khr_global_int32_base_atomics");
+        Builder.defineMacro("cl_khr_global_int32_extended_atomics");
+        Builder.defineMacro("cl_khr_local_int32_base_atomics");
+        Builder.defineMacro("cl_khr_local_int32_extended_atomics");
+      }
+    }
   }
 
   BuiltinVaListKind getBuiltinVaListKind() const override {
@@ -2086,31 +2097,6 @@ public:
 
     return true;
   }
-
-   void setSupportedOpenCLOpts() {
-     auto &Opts = getSupportedOpenCLOpts();
-     Opts.cl_clang_storage_class_specifiers = 1;
-     Opts.cl_khr_gl_sharing = 1;
-     Opts.cl_khr_gl_event = 1;
-     Opts.cl_khr_d3d10_sharing = 1;
-     Opts.cl_khr_subgroups = 1;
-
-     if (hasFP64)
-       Opts.cl_khr_fp64 = 1;
-     if (GPU >= GK_NORTHERN_ISLANDS) {
-       Opts.cl_khr_byte_addressable_store = 1;
-       Opts.cl_khr_global_int32_base_atomics = 1;
-       Opts.cl_khr_global_int32_extended_atomics = 1;
-       Opts.cl_khr_local_int32_base_atomics = 1;
-       Opts.cl_khr_local_int32_extended_atomics = 1;
-     }
-     if (GPU >= GK_SOUTHERN_ISLANDS)
-       Opts.cl_khr_fp16 = 1;
-       Opts.cl_khr_int64_base_atomics = 1;
-       Opts.cl_khr_int64_extended_atomics = 1;
-       Opts.cl_khr_3d_image_writes = 1;
-       Opts.cl_khr_gl_msaa_sharing = 1;
-  }
 };
 
 const Builtin::Info AMDGPUTargetInfo::BuiltinInfo[] = {
@@ -2730,10 +2716,6 @@ public:
   bool hasSjLjLowering() const override {
     return true;
   }
-
-  void setSupportedOpenCLOpts() {
-    getSupportedOpenCLOpts().setAll();
-  }
 };
 
 bool X86TargetInfo::setFPMath(StringRef Name) {
@@ -7876,12 +7858,6 @@ public:
   CallingConv getDefaultCallingConv(CallingConvMethodType MT) const override {
     return CC_SpirFunction;
   }
-
-  void setSupportedOpenCLOpts() {
-    // Assume all OpenCL extensions and optional core features are supported
-    // for SPIR since it is a generic target.
-    getSupportedOpenCLOpts().setAll();
-  }
 };
 
 class SPIR32TargetInfo : public SPIRTargetInfo {
@@ -8482,7 +8458,5 @@ TargetInfo::CreateTargetInfo(DiagnosticsEngine &Diags,
   if (!Target->handleTargetFeatures(Opts->Features, Diags))
     return nullptr;
 
-  Target->setSupportedOpenCLOpts();
-
   return Target.release();
 }
index 5d38d5f95035290823b7d9607fdc5969ebdb0b80..1c7793e285ad7a8e19e6731839b00a4e0883f159 100644 (file)
@@ -938,15 +938,6 @@ static void InitializePredefinedMacros(const TargetInfo &TI,
     Builder.defineMacro("__CUDA_ARCH__");
   }
 
-  // OpenCL definitions.
-  if (LangOpts.OpenCL) {
-#define OPENCLEXT(Ext) \
-    if (TI.getSupportedOpenCLOpts().is_##Ext##_supported( \
-        LangOpts.OpenCLVersion)) \
-      Builder.defineMacro(#Ext);
-#include "clang/Basic/OpenCLExtensions.def"
-  }
-
   // Get other target #defines.
   TI.getTargetDefines(LangOpts, Builder);
 }
index 9e9a749bb98d76635de2552f68ce0e1b662f27f5..6024a6221084212b7c652eff424b5a1d23ce1f02 100644 (file)
@@ -468,24 +468,14 @@ void Parser::HandlePragmaOpenCLExtension() {
   ConsumeToken(); // The annotation token.
 
   OpenCLOptions &f = Actions.getOpenCLOptions();
-  auto CLVer = getLangOpts().OpenCLVersion;
-  auto &Supp = getTargetInfo().getSupportedOpenCLOpts();
   // OpenCL 1.1 9.1: "The all variant sets the behavior for all extensions,
   // overriding all previously issued extension directives, but only if the
   // behavior is set to disable."
   if (state == 0 && ename->isStr("all")) {
-#define OPENCLEXT(nm) \
-    if (Supp.is_##nm##_supported_extension(CLVer)) \
-      f.nm = 0;
+#define OPENCLEXT(nm)   f.nm = 0;
 #include "clang/Basic/OpenCLExtensions.def"
   }
-#define OPENCLEXT(nm) else if (ename->isStr(#nm)) \
-   if (Supp.is_##nm##_supported_extension(CLVer)) \
-     f.nm = state; \
-   else if (Supp.is_##nm##_supported_core(CLVer)) \
-     PP.Diag(NameLoc, diag::warn_pragma_extension_is_core) << ename; \
-   else \
-     PP.Diag(NameLoc, diag::warn_pragma_unsupported_extension) << ename;
+#define OPENCLEXT(nm) else if (ename->isStr(#nm)) { f.nm = state; }
 #include "clang/Basic/OpenCLExtensions.def"
   else {
     PP.Diag(NameLoc, diag::warn_pragma_unknown_extension) << ename;
index 35e303ee923b146f46e5bd4744a1bb9b8a3b78d6..d8d10b637ec0d5ea295de71326f9f27c88badb03 100644 (file)
@@ -207,14 +207,8 @@ void Sema::Initialize() {
     addImplicitTypedef("size_t", Context.getSizeType());
   }
 
-  // Initialize predefined OpenCL types and supported optional core features.
+  // Initialize predefined OpenCL types.
   if (getLangOpts().OpenCL) {
-#define OPENCLEXT(Ext) \
-     if (Context.getTargetInfo().getSupportedOpenCLOpts().is_##Ext##_supported_core( \
-         getLangOpts().OpenCLVersion)) \
-       getOpenCLOptions().Ext = 1;
-#include "clang/Basic/OpenCLExtensions.def"
-
     addImplicitTypedef("sampler_t", Context.OCLSamplerTy);
     addImplicitTypedef("event_t", Context.OCLEventTy);
     if (getLangOpts().OpenCLVersion >= 200) {
index 6369f3d83dbc99430d94ae82ac07246be9a9e483..001dc06f5978c54c026c7a13852b5d031d837e58 100644 (file)
@@ -1,5 +1,5 @@
 // REQUIRES: amdgpu-registered-target
-// RUN: %clang_cc1 -triple r600-unknown-unknown -target-cpu rv670 -S -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple r600-unknown-unknown -S -emit-llvm -o - %s | FileCheck %s
 
 #pragma OPENCL EXTENSION cl_khr_fp64 : enable
 
index 88df3bf166abbc2bc57f05b66039a5752b911e1a..ef4da845529c611cf7af1b5dadf1c0b48f78b077 100644 (file)
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -emit-llvm -o - -triple spir-unknown-unknown | FileCheck %s
+// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
 
 typedef __attribute__(( ext_vector_type(4) )) float float4;
 
index 9acabf0a2a83c7078cd91343f0fe5aa689c3ca73..bd5ae7f649900ce6b352172a5626bc634d1bf8bf 100644 (file)
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -emit-llvm -o - -triple spir-unknown-unknown | FileCheck %s
+// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
 
 #pragma OPENCL EXTENSION cl_khr_fp16 : enable
 
index 42ca5146b1fb5ca86f958c2700379f6ba8ae1856..2415ee4fd8c984d5c12ed36eab5bf1d6191f5417 100644 (file)
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -fsyntax-only -verify -triple spir-unknown-unknown
+// RUN: %clang_cc1 %s -fsyntax-only -verify
 
 #pragma OPENCL EXTENSION cl_khr_fp16 : enable
 
index 9651f01a7dc59d52f1da14ee402e87cc4cd95689..82a8f3614f378bace73b06c6365e0b7dc99f07df 100644 (file)
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -x cl %s -verify -triple spir-unknown-unknown
+// RUN: %clang_cc1 -x cl %s -verify
 // expected-no-diagnostics
 
 // Test the forced language options for OpenCL are set correctly.
index d6d541658a18e847e030f7c65243fd8c7dd99e32..a22b007f9d540438c3772c95dc523421d74b38e9 100644 (file)
@@ -1,5 +1,5 @@
-// 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
+// RUN: %clang_cc1 -emit-pch -o %t %s
+// RUN: %clang_cc1 -include-pch %t -fsyntax-only %s 
 
 #ifndef HEADER
 #define HEADER
index 903c42ee8c14b09637e8e4f9cb411e78725e0815..72f98a4ace9ff131181cb3eb539b2489da89b02e 100644 (file)
@@ -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_fp64 : enable
 
 void test_astype() {
index 20f969645fe01587f8b1e10b9e2688df8a535f18..cb2f59721acc0c33ac8da6aedccb86f79e4d3fb2 100644 (file)
@@ -1,14 +1,11 @@
-// 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
+// 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
 
 #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() {
@@ -47,14 +44,15 @@ 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-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}}
+// 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}}
 #endif
 
 #ifdef CL20
index b002b0854a4d0164d0eb9d1d87767dee90dff75d..4c48b2a496f78ae15faa467cd3b9a046aa9d4d52 100644 (file)
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -verify -pedantic -Wno-empty-translation-unit -fsyntax-only -triple spir-unknown-unknown
+// RUN: %clang_cc1 %s -verify -pedantic -Wno-empty-translation-unit -fsyntax-only
 
 #pragma OPENCL EXTENSION cl_khr_fp16 : enable
 
index a8ebc1af399939bdf64062e7f8a2646267b8ecf4..6316ba7701da62b9bb16a003a0ae883e7816b972 100644 (file)
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -verify -fsyntax-only -triple spir-unknown-unknown
+// RUN: %clang_cc1 %s -verify -fsyntax-only
 
 void test_storage_class_specs()
 {
diff --git a/test/SemaOpenCL/extension-fp64-cl1.1.cl b/test/SemaOpenCL/extension-fp64-cl1.1.cl
new file mode 100644 (file)
index 0000000..7e852ae
--- /dev/null
@@ -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/test/SemaOpenCL/extension-fp64.cl b/test/SemaOpenCL/extension-fp64.cl
new file mode 100644 (file)
index 0000000..e0c2b1e
--- /dev/null
@@ -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/test/SemaOpenCL/extensions.cl b/test/SemaOpenCL/extensions.cl
deleted file mode 100644 (file)
index 31224e0..0000000
+++ /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}}
-}
index dd7bb9ab8c5d4496b35321c61f477f49e5273a46..f8cc017bb8525403ea7743da114ab01ebb53cbae 100644 (file)
@@ -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}}
index e2e48e83c6b9f359bf94afa6104e2d4200b80f0e..a30a27faa9121628c64f3a9949e5945673f83f41 100644 (file)
@@ -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
 
index 96602ce6844aab12924dde9997342417a576dd24..7ba1adbf53e0e53a23749998272eca629582e9a7 100644 (file)
@@ -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/test/SemaOpenCL/optional-core-fp64-cl1.2.cl b/test/SemaOpenCL/optional-core-fp64-cl1.2.cl
new file mode 100644 (file)
index 0000000..e0f7f1d
--- /dev/null
@@ -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/test/SemaOpenCL/optional-core-fp64-cl2.0.cl b/test/SemaOpenCL/optional-core-fp64-cl2.0.cl
new file mode 100644 (file)
index 0000000..832529d
--- /dev/null
@@ -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;
+}