From 0def3d17cba323e3482809b79f51d592c0d9a36f Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Mon, 21 Dec 2009 23:28:17 +0000 Subject: ARM: Honor -mfpu= and set __VFP_FP__ and __ARM_NEON__ "correctly". - Correctly is in quotes, because we are following what I interpreted as GCC's intent (which diverges from practice, naturally). - Also, fix the arch define for arm1136jf-s. llvm-svn: 91855 --- clang/lib/Driver/Tools.cpp | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'clang/lib/Driver/Tools.cpp') diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp index 8cdd00c5360..8ac448fdaa8 100644 --- a/clang/lib/Driver/Tools.cpp +++ b/clang/lib/Driver/Tools.cpp @@ -450,6 +450,35 @@ void Clang::AddARMTargetArgs(const ArgList &Args, CmdArgs.push_back("-target-feature"); CmdArgs.push_back("+soft-float-abi"); } + + // Honor -mfpu=. + // + // FIXME: Centralize feature selection, defaulting shouldn't be also in the + // frontend target. + if (const Arg *A = Args.getLastArg(options::OPT_mfpu_EQ)) { + llvm::StringRef FPU = A->getValue(Args); + + // Set the target features based on the FPU. + if (FPU == "fpa" || FPU == "fpe2" || FPU == "fpe3" || FPU == "maverick") { + // Disable any default FPU support. + CmdArgs.push_back("-target-feature"); + CmdArgs.push_back("-vfp2"); + CmdArgs.push_back("-target-feature"); + CmdArgs.push_back("-vfp3"); + CmdArgs.push_back("-target-feature"); + CmdArgs.push_back("-neon"); + } else if (FPU == "vfp") { + CmdArgs.push_back("-target-feature"); + CmdArgs.push_back("+vfp2"); + } else if (FPU == "vfp3") { + CmdArgs.push_back("-target-feature"); + CmdArgs.push_back("+vfp3"); + } else if (FPU == "neon") { + CmdArgs.push_back("-target-feature"); + CmdArgs.push_back("+neon"); + } else + D.Diag(clang::diag::err_drv_clang_unsupported) << A->getAsString(Args); + } } void Clang::AddX86TargetArgs(const ArgList &Args, -- cgit v1.2.3