diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -1990,7 +1990,8 @@ ArgStringList &CmdArgs) const { if (const Arg *A = Args.getLastArg(options::OPT_mtune_EQ)) { CmdArgs.push_back("-tune-cpu"); - if (strcmp(A->getValue(), "native") == 0) + if (strcmp(A->getValue(), "native") == 0 || + strcmp(A->getValue(), "auto") == 0) CmdArgs.push_back(Args.MakeArgString(llvm::sys::getHostCPUName())); else CmdArgs.push_back(A->getValue()); diff --git a/clang/test/Driver/ppc-cpus.c b/clang/test/Driver/ppc-cpus.c --- a/clang/test/Driver/ppc-cpus.c +++ b/clang/test/Driver/ppc-cpus.c @@ -22,3 +22,5 @@ // RUN: %clang -### -c --target=powerpc64 %s -mcpu=generic -mtune=pwr9 2>&1 | FileCheck %s --check-prefix=TUNE // TUNE: "-target-cpu" "ppc64" "-tune-cpu" "pwr9" +// RUN: %clang -### -c --target=powerpc64 %s -mcpu=generic -mtune=auto 2>&1 | FileCheck %s --check-prefix=NO_AUTO +// NO_AUTO-NOT: "-target-cpu" "ppc64" "-tune-cpu" "auto"