summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/BackendUtil.cpp
diff options
context:
space:
mode:
authorLang Hames <lhames@gmail.com>2012-07-06 00:59:19 +0000
committerLang Hames <lhames@gmail.com>2012-07-06 00:59:19 +0000
commitaa53b936ec70f2b1adeb7ac9a698fa99ff9622bc (patch)
tree013a18364576a887f4310f6e554750e400900db2 /clang/lib/CodeGen/BackendUtil.cpp
parentc7ac1bb94cb7530e5087a6272d8aa3fcb6a5faf3 (diff)
downloadbcm5719-llvm-aa53b936ec70f2b1adeb7ac9a698fa99ff9622bc.tar.gz
bcm5719-llvm-aa53b936ec70f2b1adeb7ac9a698fa99ff9622bc.zip
Add -ffp-contract = { fast | on | off } command line option support.
This flag sets the 'fp-contract' mode, which controls the formation of fused floating point operations. Available modes are: - Fast: Form fused operations anywhere. - On: Form fused operations where allowed by FP_CONTRACT. This is the default mode. - Off: Don't form fused operations (in future this may be relaxed to forming fused operations where it can be proved that the result won't be affected). Currently clang doesn't support the FP_CONTRACT pragma, so the 'On' and 'Off' modes are equivalent. llvm-svn: 159794
Diffstat (limited to 'clang/lib/CodeGen/BackendUtil.cpp')
-rw-r--r--clang/lib/CodeGen/BackendUtil.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/BackendUtil.cpp b/clang/lib/CodeGen/BackendUtil.cpp
index 5a97875ef4b..0a1915b485d 100644
--- a/clang/lib/CodeGen/BackendUtil.cpp
+++ b/clang/lib/CodeGen/BackendUtil.cpp
@@ -351,6 +351,19 @@ bool EmitAssemblyHelper::AddEmitPasses(BackendAction Action,
Options.FloatABIType = llvm::FloatABI::Default;
}
+ // Set FP fusion mode.
+ switch (LangOpts.getFPContractMode()) {
+ case LangOptions::FPC_Off:
+ Options.AllowFPOpFusion = llvm::FPOpFusion::Strict;
+ break;
+ case LangOptions::FPC_On:
+ Options.AllowFPOpFusion = llvm::FPOpFusion::Standard;
+ break;
+ case LangOptions::FPC_Fast:
+ Options.AllowFPOpFusion = llvm::FPOpFusion::Fast;
+ break;
+ }
+
Options.LessPreciseFPMADOption = CodeGenOpts.LessPreciseFPMAD;
Options.NoInfsFPMath = CodeGenOpts.NoInfsFPMath;
Options.NoNaNsFPMath = CodeGenOpts.NoNaNsFPMath;
OpenPOWER on IntegriCloud