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]

fix real_value_type hashing


It's probably too much to ask for there to be exactly one
function that hashes rtl instead of five, isn't it.  *sigh*

Anyway, there's now a real_hash function that not only ignores
the padding bits, it also ignores the bits that are ignored for
the class of fp constant.  That function is now used in every
place I could find that hashes rtl.

I also fixed a fistful of bugs in varasm.c wrt MAX_HASH_TABLE.
Sometimes we'd do the modulus, sometimes not; sometimes we'd
do it on signed quantities, sometimes not.  FP vector constants
were completely broken: we'd discard half the constant for the
comparison.

Regression tested on i686 and alphaev67 linux.  Trivially tested
on cc1 for rs6000-ibm-aix4.3.


r~


        * real.c (real_hash): New.
        * real.h: Declare it.
        * cse.c (canon_hash): Use it.
        * cselib.c (hash_rtx): Likewise.
        * emit-rtl.c (const_double_htab_hash): Likewise.
        * rtl.h (CONST_DOUBLE_REAL_VALUE): New.
        * varasm.c (struct rtx_const): Reduce vector size; separate
        integer and fp vectors.
        (HASHBITS): Remove.
        (const_hash_1): Rename from const_hash.  Use real_hash.  Do not
        take modulus MAX_HASH_TABLE.
        (const_hash): New.  Do take modulus MAX_HASH_TABLE.
        (output_constant_def): Do not take modulus MAX_HASH_TABLE.
        (SYMHASH): Don't use HASHBITS.
        (decode_rtx_const): Copy only active bits from REAL_VALUE_TYPE.
        Fix CONST_VECTOR thinko wrt fp vectors.  Fix kind comparison.
        (simplify_subtraction): Fix kind comparison.
        (const_hash_rtx): Return unsigned int.  Don't use HASHBITS.
        Use a union to pun integer array.
        * config/rs6000/rs6000.c (rs6000_hash_constant): Use real_hash;
        only hash two words of integral CONST_DOUBLE.

Index: cse.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cse.c,v
retrieving revision 1.234
diff -c -p -d -r1.234 cse.c
*** cse.c	16 Sep 2002 16:36:31 -0000	1.234
--- cse.c	20 Sep 2002 17:28:19 -0000
*************** canon_hash (x, mode)
*** 2320,2330 ****
  	 the integers representing the constant.  */
        hash += (unsigned) code + (unsigned) GET_MODE (x);
        if (GET_MODE (x) != VOIDmode)
! 	for (i = 2; i < GET_RTX_LENGTH (CONST_DOUBLE); i++)
! 	  {
! 	    unsigned HOST_WIDE_INT tem = XWINT (x, i);
! 	    hash += tem;
! 	  }
        else
  	hash += ((unsigned) CONST_DOUBLE_LOW (x)
  		 + (unsigned) CONST_DOUBLE_HIGH (x));
--- 2320,2326 ----
  	 the integers representing the constant.  */
        hash += (unsigned) code + (unsigned) GET_MODE (x);
        if (GET_MODE (x) != VOIDmode)
! 	hash += real_hash (CONST_DOUBLE_REAL_VALUE (x));
        else
  	hash += ((unsigned) CONST_DOUBLE_LOW (x)
  		 + (unsigned) CONST_DOUBLE_HIGH (x));
Index: cselib.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cselib.c,v
retrieving revision 1.20
diff -c -p -d -r1.20 cselib.c
*** cselib.c	12 Sep 2002 17:31:41 -0000	1.20
--- cselib.c	20 Sep 2002 17:28:19 -0000
*************** hash_rtx (x, mode, create)
*** 581,588 ****
  	 the integers representing the constant.  */
        hash += (unsigned) code + (unsigned) GET_MODE (x);
        if (GET_MODE (x) != VOIDmode)
! 	for (i = 2; i < GET_RTX_LENGTH (CONST_DOUBLE); i++)
! 	  hash += XWINT (x, i);
        else
  	hash += ((unsigned) CONST_DOUBLE_LOW (x)
  		 + (unsigned) CONST_DOUBLE_HIGH (x));
--- 581,587 ----
  	 the integers representing the constant.  */
        hash += (unsigned) code + (unsigned) GET_MODE (x);
        if (GET_MODE (x) != VOIDmode)
