From 451c5578b834fe3aca4e495aaf6a2f32639e86a6 Mon Sep 17 00:00:00 2001 From: Paul Robinson Date: Thu, 28 Apr 2022 07:50:20 -0700 Subject: [PATCH] [PS5] Set default cpu to znver2, with no tuning --- clang/lib/Driver/ToolChains/Arch/X86.cpp | 4 +++- clang/lib/Driver/ToolChains/Clang.cpp | 4 ++-- clang/test/Driver/ps4-cpu-defaults.cpp | 13 ++++++++----- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/clang/lib/Driver/ToolChains/Arch/X86.cpp b/clang/lib/Driver/ToolChains/Arch/X86.cpp index 73df835..de0725b 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 1f083de..52dbe07 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 46fa889..8102c4b 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" -- 2.7.4