forked from OSchip/llvm-project
[AIX] Change the default target CPU to power4 for AIX on Power
Summary: This patch changes the AIX default target CPU to power4 since this is the the lowest arch for the lowest OS level supported. Reviewers: hubert.reinterpretcast, cebowleratibm, daltenty Reviewed By: hubert.reinterpretcast Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D80835
This commit is contained in:
parent
a9fe69c359
commit
ba4afe6f7a
|
@ -294,14 +294,18 @@ std::string tools::getCPUName(const ArgList &Args, const llvm::Triple &T,
|
|||
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;
|
||||
}
|
||||
|
|
|
@ -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"
|
Loading…
Reference in New Issue