diff options
author | Chad Rosier <mcrosier@apple.com> | 2012-04-04 22:13:40 +0000 |
---|---|---|
committer | Chad Rosier <mcrosier@apple.com> | 2012-04-04 22:13:40 +0000 |
commit | 45619cbc0359cc1ce172941c1822bd922f827207 (patch) | |
tree | 911409783c0395338ee8cd73c42cb1fb00a62d60 /clang/lib/Driver/Tools.cpp | |
parent | 1f5d5c0e13bf4e1396822245ef1d271ff6cc504a (diff) | |
download | bcm5719-llvm-45619cbc0359cc1ce172941c1822bd922f827207.tar.gz bcm5719-llvm-45619cbc0359cc1ce172941c1822bd922f827207.zip |
[driver] When using the -mfpmath= option, add an error message when trying to
enable neonfp on a CPU that doesn't support NEON.
rdar://11108618
llvm-svn: 154061
Diffstat (limited to 'clang/lib/Driver/Tools.cpp')
-rw-r--r-- | clang/lib/Driver/Tools.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp index dda884303a7..84021084ca5 100644 --- a/clang/lib/Driver/Tools.cpp +++ b/clang/lib/Driver/Tools.cpp @@ -547,17 +547,23 @@ static void addFPUArgs(const Driver &D, const Arg *A, const ArgList &Args, // Handle -mfpmath=. static void addFPMathArgs(const Driver &D, const Arg *A, const ArgList &Args, - ArgStringList &CmdArgs) { + ArgStringList &CmdArgs, StringRef CPU) { StringRef FPMath = A->getValue(Args); // Set the target features based on the FPMath. if (FPMath == "neon") { CmdArgs.push_back("-target-feature"); CmdArgs.push_back("+neonfp"); + + if (CPU != "cortex-a8" && CPU != "cortex-a9" && CPU != "cortex-a9-mp") + D.Diag(diag::err_drv_invalid_feature) << "-mfpmath=neon" << CPU; + } else if (FPMath == "vfp" || FPMath == "vfp2" || FPMath == "vfp3" || FPMath == "vfp4") { CmdArgs.push_back("-target-feature"); CmdArgs.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); } @@ -710,7 +716,7 @@ void Clang::AddARMTargetArgs(const ArgList &Args, // Honor -mfpmath=. if (const Arg *A = Args.getLastArg(options::OPT_mfpmath_EQ)) - addFPMathArgs(D, A, Args, CmdArgs); + addFPMathArgs(D, A, Args, CmdArgs, getARMTargetCPU(Args, Triple)); // Setting -msoft-float effectively disables NEON because of the GCC // implementation, although the same isn't true of VFP or VFP3. @@ -2681,7 +2687,7 @@ void ClangAs::AddARMTargetArgs(const ArgList &Args, // Honor -mfpmath=. if (const Arg *A = Args.getLastArg(options::OPT_mfpmath_EQ)) - addFPMathArgs(D, A, Args, CmdArgs); + addFPMathArgs(D, A, Args, CmdArgs, getARMTargetCPU(Args, Triple)); } void ClangAs::ConstructJob(Compilation &C, const JobAction &JA, |