[PATCH] D107063: Set TargetCPUName for AIX to default to pwr7.

Jamie Schmeiser via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 29 07:00:17 PDT 2021


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGc3c1826c310c: Set TargetCPUName for AIX to default to pwr7. (authored by jamieschmeiser).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D107063/new/

https://reviews.llvm.org/D107063

Files:
  clang/lib/Driver/ToolChains/CommonArgs.cpp
  clang/test/Driver/aix-mcpu-default.c


Index: clang/test/Driver/aix-mcpu-default.c
===================================================================
--- clang/test/Driver/aix-mcpu-default.c
+++ clang/test/Driver/aix-mcpu-default.c
@@ -2,17 +2,35 @@
 // 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-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.
+// 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-AIX71 %s
-// CHECK-MCPU-DEFAULT-AIX71-NOT: warning:
-// CHECK-MCPU-DEFAULT-AIX71:     {{.*}}clang{{.*}}" "-cc1"
-// CHECK-MCPU-DEFAULT-AIX71:     "-target-cpu" "pwr4"
+// 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 user is able to overwrite the default with '-mcpu'.
 // RUN: %clang -no-canonical-prefixes %s -### -c 2>&1 \
Index: clang/lib/Driver/ToolChains/CommonArgs.cpp
===================================================================
--- clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -403,14 +403,9 @@
     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";


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D107063.362761.patch
Type: text/x-patch
Size: 3204 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210729/d7cec81e/attachment-0001.bin>


More information about the cfe-commits mailing list