[cfe-commits] [PATCH 3/3] Make fp-contract=fast default for Freescale vendor

Tobias von Koch tobias.von.koch at gmail.com
Tue Aug 28 09:54:18 PDT 2012


Dear all,

This is part of a sequence of three (trivial) patches to allow Clang to 
be used as a drop-in replacement for GCC with the Freescale SDK.
Support for Freescale processors has just been added to the PowerPC backend.

Please review and commit if this is OK - I don't have commit access.

Thanks!
Tobias

Description of patch:

If vendor==Freescale, set fp-contract=fast unless specified otherwise. 
This is the default in GCC on Freescale targets.

-------------- next part --------------
--- a/lib/Driver/Tools.cpp
+++ b/lib/Driver/Tools.cpp
@@ -1007,6 +1009,13 @@ void Clang::AddPPCTargetArgs(const ArgList &Args,
     CmdArgs.push_back("-target-cpu");
     CmdArgs.push_back(Args.MakeArgString(TargetCPUName.c_str()));
   }
+
+  // GCC defaults to FMA fusion, so behave the same way unless the user
+  // tells us to use a different FP contract.
+  if (Triple.getVendor() == llvm::Triple::Freescale &&
+      !Args.hasArg(options::OPT_ffp_contract)) {
+    CmdArgs.push_back(Args.MakeArgString("-ffp-contract=fast"));
+  }
 }
 
 void Clang::AddSparcTargetArgs(const ArgList &Args,



More information about the cfe-commits mailing list