Index: include/clang/Basic/DiagnosticDriverKinds.td =================================================================== --- include/clang/Basic/DiagnosticDriverKinds.td +++ include/clang/Basic/DiagnosticDriverKinds.td @@ -28,6 +28,8 @@ "invalid arch name '%0', %1">; def err_drv_invalid_riscv_ext_arch_name : Error< "invalid arch name '%0', %1 '%2'">; +def err_drv_invalid_march_for_triple : Error< + "invalid march '%0' for triple '%1'">; def err_drv_cuda_bad_gpu_arch : Error<"Unsupported CUDA gpu architecture: %0">; def err_drv_no_cuda_installation : Error< "cannot find CUDA installation. Provide its path via --cuda-path, or pass " Index: lib/Driver/ToolChains/Arch/Mips.h =================================================================== --- lib/Driver/ToolChains/Arch/Mips.h +++ lib/Driver/ToolChains/Arch/Mips.h @@ -44,7 +44,8 @@ const llvm::Triple &Triple); bool hasMipsAbiArg(const llvm::opt::ArgList &Args, const char *Value); bool isUCLibc(const llvm::opt::ArgList &Args); -bool isNaN2008(const llvm::opt::ArgList &Args, const llvm::Triple &Triple); +bool isNaN2008(const llvm::opt::ArgList &Args, const llvm::Triple &Triple, + const Driver &D); bool isFP64ADefault(const llvm::Triple &Triple, StringRef CPUName); bool isFPXXDefault(const llvm::Triple &Triple, StringRef CPUName, StringRef ABIName, mips::FloatABI FloatABI); Index: lib/Driver/ToolChains/Arch/Mips.cpp =================================================================== --- lib/Driver/ToolChains/Arch/Mips.cpp +++ lib/Driver/ToolChains/Arch/Mips.cpp @@ -430,7 +430,8 @@ return A && A->getOption().matches(options::OPT_muclibc); } -bool mips::isNaN2008(const ArgList &Args, const llvm::Triple &Triple) { +bool mips::isNaN2008(const ArgList &Args, const llvm::Triple &Triple, + const Driver &D) { if (Arg *NaNArg = Args.getLastArg(options::OPT_mnan_EQ)) return llvm::StringSwitch(NaNArg->getValue()) .Case("2008", true) @@ -438,7 +439,7 @@ .Default(false); // NaN2008 is the default for MIPS32r6/MIPS64r6. - return llvm::StringSwitch(getCPUName(Args, Triple)) + return llvm::StringSwitch(getCPUName(Args, Triple, D)) .Cases("mips32r6", "mips64r6", true) .Default(false); Index: lib/Driver/ToolChains/Arch/X86.h =================================================================== --- lib/Driver/ToolChains/Arch/X86.h +++ lib/Driver/ToolChains/Arch/X86.h @@ -23,7 +23,7 @@ namespace x86 { const char *getX86TargetCPU(const llvm::opt::ArgList &Args, - const llvm::Triple &Triple); + const llvm::Triple &Triple, const Driver &D); void getX86TargetFeatures(const Driver &D, const llvm::Triple &Triple, const llvm::opt::ArgList &Args, Index: lib/Driver/ToolChains/Arch/X86.cpp =================================================================== --- lib/Driver/ToolChains/Arch/X86.cpp +++ lib/Driver/ToolChains/Arch/X86.cpp @@ -20,11 +20,66 @@ using namespace clang; using namespace llvm::opt; +namespace { +bool isAMDMarch(StringRef March) { + return llvm::StringSwitch(March) + .Case("k8", true) + .Case("athlon64", true) + .Case("athlon-fx", true) + .Case("opteron", true) + .Case("k8-sse3", true) + .Case("athlon64-sse3", true) + .Case("opteron-sse3", true) + .Case("amdfam10", true) + .Case("barcelona", true) + .Case("btver1", true) + .Case("btver2", true) + .Case("bdver1", true) + .Case("bdver2", true) + .Case("bdver3", true) + .Case("bdver4", true) + .Case("znver1", true) + .Default(false); +} + +bool isMarchValidForTriple(StringRef March, const llvm::Triple &Triple) { + // Check that no older march than haswell is used with x86_64h. + if (Triple.isOSDarwin() && Triple.getArchName() == "x86_64h") { + if (isAMDMarch(March)) + return false; + return llvm::StringSwitch(March) + .Case("nocona", false) + .Case("core2", false) + .Case("penryn", false) + .Case("bonnell", false) + .Case("atom", false) + .Case("silvermont", false) + .Case("slm", false) + .Case("tremont", false) + .Case("nehalem", false) + .Case("corei7", false) + .Case("westmere", false) + .Case("sandybridge", false) + .Case("corei7-avx", false) + .Case("ivybridge", false) + .Case("core-avx-i", false) + .Default(true); + } + return true; +} +} + const char *x86::getX86TargetCPU(const ArgList &Args, - const llvm::Triple &Triple) { + const llvm::Triple &Triple, const Driver &D) { if (const Arg *A = Args.getLastArg(clang::driver::options::OPT_march_EQ)) { - if (StringRef(A->getValue()) != "native") - return A->getValue(); + if (StringRef(A->getValue()) != "native") { + if (isMarchValidForTriple(A->getValue(), Triple)) + return A->getValue(); + else { + D.Diag(diag::err_drv_invalid_march_for_triple) + << A->getValue() << Triple.str(); + } + } // FIXME: Reject attempts to use -march=native unless the target matches // the host. Index: lib/Driver/ToolChains/Clang.cpp =================================================================== --- lib/Driver/ToolChains/Clang.cpp +++ lib/Driver/ToolChains/Clang.cpp @@ -1308,7 +1308,7 @@ namespace { void RenderARMABI(const llvm::Triple &Triple, const ArgList &Args, - ArgStringList &CmdArgs) { + const Driver &D, ArgStringList &CmdArgs) { // Select the ABI to use. // FIXME: Support -meabi. // FIXME: Parts of this are duplicated in the backend, unify this somehow. @@ -1316,7 +1316,7 @@ if (Arg *A = Args.getLastArg(options::OPT_mabi_EQ)) { ABIName = A->getValue(); } else { - std::string CPU = getCPUName(Args, Triple, /*FromAs*/ false); + std::string CPU = getCPUName(Args, Triple, D, /*FromAs*/ false); ABIName = llvm::ARM::computeDefaultTargetABI(Triple, CPU).data(); } @@ -1327,7 +1327,7 @@ void Clang::AddARMTargetArgs(const llvm::Triple &Triple, const ArgList &Args, ArgStringList &CmdArgs, bool KernelOrKext) const { - RenderARMABI(Triple, Args, CmdArgs); + RenderARMABI(Triple, Args, getToolChain().getDriver(), CmdArgs); // Determine floating point ABI from the options & target defaults. arm::FloatABI ABI = arm::getARMFloatABI(getToolChain(), Args); @@ -3655,7 +3655,7 @@ case llvm::Triple::arm: case llvm::Triple::armeb: case llvm::Triple::thumbeb: - RenderARMABI(Triple, Args, CmdArgs); + RenderARMABI(Triple, Args, D, CmdArgs); break; case llvm::Triple::aarch64: case llvm::Triple::aarch64_be: @@ -4001,7 +4001,7 @@ } // Add the target cpu - std::string CPU = getCPUName(Args, Triple, /*FromAs*/ false); + std::string CPU = getCPUName(Args, Triple, D, /*FromAs*/ false); if (!CPU.empty()) { CmdArgs.push_back("-target-cpu"); CmdArgs.push_back(Args.MakeArgString(CPU)); @@ -5866,7 +5866,7 @@ CmdArgs.push_back(Clang::getBaseInputName(Args, Input)); // Add the target cpu - std::string CPU = getCPUName(Args, Triple, /*FromAs*/ true); + std::string CPU = getCPUName(Args, Triple, D, /*FromAs*/ true); if (!CPU.empty()) { CmdArgs.push_back("-target-cpu"); CmdArgs.push_back(Args.MakeArgString(CPU)); Index: lib/Driver/ToolChains/CommonArgs.h =================================================================== --- lib/Driver/ToolChains/CommonArgs.h +++ lib/Driver/ToolChains/CommonArgs.h @@ -111,7 +111,7 @@ llvm::opt::OptSpecifier OffOpt, StringRef FeatureName); std::string getCPUName(const llvm::opt::ArgList &Args, const llvm::Triple &T, - bool FromAs = false); + const Driver &D, bool FromAs = false); void handleTargetFeaturesGroup(const llvm::opt::ArgList &Args, std::vector &Features, Index: lib/Driver/ToolChains/CommonArgs.cpp =================================================================== --- lib/Driver/ToolChains/CommonArgs.cpp +++ lib/Driver/ToolChains/CommonArgs.cpp @@ -262,7 +262,7 @@ } std::string tools::getCPUName(const ArgList &Args, const llvm::Triple &T, - bool FromAs) { + const Driver &D, bool FromAs) { Arg *A; switch (T.getArch()) { @@ -336,7 +336,7 @@ case llvm::Triple::x86: case llvm::Triple::x86_64: - return x86::getX86TargetCPU(Args, T); + return x86::getX86TargetCPU(Args, T, D); case llvm::Triple::hexagon: return "hexagon" + @@ -400,7 +400,8 @@ // the plugin. // Handle flags for selecting CPU variants. - std::string CPU = getCPUName(Args, ToolChain.getTriple()); + std::string CPU = + getCPUName(Args, ToolChain.getTriple(), ToolChain.getDriver()); if (!CPU.empty()) CmdArgs.push_back(Args.MakeArgString(Twine("-plugin-opt=mcpu=") + CPU)); Index: lib/Driver/ToolChains/FreeBSD.cpp =================================================================== --- lib/Driver/ToolChains/FreeBSD.cpp +++ lib/Driver/ToolChains/FreeBSD.cpp @@ -97,7 +97,8 @@ case llvm::Triple::sparc: case llvm::Triple::sparcel: case llvm::Triple::sparcv9: { - std::string CPU = getCPUName(Args, getToolChain().getTriple()); + std::string CPU = getCPUName(Args, getToolChain().getTriple(), + getToolChain().getDriver()); CmdArgs.push_back(sparc::getSparcAsmModeForCPU(CPU, getToolChain().getTriple())); AddAssemblerKPIC(getToolChain(), Args, CmdArgs); break; Index: lib/Driver/ToolChains/Gnu.cpp =================================================================== --- lib/Driver/ToolChains/Gnu.cpp +++ lib/Driver/ToolChains/Gnu.cpp @@ -371,7 +371,7 @@ // Most Android ARM64 targets should enable the linker fix for erratum // 843419. Only non-Cortex-A53 devices are allowed to skip this flag. if (Arch == llvm::Triple::aarch64 && isAndroid) { - std::string CPU = getCPUName(Args, Triple); + std::string CPU = getCPUName(Args, Triple, D); if (CPU.empty() || CPU == "generic" || CPU == "cortex-a53") CmdArgs.push_back("--fix-cortex-a53-843419"); } @@ -617,15 +617,15 @@ case llvm::Triple::ppc: { CmdArgs.push_back("-a32"); CmdArgs.push_back("-mppc"); - CmdArgs.push_back( - ppc::getPPCAsmModeForCPU(getCPUName(Args, getToolChain().getTriple()))); + CmdArgs.push_back(ppc::getPPCAsmModeForCPU( + getCPUName(Args, getToolChain().getTriple(), D))); break; } case llvm::Triple::ppc64: { CmdArgs.push_back("-a64"); CmdArgs.push_back("-mppc64"); CmdArgs.push_back( - ppc::getPPCAsmModeForCPU(getCPUName(Args, getToolChain().getTriple()))); + ppc::getPPCAsmModeForCPU(getCPUName(Args, getToolChain().getTriple(), D))); break; } case llvm::Triple::ppc64le: { @@ -633,7 +633,7 @@ CmdArgs.push_back("-mppc64"); CmdArgs.push_back("-mlittle-endian"); CmdArgs.push_back( - ppc::getPPCAsmModeForCPU(getCPUName(Args, getToolChain().getTriple()))); + ppc::getPPCAsmModeForCPU(getCPUName(Args, getToolChain().getTriple(), D))); break; } case llvm::Triple::riscv32: @@ -651,14 +651,14 @@ case llvm::Triple::sparc: case llvm::Triple::sparcel: { CmdArgs.push_back("-32"); - std::string CPU = getCPUName(Args, getToolChain().getTriple()); + std::string CPU = getCPUName(Args, getToolChain().getTriple(), D); CmdArgs.push_back(sparc::getSparcAsmModeForCPU(CPU, getToolChain().getTriple())); AddAssemblerKPIC(getToolChain(), Args, CmdArgs); break; } case llvm::Triple::sparcv9: { CmdArgs.push_back("-64"); - std::string CPU = getCPUName(Args, getToolChain().getTriple()); + std::string CPU = getCPUName(Args, getToolChain().getTriple(), D); CmdArgs.push_back(sparc::getSparcAsmModeForCPU(CPU, getToolChain().getTriple())); AddAssemblerKPIC(getToolChain(), Args, CmdArgs); break; @@ -1337,7 +1337,7 @@ addMultilibFlag(CPUName == "mips64r6", "march=mips64r6", Flags); addMultilibFlag(isMicroMips(Args), "mmicromips", Flags); addMultilibFlag(tools::mips::isUCLibc(Args), "muclibc", Flags); - addMultilibFlag(tools::mips::isNaN2008(Args, TargetTriple), "mnan=2008", + addMultilibFlag(tools::mips::isNaN2008(Args, TargetTriple, D), "mnan=2008", Flags); addMultilibFlag(ABIName == "n32", "mabi=n32", Flags); addMultilibFlag(ABIName == "n64", "mabi=n64", Flags); Index: lib/Driver/ToolChains/Linux.cpp =================================================================== --- lib/Driver/ToolChains/Linux.cpp +++ lib/Driver/ToolChains/Linux.cpp @@ -570,7 +570,7 @@ case llvm::Triple::mipsel: case llvm::Triple::mips64: case llvm::Triple::mips64el: { - bool IsNaN2008 = tools::mips::isNaN2008(Args, Triple); + bool IsNaN2008 = tools::mips::isNaN2008(Args, Triple, getDriver()); LibDir = "lib" + tools::mips::getMipsABILibSuffix(Args, Triple); Index: lib/Driver/ToolChains/NetBSD.cpp =================================================================== --- lib/Driver/ToolChains/NetBSD.cpp +++ lib/Driver/ToolChains/NetBSD.cpp @@ -76,7 +76,8 @@ case llvm::Triple::sparc: case llvm::Triple::sparcel: { CmdArgs.push_back("-32"); - std::string CPU = getCPUName(Args, getToolChain().getTriple()); + std::string CPU = getCPUName(Args, getToolChain().getTriple(), + getToolChain().getDriver()); CmdArgs.push_back(sparc::getSparcAsmModeForCPU(CPU, getToolChain().getTriple())); AddAssemblerKPIC(getToolChain(), Args, CmdArgs); break; @@ -84,7 +85,8 @@ case llvm::Triple::sparcv9: { CmdArgs.push_back("-64"); - std::string CPU = getCPUName(Args, getToolChain().getTriple()); + std::string CPU = getCPUName(Args, getToolChain().getTriple(), + getToolChain().getDriver()); CmdArgs.push_back(sparc::getSparcAsmModeForCPU(CPU, getToolChain().getTriple())); AddAssemblerKPIC(getToolChain(), Args, CmdArgs); break; Index: lib/Driver/ToolChains/OpenBSD.cpp =================================================================== --- lib/Driver/ToolChains/OpenBSD.cpp +++ lib/Driver/ToolChains/OpenBSD.cpp @@ -45,7 +45,8 @@ case llvm::Triple::sparc: case llvm::Triple::sparcel: { CmdArgs.push_back("-32"); - std::string CPU = getCPUName(Args, getToolChain().getTriple()); + std::string CPU = getCPUName(Args, getToolChain().getTriple(), + getToolChain().getDriver()); CmdArgs.push_back(sparc::getSparcAsmModeForCPU(CPU, getToolChain().getTriple())); AddAssemblerKPIC(getToolChain(), Args, CmdArgs); break; @@ -53,7 +54,8 @@ case llvm::Triple::sparcv9: { CmdArgs.push_back("-64"); - std::string CPU = getCPUName(Args, getToolChain().getTriple()); + std::string CPU = getCPUName(Args, getToolChain().getTriple(), + getToolChain().getDriver()); CmdArgs.push_back(sparc::getSparcAsmModeForCPU(CPU, getToolChain().getTriple())); AddAssemblerKPIC(getToolChain(), Args, CmdArgs); break; Index: test/Driver/clang-translation-x86_64h.c =================================================================== --- /dev/null +++ test/Driver/clang-translation-x86_64h.c @@ -0,0 +1,140 @@ +// RUN: %clang -target x86_64h-apple-darwin -### -S %s -o %t.s 2>&1 | \ +// RUN: FileCheck -check-prefix=AVX2 %s +// RUN: %clang -target x86_64h-apple-macosx10.12 -### -S %s -o %t.s 2>&1 | \ +// RUN: FileCheck -check-prefix=AVX2 %s +// AVX2: "-target-cpu" +// AVX2: "core-avx2" + +// RUN: %clang -target x86_64h-apple-darwin -march=skx -### %s -o /dev/null 2>&1 | \ +// RUN: FileCheck -check-prefix=X8664HSKX %s +// X8664HSKX: "-target-cpu" +// X8664HSKX: "skx" + +// RUN: %clang -target x86_64h-apple-darwin -march=haswell -### %s -o /dev/null 2>&1 | \ +// RUN: FileCheck -check-prefix=X8664HSW %s +// X8664HSW: "-target-cpu" +// X8664HSW: "haswell" + +// RUN: %clang -target x86_64h-apple-darwin -march=nocona -### %s -o /dev/null 2>&1 | \ +// RUN: FileCheck -check-prefix=X8664HNOCONA %s +// X8664HNOCONA: invalid march 'nocona' for triple 'x86_64h-apple-macosx{{[0-9.]+}}' + +// RUN: %clang -target x86_64h-apple-darwin -march=core2 -### %s -o /dev/null 2>&1 | \ +// RUN: FileCheck -check-prefix=X8664HCORE2 %s +// X8664HCORE2: invalid march 'core2' for triple 'x86_64h-apple-macosx{{[0-9.]+}}' + +// RUN: %clang -target x86_64h-apple-darwin -march=penryn -### %s -o /dev/null 2>&1 | \ +// RUN: FileCheck -check-prefix=X8664HPENRYN %s +// X8664HPENRYN: invalid march 'penryn' for triple 'x86_64h-apple-macosx{{[0-9.]+}}' + +// RUN: %clang -target x86_64h-apple-darwin -march=bonnell -### %s -o /dev/null 2>&1 | \ +// RUN: FileCheck -check-prefix=X8664HBONNELL %s +// X8664HBONNELL: invalid march 'bonnell' for triple 'x86_64h-apple-macosx{{[0-9.]+}}' + +// RUN: %clang -target x86_64h-apple-darwin -march=atom -### %s -o /dev/null 2>&1 | \ +// RUN: FileCheck -check-prefix=X8664HATOM %s +// X8664HATOM: invalid march 'atom' for triple 'x86_64h-apple-macosx{{[0-9.]+}}' + +// RUN: %clang -target x86_64h-apple-darwin -march=silvermont -### %s -o /dev/null 2>&1 | \ +// RUN: FileCheck -check-prefix=X8664HSILVERMONT %s +// X8664HSILVERMONT: invalid march 'silvermont' for triple 'x86_64h-apple-macosx{{[0-9.]+}}' + +// RUN: %clang -target x86_64h-apple-darwin -march=slm -### %s -o /dev/null 2>&1 | \ +// RUN: FileCheck -check-prefix=X8664HSLM %s +// X8664HSLM: invalid march 'slm' for triple 'x86_64h-apple-macosx{{[0-9.]+}}' + +// RUN: %clang -target x86_64h-apple-darwin -march=tremont -### %s -o /dev/null 2>&1 | \ +// RUN: FileCheck -check-prefix=X8664HTREMONT %s +// X8664HTREMONT: invalid march 'tremont' for triple 'x86_64h-apple-macosx{{[0-9.]+}}' + +// RUN: %clang -target x86_64h-apple-darwin -march=nehalem -### %s -o /dev/null 2>&1 | \ +// RUN: FileCheck -check-prefix=X8664HNEHALEM %s +// X8664HNEHALEM: invalid march 'nehalem' for triple 'x86_64h-apple-macosx{{[0-9.]+}}' + +// RUN: %clang -target x86_64h-apple-darwin -march=corei7 -### %s -o /dev/null 2>&1 | \ +// RUN: FileCheck -check-prefix=X8664HCOREI7 %s +// X8664HCOREI7: invalid march 'corei7' for triple 'x86_64h-apple-macosx{{[0-9.]+}}' + +// RUN: %clang -target x86_64h-apple-darwin -march=westmere -### %s -o /dev/null 2>&1 | \ +// RUN: FileCheck -check-prefix=X8664HWESTMERE %s +// X8664HWESTMERE: invalid march 'westmere' for triple 'x86_64h-apple-macosx{{[0-9.]+}}' + +// RUN: %clang -target x86_64h-apple-darwin -march=sandybridge -### %s -o /dev/null 2>&1 | \ +// RUN: FileCheck -check-prefix=X8664HSANDYBRIDGE %s +// X8664HSANDYBRIDGE: invalid march 'sandybridge' for triple 'x86_64h-apple-macosx{{[0-9.]+}}' + +// RUN: %clang -target x86_64h-apple-darwin -march=corei7-avx -### %s -o /dev/null 2>&1 | \ +// RUN: FileCheck -check-prefix=X8664HCOREI7-AVX %s +// X8664HCOREI7-AVX: invalid march 'corei7-avx' for triple 'x86_64h-apple-macosx{{[0-9.]+}}' + +// RUN: %clang -target x86_64h-apple-darwin -march=ivybridge -### %s -o /dev/null 2>&1 | \ +// RUN: FileCheck -check-prefix=X8664HIVYBRIDGE %s +// X8664HIVYBRIDGE: invalid march 'ivybridge' for triple 'x86_64h-apple-macosx{{[0-9.]+}}' + +// RUN: %clang -target x86_64h-apple-darwin -march=core-avx-i -### %s -o /dev/null 2>&1 | \ +// RUN: FileCheck -check-prefix=X8664HCORE-AVX-I %s +// X8664HCORE-AVX-I: invalid march 'core-avx-i' for triple 'x86_64h-apple-macosx{{[0-9.]+}}' + +// RUN: %clang -target x86_64h-apple-darwin -march=k8 -### %s -o /dev/null 2>&1 | \ +// RUN: FileCheck -check-prefix=X8664HK8 %s +// X8664HK8: invalid march 'k8' for triple 'x86_64h-apple-macosx{{[0-9.]+}}' + +// RUN: %clang -target x86_64h-apple-darwin -march=athlon64 -### %s -o /dev/null 2>&1 | \ +// RUN: FileCheck -check-prefix=X8664HATHLON64 %s +// X8664HATHLON64: invalid march 'athlon64' for triple 'x86_64h-apple-macosx{{[0-9.]+}}' + +// RUN: %clang -target x86_64h-apple-darwin -march=athlon-fx -### %s -o /dev/null 2>&1 | \ +// RUN: FileCheck -check-prefix=X8664HATHLON-FX %s +// X8664HATHLON-FX: invalid march 'athlon-fx' for triple 'x86_64h-apple-macosx{{[0-9.]+}}' + +// RUN: %clang -target x86_64h-apple-darwin -march=opteron -### %s -o /dev/null 2>&1 | \ +// RUN: FileCheck -check-prefix=X8664HOPTERON %s +// X8664HOPTERON: invalid march 'opteron' for triple 'x86_64h-apple-macosx{{[0-9.]+}}' + +// RUN: %clang -target x86_64h-apple-darwin -march=k8-sse3 -### %s -o /dev/null 2>&1 | \ +// RUN: FileCheck -check-prefix=X8664HK8-SSE3 %s +// X8664HK8-SSE3: invalid march 'k8-sse3' for triple 'x86_64h-apple-macosx{{[0-9.]+}}' + +// RUN: %clang -target x86_64h-apple-darwin -march=athlon64-sse3 -### %s -o /dev/null 2>&1 | \ +// RUN: FileCheck -check-prefix=X8664HATHLON64-SSE3 %s +// X8664HATHLON64-SSE3: invalid march 'athlon64-sse3' for triple 'x86_64h-apple-macosx{{[0-9.]+}}' + +// RUN: %clang -target x86_64h-apple-darwin -march=opteron-sse3 -### %s -o /dev/null 2>&1 | \ +// RUN: FileCheck -check-prefix=X8664HOPTERON-SSE3 %s +// X8664HOPTERON-SSE3: invalid march 'opteron-sse3' for triple 'x86_64h-apple-macosx{{[0-9.]+}}' + +// RUN: %clang -target x86_64h-apple-darwin -march=amdfam10 -### %s -o /dev/null 2>&1 | \ +// RUN: FileCheck -check-prefix=X8664HAMDFAM10 %s +// X8664HAMDFAM10: invalid march 'amdfam10' for triple 'x86_64h-apple-macosx{{[0-9.]+}}' + +// RUN: %clang -target x86_64h-apple-darwin -march=barcelona -### %s -o /dev/null 2>&1 | \ +// RUN: FileCheck -check-prefix=X8664HBARCELONA %s +// X8664HBARCELONA: invalid march 'barcelona' for triple 'x86_64h-apple-macosx{{[0-9.]+}}' + +// RUN: %clang -target x86_64h-apple-darwin -march=btver1 -### %s -o /dev/null 2>&1 | \ +// RUN: FileCheck -check-prefix=X8664HBTVER1 %s +// X8664HBTVER1: invalid march 'btver1' for triple 'x86_64h-apple-macosx{{[0-9.]+}}' + +// RUN: %clang -target x86_64h-apple-darwin -march=btver2 -### %s -o /dev/null 2>&1 | \ +// RUN: FileCheck -check-prefix=X8664HBTVER2 %s +// X8664HBTVER2: invalid march 'btver2' for triple 'x86_64h-apple-macosx{{[0-9.]+}}' + +// RUN: %clang -target x86_64h-apple-darwin -march=bdver1 -### %s -o /dev/null 2>&1 | \ +// RUN: FileCheck -check-prefix=X8664HBDVER1 %s +// X8664HBDVER1: invalid march 'bdver1' for triple 'x86_64h-apple-macosx{{[0-9.]+}}' + +// RUN: %clang -target x86_64h-apple-darwin -march=bdver2 -### %s -o /dev/null 2>&1 | \ +// RUN: FileCheck -check-prefix=X8664HBDVER2 %s +// X8664HBDVER2: invalid march 'bdver2' for triple 'x86_64h-apple-macosx{{[0-9.]+}}' + +// RUN: %clang -target x86_64h-apple-darwin -march=bdver3 -### %s -o /dev/null 2>&1 | \ +// RUN: FileCheck -check-prefix=X8664HBDVER3 %s +// X8664HBDVER3: invalid march 'bdver3' for triple 'x86_64h-apple-macosx{{[0-9.]+}}' + +// RUN: %clang -target x86_64h-apple-darwin -march=bdver4 -### %s -o /dev/null 2>&1 | \ +// RUN: FileCheck -check-prefix=X8664HBDVER4 %s +// X8664HBDVER4: invalid march 'bdver4' for triple 'x86_64h-apple-macosx{{[0-9.]+}}' + +// RUN: %clang -target x86_64h-apple-darwin -march=znver1 -### %s -o /dev/null 2>&1 | \ +// RUN: FileCheck -check-prefix=X8664HZNVER1 %s +// X8664HZNVER1: invalid march 'znver1' for triple 'x86_64h-apple-macosx{{[0-9.]+}}' Index: test/Driver/clang-translation.c =================================================================== --- test/Driver/clang-translation.c +++ test/Driver/clang-translation.c @@ -26,18 +26,6 @@ // CORE2: "-target-cpu" // CORE2: "core2" -// RUN: %clang -target x86_64h-apple-darwin -### -S %s -o %t.s 2>&1 | \ -// RUN: FileCheck -check-prefix=AVX2 %s -// RUN: %clang -target x86_64h-apple-macosx10.12 -### -S %s -o %t.s 2>&1 | \ -// RUN: FileCheck -check-prefix=AVX2 %s -// AVX2: "-target-cpu" -// AVX2: "core-avx2" - -// RUN: %clang -target x86_64h-apple-darwin -march=skx -### %s -o /dev/null 2>&1 | \ -// RUN: FileCheck -check-prefix=X8664HSKX %s -// X8664HSKX: "-target-cpu" -// X8664HSKX: "skx" - // RUN: %clang -target i386-apple-macosx10.12 -### -S %s -o %t.s 2>&1 | \ // RUN: FileCheck -check-prefix=PENRYN %s // RUN: %clang -target x86_64-apple-macosx10.12 -### -S %s -o %t.s 2>&1 | \