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]

Mips: Disallow -mgp32 -mfp64


This patch disallows -mgp32 (assume GPRs are 32-bits) and -mfp64
(assume FPRs are 64-bits), since 64-bit FPRs are a MIPS 3 feature, and
all MIPS3 machines have 64 bit GPR registers.  It also prevents the
compiler from tripping over problems in moving 64-bit values in the
FPR registers to the GPR registers (if the compiler needed to do this,
it would have to store the value into memory and then reload with 2
loads, since there aren't instructions to transfer just the upper
32-bits).  I cleared with Eric Christopher before applying the patch,
and built a mips tool chain with it.

In building the tool chain, I discovered that there was a case where a
long value was printed out using a %d format, and I fixed that under
the obvious rule.

2001-09-11  Michael Meissner  <meissner@redhat.com>

	* config/mips/mips.h (CC1_SPEC): If -mgp32 default to -mfp32, and
	give an error if the user uses -mfp32.
	(CPP_FPR_SPEC): Define __mips_fpr to be 32 or 64 depending on the
	default options.
	(CPP_SPEC): Define __mips_fpr to be 32 or 64, depending on the
	floating point register size.
	(EXTRA_SPECS): Add CPP_FPR_SPEC.

	* config/mips/netbsd.h (ASM_FINISH_DECLARE_OBJECT): Use
	HOST_WIDE_INT_PRINT_DEC to properly print the result of
	int_size_in_bytes.
	* config/mips/elf.h (ASM_FINISH_DECLARE_OBJECT): Ditto.
	* config/mips/elf64.h (ASM_FINISH_DECLARE_OBJECT): Ditto.

*** gcc/config/mips/mips.h.~1~	Tue Sep  4 14:16:27 2001
--- gcc/config/mips/mips.h	Mon Sep 10 23:30:59 2001
*************** while (0)
*** 952,957 ****
--- 952,960 ----
  #endif
  
  /* CC1_SPEC is the set of arguments to pass to the compiler proper.  */
+ /* Note, we will need to adjust the following if we ever find a MIPS variant
+    that has 32-bit GPRs and 64-bit FPRs as well as fix all of the reload bugs
+    that show up in this case.  */
  
  #ifndef CC1_SPEC
  #define CC1_SPEC "\
*************** while (0)
*** 962,967 ****
--- 965,971 ----
  %{mfp64:%{msingle-float:%emay not use both -mfp64 and -msingle-float}} \
  %{mfp64:%{m4650:%emay not use both -mfp64 and -m4650}} \
  %{mint64|mlong64|mlong32:-mexplicit-type-size }\
+ %{mgp32: %{mfp64:%emay not use both -mgp32 and -mfp64} %{!mfp32: -mfp32}} \
  %{G*} %{EB:-meb} %{EL:-mel} %{EB:%{EL:%emay not use both -EB and -EL}} \
  %{pic-none:   -mno-half-pic} \
  %{pic-lib:    -mhalf-pic} \
*************** while (0)
*** 999,1004 ****
--- 1003,1017 ----
  #endif
  #endif
  
+ /* Define appropriate macros for fpr register size.  */
+ #ifndef CPP_FPR_SPEC
+ #if ((TARGET_DEFAULT | TARGET_CPU_DEFAULT) & MASK_FLOAT64)
+ #define CPP_FPR_SPEC "-D__mips_fpr=64"
+ #else
+ #define CPP_FPR_SPEC "-D__mips_fpr=32"
+ #endif
+ #endif
+ 
  /* For C++ we need to ensure that _LANGUAGE_C_PLUS_PLUS is defined independent
     of the source file extension.  */
  #undef CPLUSPLUS_CPP_SPEC
*************** while (0)
*** 1017,1022 ****
--- 1030,1036 ----
  %{mips3:-U__mips -D__mips=3 -D__mips64} \
  %{mips4:-U__mips -D__mips=4 -D__mips64} \
  %{mgp32:-U__mips64} %{mgp64:-D__mips64} \
+ %{mfp32:-D__mips_fpr=32} %{mfp64:-D__mips_fpr=64} %{!mfp32: %{!mfp64: %{mgp32:-D__mips_fpr=32} %{!mgp32: %(cpp_fpr_spec)}}} \
  %{msingle-float:%{!msoft-float:-D__mips_single_float}} \
  %{m4650:%{!msoft-float:-D__mips_single_float}} \
  %{msoft-float:-D__mips_soft_float} \