! 	hash += real_hash (CONST_DOUBLE_REAL_VALUE (x));
        else
  	hash += ((unsigned) CONST_DOUBLE_LOW (x)
  		 + (unsigned) CONST_DOUBLE_HIGH (x));
Index: emit-rtl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/emit-rtl.c,v
retrieving revision 1.295
diff -c -p -d -r1.295 emit-rtl.c
*** emit-rtl.c	17 Sep 2002 04:15:12 -0000	1.295
--- emit-rtl.c	20 Sep 2002 17:28:19 -0000
*************** static hashval_t
*** 221,232 ****
  const_double_htab_hash (x)
       const void *x;
  {
-   hashval_t h = 0;
-   size_t i;
    rtx value = (rtx) x;
  
!   for (i = 0; i < sizeof(CONST_DOUBLE_FORMAT)-1; i++)
!     h ^= XWINT (value, i);
    return h;
  }
  
--- 221,233 ----
  const_double_htab_hash (x)
       const void *x;
  {
    rtx value = (rtx) x;
+   hashval_t h;
  
!   if (GET_MODE (value) == VOIDmode)
!     h = CONST_DOUBLE_LOW (value) ^ CONST_DOUBLE_HIGH (value);
!   else
!     h = real_hash (CONST_DOUBLE_REAL_VALUE (value));
    return h;
  }
  
Index: real.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/real.c,v
retrieving revision 1.88
diff -c -p -d -r1.88 real.c
*** real.c	20 Sep 2002 07:56:42 -0000	1.88
--- real.c	20 Sep 2002 17:28:19 -0000
*************** significand_size (mode)
*** 2311,2316 ****
--- 2311,2357 ----
  
    return fmt->p * fmt->log2_b;
  }
+ 
+ /* Return a hash value for the given real value.  */
+ /* ??? The "unsigned int" return value is intended to be hashval_t,
+    but I didn't want to pull hashtab.h into real.h.  */
+ 
+ unsigned int
+ real_hash (r)
+      const REAL_VALUE_TYPE *r;
+ {
+   unsigned int h;
+   size_t i;
+ 
+   h = r->class | (r->sign << 2);
+   switch (r->class)
+     {
+     case rvc_zero:
+     case rvc_inf:
+       break;
+ 
+     case rvc_normal:
+       h |= r->exp << 3;
+       /* FALLTHRU */
+ 
+     case rvc_nan:
+       if (sizeof(unsigned long) > sizeof(unsigned int))
+ 	for (i = 0; i < SIGSZ; ++i)
+ 	  {
+ 	    unsigned long s = r->sig[i];
+ 	    h ^= s ^ (s >> (HOST_BITS_PER_LONG / 2));
+ 	  }
+       else
+ 	for (i = 0; i < SIGSZ; ++i)
+ 	  h ^= r->sig[i];
+       break;
+ 
+     default:
+       abort ();
+     }
+ 
+   return h;
+ }
  
  /* IEEE single-precision format.  */
  
