]> granicus.if.org Git - clang/commitdiff
[Driver] Don't override '-march' when using '-arch x86_64h'
authorFrancis Visoiu Mistrih <francisvm@yahoo.com>
Mon, 17 Dec 2018 19:29:27 +0000 (19:29 +0000)
committerFrancis Visoiu Mistrih <francisvm@yahoo.com>
Mon, 17 Dec 2018 19:29:27 +0000 (19:29 +0000)
On Darwin, using '-arch x86_64h' would always override the option passed
through '-march'.

This patch allows users to use '-march' with x86_64h, while keeping the
default to 'core-avx2'

Differential Revision: https://reviews.llvm.org/D55775

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@349381 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Driver/ToolChains/Arch/X86.cpp
lib/Driver/ToolChains/Darwin.cpp
test/Driver/clang-translation.c

index bc707857d8f39984ddf32d5a059c2c7247c4df59..45648945d5efccbc0eb758b356c55d5972556262 100644 (file)
@@ -23,12 +23,8 @@ using namespace llvm::opt;
 const char *x86::getX86TargetCPU(const ArgList &Args,
                                  const llvm::Triple &Triple) {
   if (const Arg *A = Args.getLastArg(clang::driver::options::OPT_march_EQ)) {
-    if (StringRef(A->getValue()) != "native") {
-      if (Triple.isOSDarwin() && Triple.getArchName() == "x86_64h")
-        return "core-avx2";
-
+    if (StringRef(A->getValue()) != "native")
       return A->getValue();
-    }
 
     // FIXME: Reject attempts to use -march=native unless the target matches
     // the host.
index 0cc187ab4758c12428febcec486c140e7199d100..4e306fd960ecdb053ad92d2600d536af83051eed 100644 (file)
@@ -2017,12 +2017,8 @@ DerivedArgList *MachO::TranslateArgs(const DerivedArgList &Args,
     else if (Name == "pentIIm3")
       DAL->AddJoinedArg(nullptr, MArch, "pentium2");
 
-    else if (Name == "x86_64")
+    else if (Name == "x86_64" || Name == "x86_64h")
       DAL->AddFlagArg(nullptr, Opts.getOption(options::OPT_m64));
-    else if (Name == "x86_64h") {
-      DAL->AddFlagArg(nullptr, Opts.getOption(options::OPT_m64));
-      DAL->AddJoinedArg(nullptr, MArch, "x86_64h");
-    }
 
     else if (Name == "arm")
       DAL->AddJoinedArg(nullptr, MArch, "armv4t");
index ed24ae27fbb87640a804b3341602f8916d0686f1..4360ea44aeb2cdb89d1c8e5f1c28cd9494fca13d 100644 (file)
 // 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 | \