*************** while (0)
*** 1044,1049 ****
--- 1058,1064 ----
    { "subtarget_cpp_spec", SUBTARGET_CPP_SPEC },				\
    { "subtarget_cpp_size_spec", SUBTARGET_CPP_SIZE_SPEC },		\
    { "long_max_spec", LONG_MAX_SPEC },					\
+   { "cpp_fpr_spec", CPP_FPR_SPEC },					\
    { "mips_as_asm_spec", MIPS_AS_ASM_SPEC },				\
    { "gas_asm_spec", GAS_ASM_SPEC },					\
    { "target_asm_spec", TARGET_ASM_SPEC },				\
*** gcc/config/mips/netbsd.h.~1~	Thu Aug 30 20:12:53 2001
--- gcc/config/mips/netbsd.h	Mon Sep 10 23:35:37 2001
*************** do {									 \
*** 175,181 ****
  	 size_directive_output = 1;					 \
  	 fprintf (FILE, "%s", SIZE_ASM_OP);				 \
  	 assemble_name (FILE, name);					 \
! 	 fprintf (FILE, ",%d\n",  int_size_in_bytes (TREE_TYPE (DECL))); \
         }								 \
     } while (0)
  
--- 175,184 ----
  	 size_directive_output = 1;					 \
  	 fprintf (FILE, "%s", SIZE_ASM_OP);				 \
  	 assemble_name (FILE, name);					 \
! 	 fprintf (FILE, ",");						 \
! 	 fprintf (FILE, HOST_WIDE_INT_PRINT_DEC,			 \
! 		  int_size_in_bytes (TREE_TYPE (DECL)));		 \
! 	 fprintf (FILE, "\n");						 \
         }								 \
     } while (0)
  
*** gcc/config/mips/elf.h.~1~	Thu Aug 30 20:12:52 2001
--- gcc/config/mips/elf.h	Mon Sep 10 23:35:26 2001
*************** do {									 \
*** 174,180 ****
  	 size_directive_output = 1;					 \
  	 fprintf (FILE, "%s", SIZE_ASM_OP);				 \
  	 assemble_name (FILE, name);					 \
! 	 fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL)));  \
         }								 \
     } while (0)
  
--- 174,183 ----
  	 size_directive_output = 1;					 \
  	 fprintf (FILE, "%s", SIZE_ASM_OP);				 \
  	 assemble_name (FILE, name);					 \
! 	 fprintf (FILE, ",");						 \
! 	 fprintf (FILE, HOST_WIDE_INT_PRINT_DEC,			 \
! 		  int_size_in_bytes (TREE_TYPE (DECL)));		 \
! 	 fprintf (FILE, "\n");						 \
         }								 \
     } while (0)
  
*** gcc/config/mips/elf64.h.~1~	Thu Aug 30 20:12:52 2001
--- gcc/config/mips/elf64.h	Mon Sep 10 23:35:16 2001
*************** do {									 \
*** 153,159 ****
  	 size_directive_output = 1;					 \
  	 fprintf (FILE, "%s", SIZE_ASM_OP);				 \
  	 assemble_name (FILE, name);					 \
! 	 fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL)));  \
         }								 \
     } while (0)
  
--- 153,162 ----
  	 size_directive_output = 1;					 \
  	 fprintf (FILE, "%s", SIZE_ASM_OP);				 \
  	 assemble_name (FILE, name);					 \
! 	 fprintf (FILE, ",");						 \
! 	 fprintf (FILE, HOST_WIDE_INT_PRINT_DEC,			 \
! 		  int_size_in_bytes (TREE_TYPE (DECL)));		 \
! 	 fprintf (FILE, "\n");						 \
         }								 \
     } while (0)
  
-- 
Michael Meissner, Red Hat, Inc.  (GCC group)
PMB 198, 174 Littleton Road #3, Westford, Massachusetts 01886, USA
Work:	  meissner@redhat.com		phone: +1 978-486-9304
Non-work: meissner@spectacle-pond.org	fax:   +1 978-692-4482


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