Index: real.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/real.h,v
retrieving revision 1.50
diff -c -p -d -r1.50 real.h
*** real.h	20 Sep 2002 07:33:25 -0000	1.50
--- real.h	20 Sep 2002 17:28:19 -0000
*************** extern bool real_nan		PARAMS ((REAL_VALU
*** 169,174 ****
--- 169,176 ----
  
  extern void real_2expN		PARAMS ((REAL_VALUE_TYPE *, int));
  
+ extern unsigned int real_hash	PARAMS ((const REAL_VALUE_TYPE *));
+ 
  /* ====================================================================== */
  /* Crap.  */
  
Index: rtl.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/rtl.h,v
retrieving revision 1.369
diff -c -p -d -r1.369 rtl.h
*** rtl.h	16 Sep 2002 18:33:19 -0000	1.369
--- rtl.h	20 Sep 2002 17:28:19 -0000
*************** enum label_kind
*** 1010,1023 ****
  #define INTVAL(RTX) XCWINT(RTX, 0, CONST_INT)
  
  /* For a CONST_DOUBLE:
!    The usual two ints that hold the value.
!    For a DImode, that is all there are;
!     and CONST_DOUBLE_LOW is the low-order word and ..._HIGH the high-order.
!    For a float, the number of ints varies,
!     and CONST_DOUBLE_LOW is the one that should come first *in memory*.
!     So use &CONST_DOUBLE_LOW(r) as the address of an array of ints.  */
  #define CONST_DOUBLE_LOW(r) XCWINT (r, 0, CONST_DOUBLE)
  #define CONST_DOUBLE_HIGH(r) XCWINT (r, 1, CONST_DOUBLE)
  
  /* For a CONST_VECTOR, return element #n.  */
  #define CONST_VECTOR_ELT(RTX, N) XCVECEXP (RTX, 0, N, CONST_VECTOR)
--- 1010,1022 ----
  #define INTVAL(RTX) XCWINT(RTX, 0, CONST_INT)
  
  /* For a CONST_DOUBLE:
!    For a DImode, there are two integers CONST_DOUBLE_LOW is the
!      low-order word and ..._HIGH the high-order.
!    For a float, there is a REAL_VALUE_TYPE structure, and 
!      CONST_DOUBLE_REAL_VALUE(r) is a pointer to it.  */
  #define CONST_DOUBLE_LOW(r) XCWINT (r, 0, CONST_DOUBLE)
  #define CONST_DOUBLE_HIGH(r) XCWINT (r, 1, CONST_DOUBLE)
+ #define CONST_DOUBLE_REAL_VALUE(r) ((struct real_value *)&CONST_DOUBLE_LOW(r))
  
  /* For a CONST_VECTOR, return element #n.  */
  #define CONST_VECTOR_ELT(RTX, N) XCVECEXP (RTX, 0, N, CONST_VECTOR)
Index: varasm.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/varasm.c,v
retrieving revision 1.310
diff -c -p -d -r1.310 varasm.c
*** varasm.c	8 Sep 2002 12:47:27 -0000	1.310
--- varasm.c	20 Sep 2002 17:28:20 -0000
*************** static HOST_WIDE_INT const_alias_set;
*** 136,148 ****
  static const char *strip_reg_name	PARAMS ((const char *));
  static int contains_pointers_p		PARAMS ((tree));
  static void decode_addr_const		PARAMS ((tree, struct addr_const *));
! static int const_hash			PARAMS ((tree));
  static int compare_constant		PARAMS ((tree, tree));
  static tree copy_constant		PARAMS ((tree));
  static void output_constant_def_contents  PARAMS ((tree, int, int));
  static void decode_rtx_const		PARAMS ((enum machine_mode, rtx,
  					       struct rtx_const *));
! static int const_hash_rtx		PARAMS ((enum machine_mode, rtx));
  static int compare_constant_rtx
    PARAMS ((enum machine_mode, rtx, struct constant_descriptor_rtx *));
  static struct constant_descriptor_rtx * record_constant_rtx
--- 136,149 ----
  static const char *strip_reg_name	PARAMS ((const char *));
  static int contains_pointers_p		PARAMS ((tree));
  static void decode_addr_const		PARAMS ((tree, struct addr_const *));
! static unsigned int const_hash		PARAMS ((tree));
! static unsigned int const_hash_1	PARAMS ((tree));
  static int compare_constant		PARAMS ((tree, tree));
  static tree copy_constant		PARAMS ((tree));
  static void output_constant_def_contents  PARAMS ((tree, int, int));
  static void decode_rtx_const		PARAMS ((enum machine_mode, rtx,
  					       struct rtx_const *));
! static unsigned int const_hash_rtx	PARAMS ((enum machine_mode, rtx));
  static int compare_constant_rtx
    PARAMS ((enum machine_mode, rtx, struct constant_descriptor_rtx *));
  static struct constant_descriptor_rtx * record_constant_rtx
*************** struct rtx_const GTY(())
*** 2166,2176 ****
        HOST_WIDE_INT low;
      } GTY ((tag ("0"))) di;
  
!     /* The max vector size we have is 8 wide.  This should be enough.  */
!     struct rtx_const_vec {
!       HOST_WIDE_INT veclo;
!       HOST_WIDE_INT vechi; 
!     } GTY ((tag ("2"))) vec[16];
    } GTY ((desc ("%1.kind >= RTX_INT"), descbits ("1"))) un;
  };
  
--- 2167,2181 ----
        HOST_WIDE_INT low;
      } GTY ((tag ("0"))) di;
  
!     /* The max vector size we have is 8 wide; two variants for
!        integral and floating point vectors.  */
!     struct rtx_const_int_vec {
!       HOST_WIDE_INT high;
!       HOST_WIDE_INT low;
!     } GTY ((tag ("2"))) int_vec[8];
! 
!     REAL_VALUE_TYPE GTY ((tag ("3"))) fp_vec[8];
! 
    } GTY ((desc ("%1.kind >= RTX_INT"), descbits ("1"))) un;
  };
  
