diff options
author | Yaxun Liu <Yaxun.Liu@amd.com> | 2016-08-09 19:43:38 +0000 |
---|---|---|
committer | Yaxun Liu <Yaxun.Liu@amd.com> | 2016-08-09 19:43:38 +0000 |
commit | 864b7d21ba3baf85089a6117361e3afbe04664c6 (patch) | |
tree | e781ce74c3681b5d4d90bd77211638e8d2b4e59d /include | |
parent | 6728a34cae89a1af83ca96848090339adc598cc2 (diff) | |
download | clang-864b7d21ba3baf85089a6117361e3afbe04664c6.tar.gz |
[OpenCL][AMDGPU] Add support for -cl-denorms-are-zero
Adjust target features for amdgcn target when -cl-denorms-are-zero is set.
Denormal support is controlled by feature strings fp32-denormals fp64-denormals in amdgcn target. If -cl-denorms-are-zero is not set and the command line does not set fp32/64-denormals feature string, +fp32-denormals +fp64-denormals will be on for GPU's supporting them.
A new virtual function virtual void TargetInfo::adjustTargetOptions(const CodeGenOptions &CGOpts, TargetOptions &TargetOpts) const is introduced to allow adjusting target option by codegen option.
Differential Revision: https://reviews.llvm.org/D22815
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@278151 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/clang/Basic/TargetInfo.h | 5 | ||||
-rw-r--r-- | include/clang/Frontend/CodeGenOptions.def | 1 |
2 files changed, 6 insertions, 0 deletions
diff --git a/include/clang/Basic/TargetInfo.h b/include/clang/Basic/TargetInfo.h index 958c28ecfe..a9378f83af 100644 --- a/include/clang/Basic/TargetInfo.h +++ b/include/clang/Basic/TargetInfo.h @@ -40,6 +40,7 @@ struct fltSemantics; namespace clang { class DiagnosticsEngine; class LangOptions; +class CodeGenOptions; class MacroBuilder; class SourceLocation; class SourceManager; @@ -797,6 +798,10 @@ public: /// language options which change the target configuration. virtual void adjust(const LangOptions &Opts); + /// \brief Adjust target options based on codegen options. + virtual void adjustTargetOptions(const CodeGenOptions &CGOpts, + TargetOptions &TargetOpts) const {} + /// \brief Initialize the map with the default set of target features for the /// CPU this should include all legal feature strings on the target. /// diff --git a/include/clang/Frontend/CodeGenOptions.def b/include/clang/Frontend/CodeGenOptions.def index 5895bebc9c..8e8ca38b9e 100644 --- a/include/clang/Frontend/CodeGenOptions.def +++ b/include/clang/Frontend/CodeGenOptions.def @@ -110,6 +110,7 @@ CODEGENOPT(ReciprocalMath , 1, 0) ///< Allow FP divisions to be reassociated. CODEGENOPT(NoInline , 1, 0) ///< Set when -fno-inline is enabled. ///< Disables use of the inline keyword. CODEGENOPT(NoNaNsFPMath , 1, 0) ///< Assume FP arguments, results not NaN. +CODEGENOPT(FlushDenorm , 1, 0) ///< Allow FP denorm numbers to be flushed to zero CODEGENOPT(NoZeroInitializedInBSS , 1, 0) ///< -fno-zero-initialized-in-bss. /// \brief Method of Objective-C dispatch to use. ENUM_CODEGENOPT(ObjCDispatchMethod, ObjCDispatchMethodKind, 2, Legacy) |