egcs combine.c:simplify_shift_const

John Carr jfc@mit.edu
Fri Jan 30 16:29:00 GMT 1998


This patch simplifies (lshiftrt (truncate (lshiftrt))) to
(truncate (lshiftrt)).  This helps the multiply highpart
patterns in the SPARC changes I am working on.

Fri Jan 30 19:19:05 1998  John Carr  <jfc@mit.edu>

	* combine.c (simplify_shift_const):  (lshiftrt (truncate (lshiftrt)))
 	is (truncate (lshiftrt)).

*** combine.c.egcs	Thu Jan 29 16:01:47 1998
--- combine.c	Fri Jan 30 19:18:31 1998
***************
*** 8787,8792 ****
--- 8787,8811 ----
  	      continue;
  	    }
  	  break;
+ 
+ 	case TRUNCATE:
+ 	  /* Change (lshiftrt (truncate (lshiftrt))) to (truncate (lshiftrt)) */
+ 	  if (code == LSHIFTRT
+ 	      && GET_CODE (XEXP (varop, 0)) == LSHIFTRT
+ 	      && GET_CODE (XEXP (XEXP (varop, 0), 1)) == CONST_INT)
+ 	    {
+ 	      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