llvmorg-github-actions[bot] wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Konstantin Belochapka (kbelochapka)

<details>
<summary>Changes</summary>

Forward the PS5 target CPU from the clang driver to lld as 
`-plugin-opt=mcpu=znver2s`, matching behavior of other platforms. 

---
Full diff: https://github.com/llvm/llvm-project/pull/202924.diff


2 Files Affected:

- (modified) clang/lib/Driver/ToolChains/PS4CPU.cpp (+4) 
- (modified) clang/test/Driver/ps5-linker.c (+6) 


``````````diff
diff --git a/clang/lib/Driver/ToolChains/PS4CPU.cpp 
b/clang/lib/Driver/ToolChains/PS4CPU.cpp
index 8f5d3ec8a6f91..234dcba64c897 100644
--- a/clang/lib/Driver/ToolChains/PS4CPU.cpp
+++ b/clang/lib/Driver/ToolChains/PS4CPU.cpp
@@ -7,6 +7,7 @@
 
//===----------------------------------------------------------------------===//
 
 #include "PS4CPU.h"
+#include "Arch/X86.h"
 #include "clang/Config/config.h"
 #include "clang/Driver/CommonArgs.h"
 #include "clang/Driver/Compilation.h"
@@ -178,6 +179,9 @@ void tools::PS4cpu::Linker::ConstructJob(Compilation &C, 
const JobAction &JA,
   if (StringRef Threads = getLTOParallelism(Args, D); !Threads.empty())
     AddLTOFlag(Twine("-threads=") + Threads);
 
+  std::string CPU = tools::x86::getX86TargetCPU(D, Args, TC.getTriple());
+  AddLTOFlag(Twine("mcpu=" + CPU));
+
   if (*LTOArgs)
     CmdArgs.push_back(
         Args.MakeArgString(Twine("-lto-debug-options=") + LTOArgs));
diff --git a/clang/test/Driver/ps5-linker.c b/clang/test/Driver/ps5-linker.c
index 6f37ca8958fc1..ea8d7f95de5dd 100644
--- a/clang/test/Driver/ps5-linker.c
+++ b/clang/test/Driver/ps5-linker.c
@@ -220,3 +220,9 @@
 // CHECK-NO-FAT-LTO: {{ld(\.exe)?}}"
 // CHECK-NO-FAT-LTO-NOT: "--fat-lto-objects"
 // CHECK-NO-FAT-LTO-SAME: {{$}}
+
+// Check -plugin-opt=mcpu=znver2s is passed to prospero-lld.
+// RUN: %clang --target=x86_64-sie-ps5 %s -### 2>&1 | FileCheck 
--check-prefixes=CHECK-CLANG-TARGET-CPU %s
+
+// CHECK-CLANG-TARGET-CPU: {{ld(\.exe)?}}"
+// CHECK-CLANG-TARGET-CPU: "-plugin-opt=mcpu=znver2s"

``````````

</details>


https://github.com/llvm/llvm-project/pull/202924
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to