qiongsiwu1 created this revision. qiongsiwu1 added reviewers: w2yehia, nemanjai, MaskRay. qiongsiwu1 added projects: clang, PowerPC. Herald added subscribers: StephenFan, shchenz, kbarton. Herald added a project: All. qiongsiwu1 requested review of this revision. Herald added a subscriber: cfe-commits.
This patch teaches `clang` to recognize the `auto` option for `-mtune`. The option is identical to the `mtune` option `native`. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D139343 Files: clang/lib/Driver/ToolChains/Clang.cpp clang/test/Driver/ppc-cpus.c Index: clang/test/Driver/ppc-cpus.c =================================================================== --- clang/test/Driver/ppc-cpus.c +++ 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" Index: clang/lib/Driver/ToolChains/Clang.cpp =================================================================== --- clang/lib/Driver/ToolChains/Clang.cpp +++ 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());
Index: clang/test/Driver/ppc-cpus.c =================================================================== --- clang/test/Driver/ppc-cpus.c +++ 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" Index: clang/lib/Driver/ToolChains/Clang.cpp =================================================================== --- clang/lib/Driver/ToolChains/Clang.cpp +++ 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());
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits