egcs combine.c:simplify_shift_const

John Carr jfc@mit.edu
Sat Jan 31 12:23:00 GMT 1998


The cases I was looking at had a shift count large enough that the
truncate was a no-op.  This updated patch tests for a small shift
count.

*** combine.c.egcs	Thu Jan 29 16:01:47 1998
--- combine.c	Sat Jan 31 15:20:27 1998
***************
*** 8787,8792 ****
--- 8787,8814 ----
  	      continue;
  	    }
  	  break;
+ 
+ 	case TRUNCATE:
+ 	  /* Change (lshiftrt (truncate (lshiftrt))) to (truncate (lshiftrt))
+ 	     if the truncate does not affect the value.  */
+ 	  if (code == LSHIFTRT
+ 	      && GET_CODE (XEXP (varop, 0)) == LSHIFTRT
+ 	      && GET_CODE (XEXP (XEXP (varop, 0), 1)) == CONST_INT
+ 	      && (INTVAL (XEXP (XEXP (varop, 0), 1))
+ 		  >= (GET_MODE_BITSIZE (GET_MODE (XEXP (varop, 0))) - GET_MODE_BITSIZE (varop))))
+ 	    {
+ 	      rtx varop_inner = XEXP (varop, 0);
+ 
+ 	      varop_inner = gen_rtx_combine (LSHIFTRT,
+ 					     GET_MODE (varop_inner),
+ 					     XEXP (varop_inner, 0),
+ 					     GEN_INT (count + INTVAL (XEXP (varop_inner, 1))));
+ 	      varop = gen_rtx_combine (TRUNCATE, GET_MODE (varop),
+ 				       varop_inner);
+ 	      count = 0;
+ 	      continue;
+ 	    }
+ 	  break;
  	  
  	default:
  	  break;



More information about the Gcc mailing list