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]

[PATCH, committed] PR target/18641: DImode in FPRs


	The following patch changes reload and register preferencing
behavior to avoid the problems with DImode values in FPRs.
PREFERRED_RELOAD_CLASS is modified so that any constant reloaded into a
register class containing FLOAT_REGS is reloaded via memory.  The 32-bit
and 64-bit movdi matcher patterns are modified so that FPRs do not
contribute to the register preferencing calculations.

	Th performance of generate code with the original source, with the
patches, and with other variations were tested and no differences above
the noise level were observed.

	Retesting earlier bug reports did not show a need to discourage
the FPR alternatives for reload after the preferencing change, but this
will be revisited as necessary.

	Bootstrapped and regression tested on powerpc-ibm-aix5.2.0.0 and
powerpc-apple-darwin7.6.0.

David


2004-12-11  David Edelsohn  <edelsohn@gnu.org>
	    Ulrich Weigand  <uweigand@de.ibm.com>

	PR target/18641
	* config/rs6000/darwin.h (PREFERRED_RELOAD_CLASS): Reload all
	constants into all register classes intersecting with FLOAT_REGS
	via memory.
	* config/rs6000/rs6000.h (PREFERRED_RELOAD_CLASS): Same.
	* config/rs6000/rs6000.md (movdi_internal32): Ignore FPRs when
	choosing register preferences.
	(movdi_internal64): Same.

Index: darwin.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/darwin.h,v
retrieving revision 1.73
diff -c -p -r1.73 darwin.h
*** darwin.h	2 Dec 2004 18:42:26 -0000	1.73
--- darwin.h	11 Dec 2004 17:23:01 -0000
*************** do {									\
*** 342,349 ****
  
  #undef PREFERRED_RELOAD_CLASS
  #define PREFERRED_RELOAD_CLASS(X,CLASS)				\
!   ((GET_CODE (X) == CONST_DOUBLE				\
!     && GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT)		\
     ? NO_REGS							\
     : ((GET_CODE (X) == SYMBOL_REF || GET_CODE (X) == HIGH)	\
        && reg_class_subset_p (BASE_REGS, (CLASS)))		\
--- 342,349 ----
  
  #undef PREFERRED_RELOAD_CLASS
  #define PREFERRED_RELOAD_CLASS(X,CLASS)				\
!   ((CONSTANT_P (X)						\
!     && reg_classes_intersect_p ((CLASS), FLOAT_REGS))		\
     ? NO_REGS							\
     : ((GET_CODE (X) == SYMBOL_REF || GET_CODE (X) == HIGH)	\
        && reg_class_subset_p (BASE_REGS, (CLASS)))		\
Index: rs6000.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/rs6000.h,v
retrieving revision 1.348
diff -c -p -r1.348 rs6000.h
*** rs6000.h	27 Nov 2004 22:45:24 -0000	1.348
--- rs6000.h	11 Dec 2004 17:23:01 -0000
*************** enum reg_class
*** 1397,1409 ****
   */
  
  #define PREFERRED_RELOAD_CLASS(X,CLASS)			\
!   (((GET_CODE (X) == CONST_DOUBLE			\
!      && GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT)	\
!     ? NO_REGS 						\
!     : (GET_MODE_CLASS (GET_MODE (X)) == MODE_INT 	\
!        && (CLASS) == NON_SPECIAL_REGS)			\
!     ? GENERAL_REGS					\
!     : (CLASS)))
  
  /* Return the register class of a scratch register needed to copy IN into
     or out of a register in CLASS in MODE.  If it can be done directly,
--- 1397,1409 ----
   */
  
  #define PREFERRED_RELOAD_CLASS(X,CLASS)			\
!   ((CONSTANT_P (X)					\
!     && reg_classes_intersect_p ((CLASS), FLOAT_REGS))	\
!    ? NO_REGS 						\
!    : (GET_MODE_CLASS (GET_MODE (X)) == MODE_INT 	\
!       && (CLASS) == NON_SPECIAL_REGS)			\
!    ? GENERAL_REGS					\
!    : (CLASS))
  
  /* Return the register class of a scratch register needed to copy IN into
     or out of a register in CLASS in MODE.  If it can be done directly,
Index: rs6000.md
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/rs6000.md,v
retrieving revision 1.336
diff -c -p -r1.336 rs6000.md
*** rs6000.md	1 Dec 2004 17:18:38 -0000	1.336
--- rs6000.md	11 Dec 2004 17:23:01 -0000
***************
*** 8496,8502 ****
  ; List r->r after r->"o<>", otherwise reload will try to reload a
  ; non-offsettable address by using r->r which won't make progress.
  (define_insn "*movdi_internal32"
!   [(set (match_operand:DI 0 "nonimmediate_operand" "=o<>,r,r,f,f,m,r")
  	(match_operand:DI 1 "input_operand" "r,r,m,f,m,f,IJKnGHF"))]
    "! TARGET_POWERPC64
     && (gpc_reg_operand (operands[0], DImode)
--- 8496,8502 ----
  ; List r->r after r->"o<>", otherwise reload will try to reload a
  ; non-offsettable address by using r->r which won't make progress.
  (define_insn "*movdi_internal32"
!   [(set (match_operand:DI 0 "nonimmediate_operand" "=o<>,r,r,*f,*f,m,r")
  	(match_operand:DI 1 "input_operand" "r,r,m,f,m,f,IJKnGHF"))]
    "! TARGET_POWERPC64
     && (gpc_reg_operand (operands[0], DImode)
***************
*** 8567,8573 ****
  }")
  
  (define_insn "*movdi_internal64"
!   [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,m,r,r,r,r,??f,f,m,r,*h,*h")
  	(match_operand:DI 1 "input_operand" "r,m,r,I,L,nF,R,f,m,f,*h,r,0"))]
    "TARGET_POWERPC64
     && (gpc_reg_operand (operands[0], DImode)
--- 8567,8573 ----
  }")
  
  (define_insn "*movdi_internal64"
!   [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,m,r,r,r,r,*f,*f,m,r,*h,*h")
  	(match_operand:DI 1 "input_operand" "r,m,r,I,L,nF,R,f,m,f,*h,r,0"))]
    "TARGET_POWERPC64
     && (gpc_reg_operand (operands[0], DImode)


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