This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: mainline -mcpu=power4


On Wed, Jan 07, 2004 at 08:07:17PM -0500, David Edelsohn wrote:
> >>>>> Alan Modra writes:
> 
> Alan> Yes, that's the obvious fix to make -mcpu=power4 work.  I was really
> Alan> asking about why we have TARGET_64BIT in the insn predicate.  It's a
> Alan> rather more general problem than just fixing -mcpu=power4.  For
> Alan> instance, -m64 -mcpu=601 gets the ICE too.
> 
> 	Why should that combination of options work?

I confuse easily. :)  I need some comment above MASK_64BIT that points
out that the 64 bit model isn't just LP64.  ie. that MASK_POWERPC64 is
required for 64 bit regs, for example, to make lr 64 bit.

> 	We should fail earlier and in a more user-friendly manner, but
> PPC601 does not support any form of 64-bit mode.

	* config/rs6000/linux64.h (SUBSUBTARGET_OVERRIDE_OPTIONS): Ensure
	target_flags has MASK_POWERPC64 when -m64.
	* config/rs6000/rs6000.c (processor_target_table): Add MASK_POWERPC64
	to 620, 630, power3, power4 and rs64a entries.
	* config/rs6000/rs6000.h (MASK_POWERPC64, MASK_64BIT): Expand comments.

bootstrap in progress.

Index: gcc/config/rs6000/linux64.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/linux64.h,v
retrieving revision 1.52
diff -u -p -r1.52 linux64.h
--- gcc/config/rs6000/linux64.h	30 Nov 2003 23:43:05 -0000	1.52
+++ gcc/config/rs6000/linux64.h	8 Jan 2004 01:52:39 -0000
@@ -89,6 +89,11 @@
 	      target_flags &= ~MASK_PROTOTYPE;			\
 	      error (INVALID_64BIT, "prototype");		\
 	    }							\
+          if ((target_flags & MASK_POWERPC64) == 0)		\
+	    {							\
+	      target_flags |= MASK_POWERPC64;			\
+	      error ("-m64 requires a PowerPC64 cpu");		\
+	    }							\
 	}							\
       else							\
 	{							\
Index: gcc/config/rs6000/rs6000.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/rs6000.c,v
retrieving revision 1.566
diff -u -p -r1.566 rs6000.c
--- gcc/config/rs6000/rs6000.c	7 Jan 2004 01:21:27 -0000	1.566
+++ gcc/config/rs6000/rs6000.c	8 Jan 2004 01:53:03 -0000
@@ -662,8 +662,10 @@ rs6000_override_options (const char *def
 	 {"603e", PROCESSOR_PPC603, POWERPC_BASE_MASK | MASK_PPC_GFXOPT},
 	 {"604", PROCESSOR_PPC604, POWERPC_BASE_MASK | MASK_PPC_GFXOPT},
 	 {"604e", PROCESSOR_PPC604e, POWERPC_BASE_MASK | MASK_PPC_GFXOPT},
-	 {"620", PROCESSOR_PPC620, POWERPC_BASE_MASK | MASK_PPC_GFXOPT},
-	 {"630", PROCESSOR_PPC630, POWERPC_BASE_MASK | MASK_PPC_GFXOPT},
+	 {"620", PROCESSOR_PPC620,
+	  POWERPC_BASE_MASK | MASK_PPC_GFXOPT | MASK_POWERPC64},
+	 {"630", PROCESSOR_PPC630,
+	  POWERPC_BASE_MASK | MASK_PPC_GFXOPT | MASK_POWERPC64},
 	 {"740", PROCESSOR_PPC750, POWERPC_BASE_MASK | MASK_PPC_GFXOPT},
 	 {"7400", PROCESSOR_PPC7400, POWERPC_7400_MASK},
 	 {"7450", PROCESSOR_PPC7450, POWERPC_7400_MASK},
@@ -684,8 +686,10 @@ rs6000_override_options (const char *def
 	 {"power", PROCESSOR_POWER, MASK_POWER | MASK_MULTIPLE | MASK_STRING},
 	 {"power2", PROCESSOR_POWER,
 	  MASK_POWER | MASK_POWER2 | MASK_MULTIPLE | MASK_STRING},
-	 {"power3", PROCESSOR_PPC630, POWERPC_BASE_MASK | MASK_PPC_GFXOPT},
-	 {"power4", PROCESSOR_POWER4, POWERPC_BASE_MASK | MASK_PPC_GFXOPT},
+	 {"power3", PROCESSOR_PPC630,
+	  POWERPC_BASE_MASK | MASK_PPC_GFXOPT | MASK_POWERPC64},
+	 {"power4", PROCESSOR_POWER4,
+	  POWERPC_BASE_MASK | MASK_PPC_GFXOPT | MASK_POWERPC64},
 	 {"powerpc", PROCESSOR_POWERPC, POWERPC_BASE_MASK},
 	 {"powerpc64", PROCESSOR_POWERPC64,
 	  POWERPC_BASE_MASK | MASK_POWERPC64},
@@ -695,7 +699,7 @@ rs6000_override_options (const char *def
 	  MASK_POWER | MASK_POWER2 | MASK_MULTIPLE | MASK_STRING},
 	 {"rsc", PROCESSOR_PPC601, MASK_POWER | MASK_MULTIPLE | MASK_STRING},
 	 {"rsc1", PROCESSOR_PPC601, MASK_POWER | MASK_MULTIPLE | MASK_STRING},
-	 {"rs64a", PROCESSOR_RS64A, POWERPC_BASE_MASK},
+	 {"rs64a", PROCESSOR_RS64A, POWERPC_BASE_MASK | MASK_POWERPC64},
       };
 
   const size_t ptt_size = ARRAY_SIZE (processor_target_table);
Index: gcc/config/rs6000/rs6000.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/rs6000.h,v
retrieving revision 1.304
diff -u -p -r1.304 rs6000.h
--- gcc/config/rs6000/rs6000.h	7 Jan 2004 01:21:28 -0000	1.304
+++ gcc/config/rs6000/rs6000.h	8 Jan 2004 01:53:10 -0000
@@ -137,7 +137,7 @@ extern int target_flags;
 /* Use PowerPC Graphics group optional instructions, e.g. fsel.  */
 #define MASK_PPC_GFXOPT		0x00000010
 
-/* Use PowerPC-64 architecture instructions.  */
+/* Use PowerPC-64 architecture instructions and 64 bit registers.  */
 #define MASK_POWERPC64		0x00000020
 
 /* Use revised mnemonic names defined for PowerPC architecture.  */
@@ -160,7 +160,8 @@ extern int target_flags;
    function, and one less allocable register.  */
 #define MASK_MINIMAL_TOC	0x00000200
 
-/* Nonzero for the 64bit model: longs and pointers are 64 bits.  */
+/* Nonzero for the 64 bit ABIs: longs and pointers are 64 bits, and
+   registers are 64 bits.  Requires MASK_POWERPC64.  */
 #define MASK_64BIT		0x00000400
 
 /* Disable use of FPRs.  */

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]