jamieschmeiser created this revision.
jamieschmeiser added reviewers: hubert.reinterpretcast, ZarkoCA, stevewan.
jamieschmeiser requested review of this revision.
Herald added a project: clang.

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.


Repository:
  rG LLVM Github Monorepo

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
@@ -6,13 +6,13 @@
 // 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.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-MCPU-DEFAULT-AIX71:     "-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";


Index: clang/test/Driver/aix-mcpu-default.c
===================================================================
--- clang/test/Driver/aix-mcpu-default.c
+++ clang/test/Driver/aix-mcpu-default.c
@@ -6,13 +6,13 @@
 // 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.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-MCPU-DEFAULT-AIX71:     "-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";
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to