*************** struct constant_descriptor_tree GTY(())
*** 2193,2199 ****
    tree value;
  };
  
- #define HASHBITS 30
  #define MAX_HASH_TABLE 1009
  static GTY(()) struct constant_descriptor_tree *
    const_hash_table[MAX_HASH_TABLE];
--- 2198,2203 ----
*************** const_str_htab_eq (x, y)
*** 2238,2249 ****
  
  /* Compute a hash code for a constant expression.  */
  
! static int
  const_hash (exp)
       tree exp;
  {
    const char *p;
!   int len, hi, i;
    enum tree_code code = TREE_CODE (exp);
  
    /* Either set P and LEN to the address and len of something to hash and
--- 2242,2261 ----
  
  /* Compute a hash code for a constant expression.  */
  
! static unsigned int
  const_hash (exp)
       tree exp;
  {
+   return const_hash_1 (exp) % MAX_HASH_TABLE;
+ }
+ 
+ static unsigned int
+ const_hash_1 (exp)
+      tree exp;
+ {
    const char *p;
!   unsigned int hi;
!   int len, i;
    enum tree_code code = TREE_CODE (exp);
  
    /* Either set P and LEN to the address and len of something to hash and
*************** const_hash (exp)
*** 2257,2265 ****
        break;
  
      case REAL_CST:
!       p = (char *) &TREE_REAL_CST (exp);
!       len = sizeof TREE_REAL_CST (exp);
!       break;
  
      case STRING_CST:
        p = TREE_STRING_POINTER (exp);
--- 2269,2275 ----
        break;
  
      case REAL_CST:
!       return real_hash (TREE_REAL_CST_PTR (exp));
  
      case STRING_CST:
        p = TREE_STRING_POINTER (exp);
*************** const_hash (exp)
*** 2267,2274 ****
        break;
  
      case COMPLEX_CST:
!       return (const_hash (TREE_REALPART (exp)) * 5
! 	      + const_hash (TREE_IMAGPART (exp)));
  
      case CONSTRUCTOR:
        if (TREE_CODE (TREE_TYPE (exp)) == SET_TYPE)
--- 2277,2284 ----
        break;
  
      case COMPLEX_CST:
!       return (const_hash_1 (TREE_REALPART (exp)) * 5
! 	      + const_hash_1 (TREE_IMAGPART (exp)));
  
      case CONSTRUCTOR:
        if (TREE_CODE (TREE_TYPE (exp)) == SET_TYPE)
*************** const_hash (exp)
*** 2285,2307 ****
  	{
  	  tree link;
  
! 	  /* For record type, include the type in the hashing.
! 	     We do not do so for array types
! 	     because (1) the sizes of the elements are sufficient
! 	     and (2) distinct array types can have the same constructor.
! 	     Instead, we include the array size because the constructor could
! 	     be shorter.  */
! 	  if (TREE_CODE (TREE_TYPE (exp)) == RECORD_TYPE)
! 	    hi = ((unsigned long) TREE_TYPE (exp) & ((1 << HASHBITS) - 1))
! 	      % MAX_HASH_TABLE;
! 	  else
! 	    hi = ((5 + int_size_in_bytes (TREE_TYPE (exp)))
! 		  & ((1 << HASHBITS) - 1)) % MAX_HASH_TABLE;
  
  	  for (link = CONSTRUCTOR_ELTS (exp); link; link = TREE_CHAIN (link))
  	    if (TREE_VALUE (link))
! 	      hi
! 		= (hi * 603 + const_hash (TREE_VALUE (link))) % MAX_HASH_TABLE;
  
  	  return hi;
  	}
--- 2295,2305 ----
  	{
  	  tree link;
  
! 	  hi = 5 + int_size_in_bytes (TREE_TYPE (exp));
  
  	  for (link = CONSTRUCTOR_ELTS (exp); link; link = TREE_CHAIN (link))
  	    if (TREE_VALUE (link))
! 	      hi = hi * 603 + const_hash_1 (TREE_VALUE (link));
  
  	  return hi;
  	}
*************** const_hash (exp)
*** 2325,2349 ****
  	  hi = value.offset + CODE_LABEL_NUMBER (XEXP (value.base, 0)) * 13;
  	else
  	  abort ();
- 
- 	hi &= (1 << HASHBITS) - 1;
- 	hi %= MAX_HASH_TABLE;
        }
        return hi;
  
      case PLUS_EXPR:
      case MINUS_EXPR:
