[PATCH] D80835: [AIX] Change the default target CPU to power4 for AIX on Power
Steven Wan via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jun 3 10:59:02 PDT 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rGba4afe6f7a84: [AIX] Change the default target CPU to power4 for AIX on Power (authored by stevewan).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D80835/new/
https://reviews.llvm.org/D80835
Files:
clang/lib/Driver/ToolChains/CommonArgs.cpp
clang/test/Driver/aix-mcpu-default.c
Index: clang/test/Driver/aix-mcpu-default.c
===================================================================
--- /dev/null
+++ clang/test/Driver/aix-mcpu-default.c
@@ -0,0 +1,16 @@
+// Check that the target cpu defaults to power4 on AIX.
+// RUN: %clang -no-canonical-prefixes %s -### -c 2>&1 \
+// RUN: -target powerpc-ibm-aix \
+// RUN: | FileCheck --check-prefix=CHECK-MCPU-DEFAULT %s
+// CHECK-MCPU-DEFAULT-NOT: warning:
+// CHECK-MCPU-DEFAULT: {{.*}}clang{{.*}}" "-cc1"
+// CHECK-MCPU-DEFAULT: "-target-cpu" "pwr4"
+
+// Check that the user is able to overwrite the default with '-mcpu'.
+// RUN: %clang -no-canonical-prefixes %s -### -c 2>&1 \
+// RUN: -mcpu=pwr6 \
+// RUN: -target powerpc-ibm-aix \
+// RUN: | FileCheck --check-prefix=CHECK-MCPU-USER %s
+// CHECK-MCPU-USER-NOT: warning:
+// CHECK-MCPU-USER: {{.*}}clang{{.*}}" "-cc1"
+// CHECK-MCPU-USER: "-target-cpu" "pwr6"
Index: clang/lib/Driver/ToolChains/CommonArgs.cpp
===================================================================
--- clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -294,14 +294,18 @@
std::string TargetCPUName = ppc::getPPCTargetCPU(Args);
// LLVM may default to generating code for the native CPU,
// but, like gcc, we default to a more generic option for
- // each architecture. (except on Darwin)
- if (TargetCPUName.empty() && !T.isOSDarwin()) {
- if (T.getArch() == llvm::Triple::ppc64)
- TargetCPUName = "ppc64";
- else if (T.getArch() == llvm::Triple::ppc64le)
- TargetCPUName = "ppc64le";
- else
- TargetCPUName = "ppc";
+ // each architecture. (except on AIX or Darwin)
+ if (TargetCPUName.empty()) {
+ if (T.isOSAIX())
+ TargetCPUName = "pwr4";
+ else if (!T.isOSDarwin()) {
+ if (T.getArch() == llvm::Triple::ppc64)
+ TargetCPUName = "ppc64";
+ else if (T.getArch() == llvm::Triple::ppc64le)
+ TargetCPUName = "ppc64le";
+ else
+ TargetCPUName = "ppc";
+ }
}
return TargetCPUName;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D80835.268259.patch
Type: text/x-patch
Size: 2119 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200603/476a2196/attachment.bin>
More information about the cfe-commits
mailing list