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]

more BImode canonicalization


Fixed by reusing existing code.  Gasp.


r~

        * emit-rtl.c (gen_lowpart_common): Use trunc_int_for_mode.

Index: emit-rtl.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/emit-rtl.c,v
retrieving revision 1.147
diff -c -p -d -r1.147 emit-rtl.c
*** emit-rtl.c	2000/09/18 23:48:35	1.147
--- emit-rtl.c	2000/09/24 23:04:49
*************** gen_lowpart_common (mode, x)
*** 767,777 ****
      {
        /* If MODE is twice the host word size, X is already the desired
  	 representation.  Otherwise, if MODE is wider than a word, we can't
! 	 do this.  If MODE is exactly a word, return just one CONST_INT.
! 	 If MODE is smaller than a word, clear the bits that don't belong
! 	 in our mode, unless they and our sign bit are all one.  So we get
! 	 either a reasonable negative value or a reasonable unsigned value
! 	 for this mode.  */
  
        if (GET_MODE_BITSIZE (mode) >= 2 * HOST_BITS_PER_WIDE_INT)
  	return x;
--- 767,773 ----
      {
        /* If MODE is twice the host word size, X is already the desired
  	 representation.  Otherwise, if MODE is wider than a word, we can't
! 	 do this.  If MODE is exactly a word, return just one CONST_INT.  */
  
        if (GET_MODE_BITSIZE (mode) >= 2 * HOST_BITS_PER_WIDE_INT)
  	return x;
*************** gen_lowpart_common (mode, x)
*** 783,794 ****
        else
  	{
  	  /* MODE must be narrower than HOST_BITS_PER_WIDE_INT.  */
- 	  int width = GET_MODE_BITSIZE (mode);
  	  HOST_WIDE_INT val = (GET_CODE (x) == CONST_INT ? INTVAL (x)
  			       : CONST_DOUBLE_LOW (x));
  
  	  /* Sign extend to HOST_WIDE_INT.  */
! 	  val = val << (HOST_BITS_PER_WIDE_INT - width) >> (HOST_BITS_PER_WIDE_INT - width);
  
  	  return (GET_CODE (x) == CONST_INT && INTVAL (x) == val ? x
  		  : GEN_INT (val));
--- 779,789 ----
        else
  	{
  	  /* MODE must be narrower than HOST_BITS_PER_WIDE_INT.  */
  	  HOST_WIDE_INT val = (GET_CODE (x) == CONST_INT ? INTVAL (x)
  			       : CONST_DOUBLE_LOW (x));
  
  	  /* Sign extend to HOST_WIDE_INT.  */
! 	  val = trunc_int_for_mode (val, mode);
  
  	  return (GET_CODE (x) == CONST_INT && INTVAL (x) == val ? x
  		  : GEN_INT (val));

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