!       return (const_hash (TREE_OPERAND (exp, 0)) * 9
! 	      + const_hash (TREE_OPERAND (exp, 1)));
  
      case NOP_EXPR:
      case CONVERT_EXPR:
      case NON_LVALUE_EXPR:
!       return const_hash (TREE_OPERAND (exp, 0)) * 7 + 2;
  
      default:
        /* A language specific constant. Just hash the code.  */
!       return (int) code % MAX_HASH_TABLE;
      }
  
    /* Compute hashing function */
--- 2323,2344 ----
  	  hi = value.offset + CODE_LABEL_NUMBER (XEXP (value.base, 0)) * 13;
  	else
  	  abort ();
        }
        return hi;
  
      case PLUS_EXPR:
      case MINUS_EXPR:
!       return (const_hash_1 (TREE_OPERAND (exp, 0)) * 9
! 	      + const_hash_1 (TREE_OPERAND (exp, 1)));
  
      case NOP_EXPR:
      case CONVERT_EXPR:
      case NON_LVALUE_EXPR:
!       return const_hash_1 (TREE_OPERAND (exp, 0)) * 7 + 2;
  
      default:
        /* A language specific constant. Just hash the code.  */
!       return code;
      }
  
    /* Compute hashing function */
*************** const_hash (exp)
*** 2351,2358 ****
    for (i = 0; i < len; i++)
      hi = ((hi * 613) + (unsigned) (p[i]));
  
-   hi &= (1 << HASHBITS) - 1;
-   hi %= MAX_HASH_TABLE;
    return hi;
  }
  
--- 2346,2351 ----
*************** output_constant_def (exp, defer)
*** 2691,2697 ****
       to see if any of them describes EXP.  If yes, the descriptor records
       the label number already assigned.  */
  
!   hash = const_hash (exp) % MAX_HASH_TABLE;
  
    for (desc = const_hash_table[hash]; desc; desc = desc->next)
      if (compare_constant (exp, desc->value))
--- 2684,2690 ----
       to see if any of them describes EXP.  If yes, the descriptor records
       the label number already assigned.  */
  
!   hash = const_hash (exp);
  
    for (desc = const_hash_table[hash]; desc; desc = desc->next)
      if (compare_constant (exp, desc->value))
*************** struct pool_constant GTY(())
*** 2910,2917 ****
  /* Hash code for a SYMBOL_REF with CONSTANT_POOL_ADDRESS_P true.
     The argument is XSTR (... , 0)  */
  
! #define SYMHASH(LABEL)	\
!   ((((unsigned long) (LABEL)) & ((1 << HASHBITS) - 1))  % MAX_RTX_HASH_TABLE)
  
  /* Initialize constant pool hashing for a new function.  */
  
--- 2903,2909 ----
  /* Hash code for a SYMBOL_REF with CONSTANT_POOL_ADDRESS_P true.
     The argument is XSTR (... , 0)  */
  
! #define SYMHASH(LABEL)	(((unsigned long) (LABEL)) % MAX_RTX_HASH_TABLE)
  
  /* Initialize constant pool hashing for a new function.  */
  
