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]

Patch for inlining functions that return complex doubles.


Hi Guys,

  I have applied the following patch to the EGCS sources.  It fixes a
  bug when attempting to incline a function which returns a complex
  double value.

Cheers
	Nick


Tue Dec 15 11:55:30 1998  Nick Clifton  <nickc@cygnus.com>

	* integrate.c (copy_rtx_and_substitute): If a SUBREG is
	replaced by a CONCAT whoes components do not have the same
	mode as the original SUBREG, use a new SUBREG to restore the
	mode. 

	* emit-rtl.c (subreg_realpart_p): Cope with subregs containing
	multiword complex values.


Index: integrate.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gcc/integrate.c,v
retrieving revision 1.130
diff -p -r1.130 integrate.c
*** integrate.c	1998/12/09 14:19:18	1.130
- --- integrate.c	1998/12/15 02:52:34
*************** copy_rtx_and_substitute (orig, map)
*** 2451,2457 ****
  	return gen_rtx_SUBREG (GET_MODE (orig), SUBREG_REG (copy),
  			       SUBREG_WORD (orig) + SUBREG_WORD (copy));
        else if (GET_CODE (copy) == CONCAT)
! 	return (subreg_realpart_p (orig) ? XEXP (copy, 0) : XEXP (copy, 1));
        else
  	return gen_rtx_SUBREG (GET_MODE (orig), copy,
  			       SUBREG_WORD (orig));
- --- 2451,2467 ----
  	return gen_rtx_SUBREG (GET_MODE (orig), SUBREG_REG (copy),
  			       SUBREG_WORD (orig) + SUBREG_WORD (copy));
        else if (GET_CODE (copy) == CONCAT)
! 	{
! 	  rtx retval = subreg_realpart_p (orig) ? XEXP (copy, 0) : XEXP (copy, 1);
! 
! 	  if (GET_MODE (retval) == GET_MODE (orig))
! 	    return retval;
! 	  else
! 	    return gen_rtx_SUBREG (GET_MODE (orig), retval,
! 				   (SUBREG_WORD (orig) %
! 				    (GET_MODE_UNIT_SIZE (GET_MODE (SUBREG_REG (orig)))
! 				     / (unsigned) UNITS_PER_WORD)));
! 	}
        else
  	return gen_rtx_SUBREG (GET_MODE (orig), copy,
  			       SUBREG_WORD (orig));

Index: emit-rtl.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gcc/emit-rtl.c,v
retrieving revision 1.119
diff -p -r1.119 emit-rtl.c
*** emit-rtl.c	1998/11/23 08:13:59	1.119
- --- emit-rtl.c	1998/12/15 02:52:24
*************** subreg_realpart_p (x)
*** 949,955 ****
    if (GET_CODE (x) != SUBREG)
      abort ();
 
!   return SUBREG_WORD (x) == 0;
  }
  
  /* Assuming that X is an rtx (e.g., MEM, REG or SUBREG) for a value,
- --- 949,955 ----
    if (GET_CODE (x) != SUBREG)
      abort ();
 
!   return SUBREG_WORD (x) * UNITS_PER_WORD < GET_MODE_UNIT_SIZE (GET_MODE (SUBREG_REG (x)));
  }
  
  /* Assuming that X is an rtx (e.g., MEM, REG or SUBREG) for a value,



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