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]

Re: Internal compiler error in gcc-2.95 19990623 on PowerPC


>>>>> Jeffrey A Law writes:

Jeff> Note the the PRE_INC/PRE_DEC case is trivial to implement -- just do the
Jeff> inc/dec of the base register and emit code as if the address was offsettable.

	PowerPC only supports PRE_INC/PRE_DEC.  As far as I can tell, the
original offsettable sequences handle these exact cases -- it performs the
load or store with update to the lower address and then the neighboring
load or store without update using displacement 4.  I cannot see any case
in which the PRE_INC/PRE_DEC affects the validity of the address in this
instance despite the offsettable test failing.

	I think the real problem has been that offsettable_memref_p() is
not the right test for which sequence to use on PowerPC, or at least the
mode_dependent_address_p() restriction is inappropriate.  The question
really should be nonindexed_memref_p().

	I have applied the appended patch to the mainline which handles
PRE_INC and PRE_DEC as offsettable, just like LO_SUM.

David

Index: rs6000.md
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/config/rs6000/rs6000.md,v
retrieving revision 1.55.4.6
diff -c -p -r1.55.4.6 rs6000.md
*** rs6000.md	1999/06/28 03:21:13	1.55.4.6
--- rs6000.md	1999/07/02 03:56:24
***************
*** 6329,6335 ****
      case 1:
        if (offsettable_memref_p (operands[1])
  	  || (GET_CODE (operands[1]) == MEM
! 	      && GET_CODE (XEXP (operands[1], 0)) == LO_SUM))
  	{
  	  /* If the low-address word is used in the address, we must load
  	     it last.  Otherwise, load it first.  Note that we cannot have
--- 6329,6337 ----
      case 1:
        if (offsettable_memref_p (operands[1])
  	  || (GET_CODE (operands[1]) == MEM
! 	      && (GET_CODE (XEXP (operands[1], 0)) == LO_SUM
! 		  || GET_CODE (XEXP (operands[1], 0)) == PRE_INC
! 		  || GET_CODE (XEXP (operands[1], 0)) == PRE_DEC)))
  	{
  	  /* If the low-address word is used in the address, we must load
  	     it last.  Otherwise, load it first.  Note that we cannot have
***************
*** 6345,6354 ****
  	{
  	  rtx addreg;
  
- 	  if (GET_CODE (XEXP (operands[1], 0)) == PRE_INC
- 	      || GET_CODE (XEXP (operands[1], 0)) == PRE_DEC)
- 	    abort ();
- 
  	  addreg = find_addr_reg (XEXP (operands[1], 0));
  	  if (refers_to_regno_p (REGNO (operands[0]),
  				 REGNO (operands[0]) + 1,
--- 6347,6352 ----
***************
*** 6371,6385 ****
      case 2:
        if (offsettable_memref_p (operands[0])
  	  || (GET_CODE (operands[0]) == MEM
! 	      && GET_CODE (XEXP (operands[0], 0)) == LO_SUM))
  	return \"{st%U0|stw%U0} %1,%0\;{st|stw} %L1,%L0\";
        else
  	{
  	  rtx addreg;
- 
- 	  if (GET_CODE (XEXP (operands[0], 0)) == PRE_INC
- 	      || GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)
- 	    abort ();
  
  	  addreg = find_addr_reg (XEXP (operands[0], 0));
  	  output_asm_insn (\"{stx|stwx} %1,%0\", operands);
--- 6369,6381 ----
      case 2:
        if (offsettable_memref_p (operands[0])
  	  || (GET_CODE (operands[0]) == MEM
! 	      && (GET_CODE (XEXP (operands[0], 0)) == LO_SUM
! 		  || GET_CODE (XEXP (operands[0], 0)) == PRE_INC
! 		  || GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)))
  	return \"{st%U0|stw%U0} %1,%0\;{st|stw} %L1,%L0\";
        else
  	{
  	  rtx addreg;
  
  	  addreg = find_addr_reg (XEXP (operands[0], 0));
  	  output_asm_insn (\"{stx|stwx} %1,%0\", operands);


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