diff options
author | Artem Belevich <tra@google.com> | 2016-05-19 18:44:45 +0000 |
---|---|---|
committer | Artem Belevich <tra@google.com> | 2016-05-19 18:44:45 +0000 |
commit | 31c3bad4999dbe8757ec55dc658a427f9985947a (patch) | |
tree | 0e5b2cfa71981a3de67335a36b5bddb7effebfdd /clang/lib/Frontend/CompilerInvocation.cpp | |
parent | cb2d2663607e3d4963f7d670e37ade81037ae50d (diff) | |
download | llvm-31c3bad4999dbe8757ec55dc658a427f9985947a.zip llvm-31c3bad4999dbe8757ec55dc658a427f9985947a.tar.gz llvm-31c3bad4999dbe8757ec55dc658a427f9985947a.tar.bz2 |
[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
llvm-svn: 270094
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
-rw-r--r-- | clang/lib/Frontend/CompilerInvocation.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp index 7c3850e..c5f839e 100644 --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/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 |