*************** decode_rtx_const (mode, x, value)
*** 2958,2965 ****
        value->kind = RTX_DOUBLE;
        if (GET_MODE (x) != VOIDmode)
  	{
  	  value->mode = GET_MODE (x);
! 	  REAL_VALUE_FROM_CONST_DOUBLE (value->un.du, x);
  	}
        else
  	{
--- 2950,2978 ----
        value->kind = RTX_DOUBLE;
        if (GET_MODE (x) != VOIDmode)
  	{
+ 	  const REAL_VALUE_TYPE *r = CONST_DOUBLE_REAL_VALUE (x);
+ 
  	  value->mode = GET_MODE (x);
! 
! 	  /* Copy the REAL_VALUE_TYPE by members so that we don't
! 	     copy garbage from the original structure into our
! 	     carefully cleaned hashing structure.  */
! 	  value->un.du.class = r->class;
! 	  value->un.du.sign = r->sign;
! 	  switch (r->class)
! 	    {
! 	    case rvc_zero:
! 	    case rvc_inf:
! 	      break;
! 	    case rvc_normal:
! 	      value->un.du.exp = r->exp;
! 	      /* FALLTHRU */
! 	    case rvc_nan:
! 	      memcpy (value->un.du.sig, r->sig, sizeof (r->sig));
! 	      break;
! 	    default:
! 	      abort ();
! 	    }
  	}
        else
  	{
*************** decode_rtx_const (mode, x, value)
*** 2971,2998 ****
      case CONST_VECTOR:
        {
  	int units, i;
- 	rtx elt;
  
  	units = CONST_VECTOR_NUNITS (x);
  	value->kind = RTX_VECTOR;
  	value->mode = mode;
  
! 	for (i = 0; i < units; ++i)
  	  {
! 	    elt = CONST_VECTOR_ELT (x, i);
! 	    if (GET_MODE_CLASS (mode) == MODE_VECTOR_INT)
  	      {
! 		value->un.vec[i].veclo = (HOST_WIDE_INT) INTVAL (elt);
! 		value->un.vec[i].vechi = 0;
  	      }
! 	    else if (GET_MODE_CLASS (mode) == MODE_VECTOR_FLOAT)
  	      {
! 		value->un.vec[i].veclo = (HOST_WIDE_INT) CONST_DOUBLE_LOW (elt);
! 		value->un.vec[i].vechi = (HOST_WIDE_INT) CONST_DOUBLE_HIGH (elt);
  	      }
- 	    else
- 	      abort ();
  	  }
        }
        break;
  
--- 2984,3042 ----
      case CONST_VECTOR:
        {
  	int units, i;
  
  	units = CONST_VECTOR_NUNITS (x);
  	value->kind = RTX_VECTOR;
  	value->mode = mode;
  
! 	if (GET_MODE_CLASS (mode) == MODE_VECTOR_INT)
  	  {
! 	    for (i = 0; i < units; ++i)
  	      {
! 	        rtx elt = CONST_VECTOR_ELT (x, i);
! 	        if (GET_CODE (elt) == CONST_INT)
! 	          {
! 		    value->un.int_vec[i].low = INTVAL (elt);
! 		    value->un.int_vec[i].high = 0;
! 	          }
! 		else
! 	          {
! 		    value->un.int_vec[i].low = CONST_DOUBLE_LOW (elt);
! 		    value->un.int_vec[i].high = CONST_DOUBLE_HIGH (elt);
! 		  }
  	      }
! 	  }
! 	else if (GET_MODE_CLASS (mode) == MODE_VECTOR_FLOAT)
! 	  {
! 	    for (i = 0; i < units; ++i)
  	      {
! 		const REAL_VALUE_TYPE *r
! 		  = CONST_DOUBLE_REAL_VALUE (CONST_VECTOR_ELT (x, i));
! 		REAL_VALUE_TYPE *d = &value->un.fp_vec[i];
! 
! 	        /* Copy the REAL_VALUE_TYPE by members so that we don't
! 	           copy garbage from the original structure into our
! 	           carefully cleaned hashing structure.  */
! 	        d->class = r->class;
! 	        d->sign = r->sign;
! 	        switch (r->class)
! 	          {
! 	          case rvc_zero:
! 	          case rvc_inf:
! 	            break;
! 	          case rvc_normal:
! 	            d->exp = r->exp;
! 	            /* FALLTHRU */
! 	          case rvc_nan:
! 	            memcpy (d->sig, r->sig, sizeof (r->sig));
! 	            break;
! 	          default:
! 	            abort ();
! 	          }
  	      }
  	  }
+ 	else
+ 	  abort ();
        }
        break;
  
*************** decode_rtx_const (mode, x, value)
*** 3047,3053 ****
  	}
      }
  
!   if (value->kind > RTX_VECTOR && value->un.addr.base != 0)
      switch (GET_CODE (value->un.addr.base))
        {
  #if 0
--- 3091,3097 ----
  	}
      }
  
