dyung created this revision.
dyung added a reviewer: probinson.
dyung added a project: clang.
dyung requested review of this revision.

For the PS4, do not emit "-tune-cpu generic" since the platform only has 1 
known CPU and we do not want to prevent optimizations by tuning for a generic 
rather than the specific processor it contains.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D86965

Files:
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/test/Driver/ps4-cpu-defaults.cpp


Index: clang/test/Driver/ps4-cpu-defaults.cpp
===================================================================
--- clang/test/Driver/ps4-cpu-defaults.cpp
+++ clang/test/Driver/ps4-cpu-defaults.cpp
@@ -1,6 +1,7 @@
 // Check that on the PS4 we default to:
-// -target-cpu btver2 and no exceptions
+// -target-cpu btver2, no exceptions and 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" "generic"
Index: clang/lib/Driver/ToolChains/Clang.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -2075,9 +2075,10 @@
 
   // Handle -mtune.
 
-  // Default to "generic" unless -march is present.
+  // Default to "generic" unless -march is present or targetting the PS4
   std::string TuneCPU;
-  if (!Args.hasArg(clang::driver::options::OPT_march_EQ))
+  if (!Args.hasArg(clang::driver::options::OPT_march_EQ) &&
+      !getToolChain().getTriple().isPS4CPU())
     TuneCPU = "generic";
 
   // Override based on -mtune.


Index: clang/test/Driver/ps4-cpu-defaults.cpp
===================================================================
--- clang/test/Driver/ps4-cpu-defaults.cpp
+++ clang/test/Driver/ps4-cpu-defaults.cpp
@@ -1,6 +1,7 @@
 // Check that on the PS4 we default to:
-// -target-cpu btver2 and no exceptions
+// -target-cpu btver2, no exceptions and 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" "generic"
Index: clang/lib/Driver/ToolChains/Clang.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -2075,9 +2075,10 @@
 
   // Handle -mtune.
 
-  // Default to "generic" unless -march is present.
+  // Default to "generic" unless -march is present or targetting the PS4
   std::string TuneCPU;
-  if (!Args.hasArg(clang::driver::options::OPT_march_EQ))
+  if (!Args.hasArg(clang::driver::options::OPT_march_EQ) &&
+      !getToolChain().getTriple().isPS4CPU())
     TuneCPU = "generic";
 
   // Override based on -mtune.
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to