summaryrefslogtreecommitdiff
path: root/lib/Frontend/CompilerInvocation.cpp
diff options
context:
space:
mode:
authorArtem Belevich <tra@google.com>2016-05-19 18:44:45 +0000
committerArtem Belevich <tra@google.com>2016-05-19 18:44:45 +0000
commitf159984fe052abd07234c80f7cc15902ba8e297d (patch)
treeca379ef47943339c8f7feacdc0c92bfd854ece23 /lib/Frontend/CompilerInvocation.cpp
parent9a0c2517ad81a849ec57558a3ce4283ce78eda77 (diff)
downloadclang-f159984fe052abd07234c80f7cc15902ba8e297d.tar.gz
[CUDA] Enable fusing FP ops (-ffp-contract=fast) for CUDA by default.
This matches default nvcc behavior and gives substantial performance boost on GPU where fmad is much cheaper compared to add+mul. Differential Revision: http://reviews.llvm.org/D20341 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@270094 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend/CompilerInvocation.cpp')
-rw-r--r--lib/Frontend/CompilerInvocation.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp
index 7c3850eeab..c5f839e673 100644
--- a/lib/Frontend/CompilerInvocation.cpp
+++ b/lib/Frontend/CompilerInvocation.cpp
@@ -2255,10 +2255,15 @@ bool CompilerInvocation::CreateFromArgs(CompilerInvocation &Res,
LangOpts.ObjCExceptions = 1;
}
- // During CUDA device-side compilation, the aux triple is the triple used for
- // host compilation.
- if (LangOpts.CUDA && LangOpts.CUDAIsDevice) {
- Res.getTargetOpts().HostTriple = Res.getFrontendOpts().AuxTriple;
+ if (LangOpts.CUDA) {
+ // During CUDA device-side compilation, the aux triple is the
+ // triple used for host compilation.
+ if (LangOpts.CUDAIsDevice)
+ Res.getTargetOpts().HostTriple = Res.getFrontendOpts().AuxTriple;
+
+ // Set default FP_CONTRACT to FAST.
+ if (!Args.hasArg(OPT_ffp_contract))
+ Res.getCodeGenOpts().setFPContractMode(CodeGenOptions::FPC_Fast);
}
// FIXME: Override value name discarding when asan or msan is used because the