Patch [5 of 7]: Make -mtune=future be the same as -mtune=power10.

Message ID ZcxtOUtGfsDVayLa@cowardly-lion.the-meissners.org
State Accepted
Headers
Series Patch [5 of 7]: Make -mtune=future be the same as -mtune=power10. |

Checks

Context Check Description
snail/gcc-patch-check success Github commit url

Commit Message

Michael Meissner Feb. 14, 2024, 7:35 a.m. UTC
  This patch makes -mcpu=future act like -mcpu=power10 in terms of tuning.  If
future patches changes the tuning, then this patch woucl be changed to use the
new tuning information.  Until there is different tuning, this patch does not
allow the user to explicitly use -mtune=future.

2024-02-14  Michael Meissner  <meissner@linux.ibm.com>

gcc/

	* config/rs6000/rs6000.cc (rs6000_option_override_internal): Make
	-mtune=future become -mtune=power10.
---
 gcc/config/rs6000/rs6000.cc | 28 ++++++++++++++++++++++++++--
 1 file changed, 26 insertions(+), 2 deletions(-)
  

Patch

diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc
index 2064709aa97..5e5e677e153 100644
--- a/gcc/config/rs6000/rs6000.cc
+++ b/gcc/config/rs6000/rs6000.cc
@@ -3756,16 +3756,40 @@  rs6000_option_override_internal (bool global_init_p)
     rs6000_isa_flags &= ~OPTION_MASK_POWERPC64;
 #endif
 
+  /* At the moment, we don't have explicit -mtune=future support.  If the user
+     explicitly uses -mtune=future, give a warning.  If not, use the power10
+     tuning until future tuning is added.  */
   if (rs6000_tune_index >= 0)
-    tune_index = rs6000_tune_index;
+    {
+      enum processor_type cur_proc
+	= processor_target_table[rs6000_tune_index].processor;
+
+      if (cur_proc == PROCESSOR_FUTURE)
+	{
+	  warning (0, "%qs is not currently supported", "-mtune=future");
+	  rs6000_tune_index = rs6000_cpu_name_lookup ("power10");
+	}
+      tune_index = rs6000_tune_index;
+    }
   else if (cpu_index >= 0)
-    rs6000_tune_index = tune_index = cpu_index;
+    {
+      enum processor_type cur_cpu
+	= processor_target_table[cpu_index].processor;
+
+      rs6000_tune_index = tune_index
+	= (cur_cpu == PROCESSOR_FUTURE
+	   ? rs6000_cpu_name_lookup ("power10")
+	   : cpu_index);
+    }
   else
     {
       size_t i;
       enum processor_type tune_proc
 	= (TARGET_POWERPC64 ? PROCESSOR_DEFAULT64 : PROCESSOR_DEFAULT);
 
+      if (tune_proc == PROCESSOR_FUTURE)
+	tune_proc = PROCESSOR_POWER10;
+
       tune_index = -1;
       for (i = 0; i < ARRAY_SIZE (processor_target_table); i++)
 	if (processor_target_table[i].processor == tune_proc)