Skip to content

Commit 451c557

Browse files
committed
[PS5] Set default cpu to znver2, with no tuning
1 parent 2e14900 commit 451c557

File tree

3 files changed

+13
-8
lines changed

3 files changed

+13
-8
lines changed

clang/lib/Driver/ToolChains/Arch/X86.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,11 @@ std::string x86::getX86TargetCPU(const Driver &D, const ArgList &Args,
8888
return Is64Bit ? "core2" : "yonah";
8989
}
9090

91-
// Set up default CPU name for PS4 compilers.
91+
// Set up default CPU name for PS4/PS5 compilers.
9292
if (Triple.isPS4())
9393
return "btver2";
94+
if (Triple.isPS5())
95+
return "znver2";
9496

9597
// On Android use targets compatible with gcc
9698
if (Triple.isAndroid())

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2296,10 +2296,10 @@ void Clang::AddX86TargetArgs(const ArgList &Args,
22962296

22972297
// Handle -mtune.
22982298

2299-
// Default to "generic" unless -march is present or targetting the PS4.
2299+
// Default to "generic" unless -march is present or targetting the PS4/PS5.
23002300
std::string TuneCPU;
23012301
if (!Args.hasArg(clang::driver::options::OPT_march_EQ) &&
2302-
!getToolChain().getTriple().isPS4())
2302+
!getToolChain().getTriple().isPS())
23032303
TuneCPU = "generic";
23042304

23052305
// Override based on -mtune.
Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
// Check that on the PS4 we default to:
2-
// -target-cpu btver2, no exceptions and not -tune-cpu generic
2+
// -target-cpu btver2, not -tune-cpu generic
3+
// And on the PS5 we default to:
4+
// -target-cpu znver2, not -tune-cpu generic
35

4-
// RUN: %clang -target x86_64-scei-ps4 -c %s -### 2>&1 | FileCheck %s
5-
// CHECK: "-target-cpu" "btver2"
6-
// CHECK-NOT: exceptions
7-
// CHECK-NOT: "-tune-cpu"
6+
// RUN: %clang -target x86_64-scei-ps4 -c %s -### 2>&1 | FileCheck --check-prefixes=PS4,BOTH %s
7+
// RUN: %clang -target x86_64-sie-ps5 -c %s -### 2>&1 | FileCheck --check-prefixes=PS5,BOTH %s
8+
// PS4: "-target-cpu" "btver2"
9+
// PS5: "-target-cpu" "znver2"
10+
// BOTH-NOT: "-tune-cpu"

0 commit comments

Comments
 (0)