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 | 30fe6baf95662ea82a794a8fe3b76998713c183d (patch) | |
tree | 20a1f669e57e37bd2e55429ee3886125a4258ef5 /lib/Driver/Tools.cpp | |
parent | 397f32712369bfed739fe3cb180604b472b41942 (diff) |
[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
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154061 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Driver/Tools.cpp')
-rw-r--r-- | lib/Driver/Tools.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp index dda884303a..84021084ca 100644 --- a/lib/Driver/Tools.cpp +++ b/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, |