!   if (value->kind >= RTX_INT && value->un.addr.base != 0)
      switch (GET_CODE (value->un.addr.base))
        {
  #if 0
*************** simplify_subtraction (x)
*** 3079,3085 ****
    decode_rtx_const (GET_MODE (x), XEXP (x, 0), &val0);
    decode_rtx_const (GET_MODE (x), XEXP (x, 1), &val1);
  
!   if (val0.kind > RTX_DOUBLE
        && val0.kind == val1.kind
        && val0.un.addr.base == val1.un.addr.base)
      return GEN_INT (val0.un.addr.offset - val1.un.addr.offset);
--- 3123,3129 ----
    decode_rtx_const (GET_MODE (x), XEXP (x, 0), &val0);
    decode_rtx_const (GET_MODE (x), XEXP (x, 1), &val1);
  
!   if (val0.kind >= RTX_INT
        && val0.kind == val1.kind
        && val0.un.addr.base == val1.un.addr.base)
      return GEN_INT (val0.un.addr.offset - val1.un.addr.offset);
*************** simplify_subtraction (x)
*** 3089,3113 ****
  
  /* Compute a hash code for a constant RTL expression.  */
  
! static int
  const_hash_rtx (mode, x)
       enum machine_mode mode;
       rtx x;
  {
!   int hi;
    size_t i;
  
!   struct rtx_const value;
!   decode_rtx_const (mode, x, &value);
  
    /* Compute hashing function */
    hi = 0;
!   for (i = 0; i < sizeof value / sizeof (int); i++)
!     hi += ((int *) &value)[i];
  
!   hi &= (1 << HASHBITS) - 1;
!   hi %= MAX_RTX_HASH_TABLE;
!   return hi;
  }
  
  /* Compare a constant rtl object X with a constant-descriptor DESC.
--- 3133,3159 ----
  
  /* Compute a hash code for a constant RTL expression.  */
  
! static unsigned int
  const_hash_rtx (mode, x)
       enum machine_mode mode;
       rtx x;
  {
!   union {
!     struct rtx_const value;
!     unsigned int data[sizeof(struct rtx_const) / sizeof (unsigned int)];
!   } u;
! 
!   unsigned int hi;
    size_t i;
  
!   decode_rtx_const (mode, x, &u.value);
  
    /* Compute hashing function */
    hi = 0;
!   for (i = 0; i < ARRAY_SIZE (u.data); i++)
!     hi = hi * 613 + u.data[i];
  
!   return hi % MAX_RTX_HASH_TABLE;
  }
  
  /* Compare a constant rtl object X with a constant-descriptor DESC.
Index: config/rs6000/rs6000.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/rs6000.c,v
retrieving revision 1.382
diff -c -p -d -r1.382 rs6000.c
*** config/rs6000/rs6000.c	18 Sep 2002 07:54:56 -0000	1.382
--- config/rs6000/rs6000.c	20 Sep 2002 17:28:24 -0000
*************** static unsigned
*** 11412,11429 ****
  rs6000_hash_constant (k)
       rtx k;
  {
!   unsigned result = (GET_CODE (k) << 3) ^ GET_MODE (k);
!   const char *format = GET_RTX_FORMAT (GET_CODE (k));
!   int flen = strlen (format);
!   int fidx;
    
!   if (GET_CODE (k) == LABEL_REF)
!     return result * 1231 + (unsigned) INSN_UID (XEXP (k, 0));
  
!   if (GET_CODE (k) == CODE_LABEL)
!     fidx = 3;
!   else
!     fidx = 0;
  
    for (; fidx < flen; fidx++)
      switch (format[fidx])
--- 11412,11445 ----
  rs6000_hash_constant (k)
       rtx k;
  {
!   enum rtx_code code = GET_CODE (k);
!   enum machine_mode mode = GET_MODE (k);
!   unsigned result = (code << 3) ^ mode;
!   const char *format;
!   int flen, fidx;
    
!   format = GET_RTX_FORMAT (code);
!   flen = strlen (format);
!   fidx = 0;
  
!   switch (code)
!     {
!     case LABEL_REF:
!       return result * 1231 + (unsigned) INSN_UID (XEXP (k, 0));
! 
!     case CONST_DOUBLE:
!       if (mode != VOIDmode)
! 	return real_hash (CONST_DOUBLE_REAL_VALUE (k)) * result;
!       flen = 2;
!       break;
! 
!     case CODE_LABEL:
!       fidx = 3;
!       break;
! 
!     default:
!       break;
!     }
  
    for (; fidx < flen; fidx++)
      switch (format[fidx])
*************** rs6000_hash_constant (k)
*** 11460,11465 ****
--- 11476,11482 ----
        default:
  	abort ();
        }
+ 
    return result;
  }
  


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