New patch with test case attached.
Thanks again,
Tobias
On 28/08/2012 20:00, Hal Finkel wrote:
Tobias,
This also requires a test case.
-Hal
On Tue, 28 Aug 2012 18:54:18 +0200
Tobias von Koch <[email protected]> wrote:
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.
--- 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,
--- /dev/null
+++ b/test/Driver/fsl-fp-contract.c
@@ -0,0 +1,14 @@
+// RUN: %clang -ccc-clang-archs powerpc \
+// RUN: -target powerpc-fsl-linux -### -S %s 2> %t.log \
+// RUN: -mcpu=e500mc
+// RUN: FileCheck %s < %t.log
+//
+// RUN: %clang -ccc-clang-archs powerpc64 \
+// RUN: -target powerpc64-fsl-linux -### -S %s 2> %t.log \
+// RUN: -mcpu=e5500
+// RUN: FileCheck %s < %t.log
+//
+// CHECK: clang
+// CHECK: "-cc1"
+// CHECK: "-ffp-contract=fast"
+
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits