[clang] 451c557 - [PS5] Set default cpu to znver2, with no tuning

Paul Robinson via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 28 07:50:46 PDT 2022


Author: Paul Robinson
Date: 2022-04-28T07:50:37-07:00
New Revision: 451c5578b834fe3aca4e495aaf6a2f32639e86a6

URL: https://github.com/llvm/llvm-project/commit/451c5578b834fe3aca4e495aaf6a2f32639e86a6
DIFF: https://github.com/llvm/llvm-project/commit/451c5578b834fe3aca4e495aaf6a2f32639e86a6.diff

LOG: [PS5] Set default cpu to znver2, with no tuning

Added: 
    

Modified: 
    clang/lib/Driver/ToolChains/Arch/X86.cpp
    clang/lib/Driver/ToolChains/Clang.cpp
    clang/test/Driver/ps4-cpu-defaults.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Driver/ToolChains/Arch/X86.cpp b/clang/lib/Driver/ToolChains/Arch/X86.cpp
index 73df835585239..de0725b8d6de6 100644
--- a/clang/lib/Driver/ToolChains/Arch/X86.cpp
+++ b/clang/lib/Driver/ToolChains/Arch/X86.cpp
@@ -88,9 +88,11 @@ std::string x86::getX86TargetCPU(const Driver &D, const ArgList &Args,
     return Is64Bit ? "core2" : "yonah";
   }
 
-  // Set up default CPU name for PS4 compilers.
+  // Set up default CPU name for PS4/PS5 compilers.
   if (Triple.isPS4())
     return "btver2";
+  if (Triple.isPS5())
+    return "znver2";
 
   // On Android use targets compatible with gcc
   if (Triple.isAndroid())

diff  --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp
index 1f083de405f0a..52dbe07ab3551 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -2296,10 +2296,10 @@ void Clang::AddX86TargetArgs(const ArgList &Args,
 
   // Handle -mtune.
 
-  // Default to "generic" unless -march is present or targetting the PS4.
+  // Default to "generic" unless -march is present or targetting the PS4/PS5.
   std::string TuneCPU;
   if (!Args.hasArg(clang::driver::options::OPT_march_EQ) &&
-      !getToolChain().getTriple().isPS4())
+      !getToolChain().getTriple().isPS())
     TuneCPU = "generic";
 
   // Override based on -mtune.

diff  --git a/clang/test/Driver/ps4-cpu-defaults.cpp b/clang/test/Driver/ps4-cpu-defaults.cpp
index 46fa8897e6fae..8102c4b144a35 100644
--- a/clang/test/Driver/ps4-cpu-defaults.cpp
+++ b/clang/test/Driver/ps4-cpu-defaults.cpp
@@ -1,7 +1,10 @@
 // Check that on the PS4 we default to:
-// -target-cpu btver2, no exceptions and not -tune-cpu generic
+// -target-cpu btver2, not -tune-cpu generic
+// And on the PS5 we default to:
+// -target-cpu znver2, not -tune-cpu generic
 
-// RUN: %clang -target x86_64-scei-ps4 -c %s -### 2>&1 | FileCheck %s
-// CHECK: "-target-cpu" "btver2"
-// CHECK-NOT: exceptions
-// CHECK-NOT: "-tune-cpu"
+// RUN: %clang -target x86_64-scei-ps4 -c %s -### 2>&1 | FileCheck --check-prefixes=PS4,BOTH %s
+// RUN: %clang -target x86_64-sie-ps5 -c %s -### 2>&1 | FileCheck --check-prefixes=PS5,BOTH %s
+// PS4: "-target-cpu" "btver2"
+// PS5: "-target-cpu" "znver2"
+// BOTH-NOT: "-tune-cpu"


        


More information about the cfe-commits mailing list