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]

problem with emit-rtl.c change


Herman ten Brugge writes:

 > The change to emit-rtl.c:
 > 
 > Revision 1.179 Mon Jun 4 18:04:35 2001 UTC (2 days, 18 hours ago) by hubicka 
 > Branch: MAIN 
 > 
 >         * emit-rtl.c (constant_subword): Deprecate; remove most of code
 >         and use simplify_gen_subreg.
 > 
 > gives problems on the c4x target. The new code dumps core in
 > gen_lowpart_common at line 971.


How about this which avoids explicit references to SFmode, DFmode,
etc?


Index: emit-rtl.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/emit-rtl.c,v
retrieving revision 1.180
diff -c -3 -p -r1.180 emit-rtl.c
*** emit-rtl.c	2001/06/07 07:54:53	1.180
--- emit-rtl.c	2001/06/09 00:53:07
*************** gen_lowpart_common (mode, x)
*** 900,916 ****
       doesn't have to deal with constructs like (subreg:DI
       (const_double:SF ...)) or (subreg:DF (const_int ...)).  */
  
!   else if (mode == SFmode
  	   && GET_CODE (x) == CONST_INT)
!     {
        REAL_VALUE_TYPE r;
        HOST_WIDE_INT i;
  
        i = INTVAL (x);
        r = REAL_VALUE_FROM_TARGET_SINGLE (i);
        return CONST_DOUBLE_FROM_REAL_VALUE (r, mode);
!     }
!   else if (mode == DFmode
  	   && (GET_CODE (x) == CONST_INT || GET_CODE (x) == CONST_DOUBLE)
  	   && GET_MODE (x) == VOIDmode)
      {
--- 900,918 ----
       doesn't have to deal with constructs like (subreg:DI
       (const_double:SF ...)) or (subreg:DF (const_int ...)).  */
  
!   else if (GET_MODE_CLASS (mode) == MODE_FLOAT
! 	   && GET_MODE_SIZE (mode) == UNITS_PER_WORD
  	   && GET_CODE (x) == CONST_INT)
!   {
        REAL_VALUE_TYPE r;
        HOST_WIDE_INT i;
  
        i = INTVAL (x);
        r = REAL_VALUE_FROM_TARGET_SINGLE (i);
        return CONST_DOUBLE_FROM_REAL_VALUE (r, mode);
!   }
!   else if (GET_MODE_CLASS (mode) == MODE_FLOAT
! 	   && GET_MODE_SIZE (mode) == 2 * UNITS_PER_WORD
  	   && (GET_CODE (x) == CONST_INT || GET_CODE (x) == CONST_DOUBLE)
  	   && GET_MODE (x) == VOIDmode)
      {
*************** gen_lowpart_common (mode, x)
*** 949,971 ****
        int endian = WORDS_BIG_ENDIAN ? 1 : 0;
  
        REAL_VALUE_FROM_CONST_DOUBLE (r, x);
!       switch (GET_MODE (x))
  	{
! 	case SFmode:
  	  REAL_VALUE_TO_TARGET_SINGLE (r, i[endian]);
  	  i[1 - endian] = 0;
  	  break;
! 	case DFmode:
  	  REAL_VALUE_TO_TARGET_DOUBLE (r, i);
  	  break;
! #if LONG_DOUBLE_TYPE_SIZE == 96
! 	case XFmode:
  	  REAL_VALUE_TO_TARGET_LONG_DOUBLE (r, i + endian);
  	  i[3-3*endian] = 0;
! #else
! 	case TFmode:
  	  REAL_VALUE_TO_TARGET_LONG_DOUBLE (r, i);
- #endif
  	  break;
  	default:
  	  abort ();
--- 951,971 ----
        int endian = WORDS_BIG_ENDIAN ? 1 : 0;
  
        REAL_VALUE_FROM_CONST_DOUBLE (r, x);
!       switch (GET_MODE_SIZE (GET_MODE (x)) / UNITS_PER_WORD)
  	{
! 	case 1:
  	  REAL_VALUE_TO_TARGET_SINGLE (r, i[endian]);
  	  i[1 - endian] = 0;
  	  break;
! 	case 2:
  	  REAL_VALUE_TO_TARGET_DOUBLE (r, i);
  	  break;
! 	case 3:
  	  REAL_VALUE_TO_TARGET_LONG_DOUBLE (r, i + endian);
  	  i[3-3*endian] = 0;
! 	  break;
! 	case 4:
  	  REAL_VALUE_TO_TARGET_LONG_DOUBLE (r, i);
  	  break;
  	default:
  	  abort ();
*************** gen_lowpart_common (mode, x)
*** 985,1003 ****
  	for (c = 0; c < 4; c++)
  	  i[c] &= ~ (0L);
  
! 	switch (GET_MODE (x))
  	  {
! 	  case SFmode:
! 	  case DFmode:
  	    return immed_double_const (((unsigned long) i[endian]) |
  				       (((HOST_WIDE_INT) i[1-endian]) << 32),
  				       0, mode);
! 	  default:
  	    return immed_double_const (((unsigned long) i[endian*3]) |
  				       (((HOST_WIDE_INT) i[1+endian]) << 32),
  				       ((unsigned long) i[2-endian]) |
  				       (((HOST_WIDE_INT) i[3-endian*3]) << 32),
  				       mode);
  	  }
        }
  #endif
--- 985,1006 ----
  	for (c = 0; c < 4; c++)
  	  i[c] &= ~ (0L);
  
! 	switch (GET_MODE_SIZE (GET_MODE (x)) / UNITS_PER_WORD)
  	  {
! 	  case 1:
! 	  case 2:
  	    return immed_double_const (((unsigned long) i[endian]) |
  				       (((HOST_WIDE_INT) i[1-endian]) << 32),
  				       0, mode);
! 	  case 3:
! 	  case 4:
  	    return immed_double_const (((unsigned long) i[endian*3]) |
  				       (((HOST_WIDE_INT) i[1+endian]) << 32),
  				       ((unsigned long) i[2-endian]) |
  				       (((HOST_WIDE_INT) i[3-endian*3]) << 32),
  				       mode);
+ 	  default:
+ 	    abort ();
  	  }
        }
  #endif



Michael.


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