This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGde8deb5189c9: [clang][PPC] Supporting -mcpu=405 (authored by
Qiongsi Wu <[email protected]>).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D140080/new/
https://reviews.llvm.org/D140080
Files:
clang/lib/Driver/ToolChains/Arch/PPC.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
@@ -31,3 +31,9 @@
// RUN: %clang -### -c --target=powerpc64 %s -mcpu=generic -mtune=pwr9 2>&1 |
FileCheck %s --check-prefix=TUNE
// TUNE: "-target-cpu" "ppc64" "-tune-cpu" "pwr9"
+
+/// Test mcpu options that are equivalent to "generic"
+// RUN: %clang -### -c -target powerpc64 %s -mcpu=generic 2>&1 | FileCheck %s
--check-prefix=GENERIC
+// RUN: %clang -### -c -target powerpc64 %s -mcpu=405 2>&1 | FileCheck %s
--check-prefix=GENERIC
+//
+// GENERIC: "-target-cpu" "ppc64"
Index: clang/lib/Driver/ToolChains/Arch/PPC.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Arch/PPC.cpp
+++ clang/lib/Driver/ToolChains/Arch/PPC.cpp
@@ -39,7 +39,12 @@
if (Arg *A = Args.getLastArg(clang::driver::options::OPT_mcpu_EQ)) {
StringRef CPUName = A->getValue();
- if (CPUName == "generic")
+ // Clang/LLVM does not actually support code generation
+ // for the 405 CPU. However, there are uses of this CPU ID
+ // in projects that previously used GCC and rely on Clang
+ // accepting it. Clang has always ignored it and passed the
+ // generic CPU ID to the back end.
+ if (CPUName == "generic" || CPUName == "405")
return getPPCGenericTargetCPU(T);
if (CPUName == "native") {
Index: clang/test/Driver/ppc-cpus.c
===================================================================
--- clang/test/Driver/ppc-cpus.c
+++ clang/test/Driver/ppc-cpus.c
@@ -31,3 +31,9 @@
// RUN: %clang -### -c --target=powerpc64 %s -mcpu=generic -mtune=pwr9 2>&1 | FileCheck %s --check-prefix=TUNE
// TUNE: "-target-cpu" "ppc64" "-tune-cpu" "pwr9"
+
+/// Test mcpu options that are equivalent to "generic"
+// RUN: %clang -### -c -target powerpc64 %s -mcpu=generic 2>&1 | FileCheck %s --check-prefix=GENERIC
+// RUN: %clang -### -c -target powerpc64 %s -mcpu=405 2>&1 | FileCheck %s --check-prefix=GENERIC
+//
+// GENERIC: "-target-cpu" "ppc64"
Index: clang/lib/Driver/ToolChains/Arch/PPC.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Arch/PPC.cpp
+++ clang/lib/Driver/ToolChains/Arch/PPC.cpp
@@ -39,7 +39,12 @@
if (Arg *A = Args.getLastArg(clang::driver::options::OPT_mcpu_EQ)) {
StringRef CPUName = A->getValue();
- if (CPUName == "generic")
+ // Clang/LLVM does not actually support code generation
+ // for the 405 CPU. However, there are uses of this CPU ID
+ // in projects that previously used GCC and rely on Clang
+ // accepting it. Clang has always ignored it and passed the
+ // generic CPU ID to the back end.
+ if (CPUName == "generic" || CPUName == "405")
return getPPCGenericTargetCPU(T);
if (CPUName == "native") {
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits