summaryrefslogtreecommitdiffstats
path: root/clang/lib/Driver/Tools.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2013-08-21 21:59:03 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2013-08-21 21:59:03 +0000
commiteb26547177b9c5d1330100a7c988e8a792c07eba (patch)
treeb1c465f4cd459ed09bad95ded37731fc4b8ce715 /clang/lib/Driver/Tools.cpp
parent3cba495abca1f41a17f4092c5cf3f01374271adc (diff)
downloadbcm5719-llvm-eb26547177b9c5d1330100a7c988e8a792c07eba.tar.gz
bcm5719-llvm-eb26547177b9c5d1330100a7c988e8a792c07eba.zip
Move -mfpmath handling to -cc1 and implement it for x86.
The original idea was to implement it all on the driver, but to do that the driver needs to know the sse level and to do that it has to know the default features of a cpu. Benjamin Kramer pointed out that if one day we decide to implement support for ' __attribute__ ((__target__ ("arch=core2")))', then the frontend needs to keep its knowledge of default features of a cpu. To avoid duplicating which part of clang handles default cpu features, it is probably better to handle -mfpmath in the frontend. For ARM this patch is just a small improvement. Instead of a cpu list, we check if neon is enabled, which allows us to reject things like -mcpu=cortex-a9 -mfpu=vfp -mfpmath=neon For X86, since LLVM doesn't support an independent ssefp feature, we just make sure the selected -mfpmath matches the sse level. llvm-svn: 188939
Diffstat (limited to 'clang/lib/Driver/Tools.cpp')
-rw-r--r--clang/lib/Driver/Tools.cpp33
1 files changed, 5 insertions, 28 deletions
diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp
index 746300000f2..25be6b48b66 100644
--- a/clang/lib/Driver/Tools.cpp
+++ b/clang/lib/Driver/Tools.cpp
@@ -602,30 +602,6 @@ static void getFPUFeatures(const Driver &D, const Arg *A, const ArgList &Args,
D.Diag(diag::err_drv_clang_unsupported) << A->getAsString(Args);
}
-// Handle -mfpmath=.
-static void getFPMathFeatures(const Driver &D, const Arg *A,
- const ArgList &Args,
- std::vector<const char *> &Features,
- StringRef CPU) {
- StringRef FPMath = A->getValue();
-
- // Set the target features based on the FPMath.
- if (FPMath == "neon") {
- Features.push_back("+neonfp");
-
- if (CPU != "cortex-a5" && CPU != "cortex-a7" &&
- CPU != "cortex-a8" && CPU != "cortex-a9" &&
- CPU != "cortex-a9-mp" && CPU != "cortex-a15")
- D.Diag(diag::err_drv_invalid_feature) << "-mfpmath=neon" << CPU;
-
- } else if (FPMath == "vfp" || FPMath == "vfp2" || FPMath == "vfp3" ||
- FPMath == "vfp4") {
- Features.push_back("-neonfp");
- // FIXME: Add warnings when disabling a feature not present for a given CPU.
- } else
- D.Diag(diag::err_drv_clang_unsupported) << A->getAsString(Args);
-}
-
// Select the float ABI as determined by -msoft-float, -mhard-float, and
// -mfloat-abi=.
static StringRef getARMFloatABI(const Driver &D,
@@ -725,10 +701,6 @@ static void getARMTargetFeatures(const Driver &D, const llvm::Triple &Triple,
if (const Arg *A = Args.getLastArg(options::OPT_mfpu_EQ))
getFPUFeatures(D, A, Args, Features);
- // Honor -mfpmath=.
- if (const Arg *A = Args.getLastArg(options::OPT_mfpmath_EQ))
- getFPMathFeatures(D, A, Args, Features, getARMTargetCPU(Args, Triple));
-
// Setting -msoft-float effectively disables NEON because of the GCC
// implementation, although the same isn't true of VFP or VFP3.
if (FloatABI == "soft")
@@ -2409,6 +2381,11 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
CmdArgs.push_back(Args.MakeArgString(CPU));
}
+ if (const Arg *A = Args.getLastArg(options::OPT_mfpmath_EQ)) {
+ CmdArgs.push_back("-mfpmath");
+ CmdArgs.push_back(A->getValue());
+ }
+
// Add the target features
getTargetFeatures(D, ETriple, Args, CmdArgs);
OpenPOWER on IntegriCloud