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]

[RFC] Kill bogosity in rtx_cost



After talking over with Richard about some of the things
rtx_cost() does the other week we stumbled upon this turd.

It special cases multiplication by a power of 2 and gives
it a cost like a shift.

That doesn't make any sense.  What CSE does is substitute,
simply the RTX expressions, _then_ compute costs.

Given that, this code should just be killed because it serves
not purpose other than confuse.

Any objections?  If not I'll install this on the mainline.

2002-05-10  David S. Miller  <davem@redhat.com>

	* cse.c (rtx_cost): Remove multiplication by power of 2 special
	casing.

--- cse.c.~1~	Wed May  8 22:46:11 2002
+++ cse.c	Fri May 10 09:01:02 2002
@@ -842,13 +842,7 @@ rtx_cost (x, outer_code)
   switch (code)
     {
     case MULT:
-      /* Count multiplication by 2**n as a shift,
-	 because if we are considering it, we would output it as a shift.  */
-      if (GET_CODE (XEXP (x, 1)) == CONST_INT
-	  && exact_log2 (INTVAL (XEXP (x, 1))) >= 0)
-	total = 2;
-      else
-	total = COSTS_N_INSNS (5);
+      total = COSTS_N_INSNS (5);
       break;
     case DIV:
     case UDIV:


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