rs6000: Do not use rs6000_cpu for .machine ppc and ppc64 (PR104829)

Message ID 2042ac015b0c27f7a3d40825a55e3db2822bb25e.1647034523.git.segher@kernel.crashing.org
State New
Headers
Series rs6000: Do not use rs6000_cpu for .machine ppc and ppc64 (PR104829) |

Commit Message

Segher Boessenkool March 11, 2022, 9:38 p.m. UTC
  Fixes: 77eccbf39ed5

rs6000.h has
  #define PROCESSOR_POWERPC   PROCESSOR_PPC604
  #define PROCESSOR_POWERPC64 PROCESSOR_RS64A
which means that if you use things like  -mcpu=powerpc -mvsx  it will no
longer work after my latest .machine patch.  This causes GCC build errors
in some cases, not a good idea (even if the errors are actually
pre-existing: using -mvsx with a machine that does not have VXX cannot
work properly).

Will commit later today (if it regstraps fine :-) )


Segher


2022-03-11  Segher Boessenkool  <segher@kernel.crashing.org>

	PR target/104829
	* config/rs6000/rs6000.cc (rs6000_machine_from_flags): Don't output
	"ppc" and "ppc64" based on rs6000_cpu.

---
 gcc/config/rs6000/rs6000.cc | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
  

Patch

diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc
index 3afe78f5d049..5ebe19022473 100644
--- a/gcc/config/rs6000/rs6000.cc
+++ b/gcc/config/rs6000/rs6000.cc
@@ -5804,20 +5804,28 @@  rs6000_machine_from_flags (void)
   if (rs6000_cpu == PROCESSOR_MPCCORE)
     return "\"821\"";
 
+#if 0
+  /* This (and ppc64 below) are disabled here (for now at least) because
+     TARGET_POWERPC, TARGET_POWERPC64, and TARGET_COMMON are #define'd as
+     some of these.  Untangling that is a job for later.  */
+
   /* 600 series and 700 series, "classic" */
   if (rs6000_cpu == PROCESSOR_PPC601 || rs6000_cpu == PROCESSOR_PPC603
       || rs6000_cpu == PROCESSOR_PPC604 || rs6000_cpu == PROCESSOR_PPC604e
-      || rs6000_cpu == PROCESSOR_PPC750 || rs6000_cpu == PROCESSOR_POWERPC)
+      || rs6000_cpu == PROCESSOR_PPC750)
     return "ppc";
+#endif
 
   /* Classic with AltiVec, "G4" */
   if (rs6000_cpu == PROCESSOR_PPC7400 || rs6000_cpu == PROCESSOR_PPC7450)
     return "\"7450\"";
 
+#if 0
   /* The older 64-bit CPUs */
   if (rs6000_cpu == PROCESSOR_PPC620 || rs6000_cpu == PROCESSOR_PPC630
-      || rs6000_cpu == PROCESSOR_RS64A || rs6000_cpu == PROCESSOR_POWERPC64)
+      || rs6000_cpu == PROCESSOR_RS64A)
     return "ppc64";
+#endif
 
   HOST_WIDE_INT flags = rs6000_isa_flags;