Set TargetCPUName for AIX to default to pwr7.

Summary:
Set the TargetCPUName for AIX to default to pwr7, removing the setting
of it based on the major/minor of the OS version, which previously
set it to pwr4 for AIX 7.1 and earlier. The old code would also set it to
pwr4 when the OS version was not specified and with the change, it will
default it to pwr7 in all cases.

Author: Jamie Schmeiser <schmeise@ca.ibm.com>
Reviewed By:hubert.reinterpretcast (Hubert Tong)
Differential Revision: https://reviews.llvm.org/D107063
This commit is contained in:
Jamie Schmeiser 2021-07-29 09:59:24 -04:00
parent a90da62adb
commit c3c1826c31
2 changed files with 29 additions and 16 deletions

View File

@ -403,14 +403,9 @@ std::string tools::getCPUName(const ArgList &Args, const llvm::Triple &T,
if (!TargetCPUName.empty())
return TargetCPUName;
if (T.isOSAIX()) {
unsigned major, minor, unused_micro;
T.getOSVersion(major, minor, unused_micro);
// The minimal arch level moved from pwr4 for AIX7.1 to
// pwr7 for AIX7.2.
TargetCPUName =
(major < 7 || (major == 7 && minor < 2)) ? "pwr4" : "pwr7";
} else if (T.getArch() == llvm::Triple::ppc64le)
if (T.isOSAIX())
TargetCPUName = "pwr7";
else if (T.getArch() == llvm::Triple::ppc64le)
TargetCPUName = "ppc64le";
else if (T.getArch() == llvm::Triple::ppc64)
TargetCPUName = "ppc64";

View File

@ -2,18 +2,36 @@
// RUN: %clang -no-canonical-prefixes %s -### -c 2>&1 \
// RUN: -target powerpc-ibm-aix7.2 \
// RUN: | FileCheck --check-prefix=CHECK-MCPU-DEFAULT-AIX72 %s
// Check that the target cpu defaults to power7 on AIX7.2 and up.
// RUN: %clang -no-canonical-prefixes %s -### -c 2>&1 \
// RUN: -target powerpc64-ibm-aix7.2 \
// RUN: | FileCheck --check-prefix=CHECK-MCPU-DEFAULT-AIX72 %s
// Check that the target cpu defaults to power7 on AIX7.1 and below.
// RUN: %clang -no-canonical-prefixes %s -### -c 2>&1 \
// RUN: -target powerpc-ibm-aix7.1 \
// RUN: | FileCheck --check-prefix=CHECK-MCPU-DEFAULT-AIX72 %s
// Check that the target cpu defaults to power7 on AIX7.1 and below.
// RUN: %clang -no-canonical-prefixes %s -### -c 2>&1 \
// RUN: -target powerpc64-ibm-aix7.1 \
// RUN: | FileCheck --check-prefix=CHECK-MCPU-DEFAULT-AIX72 %s
// Check that the target cpu defaults to power7 when level not specified.
// RUN: %clang -no-canonical-prefixes %s -### -c 2>&1 \
// RUN: -target powerpc-ibm-aix \
// RUN: | FileCheck --check-prefix=CHECK-MCPU-DEFAULT-AIX72 %s
// Check that the target cpu defaults to power7 when level not specified.
// RUN: %clang -no-canonical-prefixes %s -### -c 2>&1 \
// RUN: -target powerpc64-ibm-aix \
// RUN: | FileCheck --check-prefix=CHECK-MCPU-DEFAULT-AIX72 %s
// CHECK-MCPU-DEFAULT-AIX72-NOT: warning:
// CHECK-MCPU-DEFAULT-AIX72: {{.*}}clang{{.*}}" "-cc1"
// CHECK-MCPU-DEFAULT-AIX72: "-target-cpu" "pwr7"
// Check that the target cpu defaults to power4 on AIX7.1 and below.
// RUN: %clang -no-canonical-prefixes %s -### -c 2>&1 \
// RUN: -target powerpc-ibm-aix7.1 \
// RUN: | FileCheck --check-prefix=CHECK-MCPU-DEFAULT-AIX71 %s
// CHECK-MCPU-DEFAULT-AIX71-NOT: warning:
// CHECK-MCPU-DEFAULT-AIX71: {{.*}}clang{{.*}}" "-cc1"
// CHECK-MCPU-DEFAULT-AIX71: "-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 \