This is the mail archive of the gcc-bugs@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]

Re: SH-ELF: shift_cost[] indexed incorrectly and RTX_COST problems


I have checked the appended patch into the 3.0 branch and the mainline.
This fixes the out-of-bounds array indexing of shift_cost and the costs
for shift.
I don't see any compelling reason to fix all the costs for DImode
operations, since it seems to work fairly good anyways, and we never
made any real effort to get good code for long long anyways.

If you can show me a testcase that really benefits from more accurate
costs, I might reconsider.

Thu Sep 20 12:49:34 2001  J"orn Rennecke <amylaar@redhat.com>

	* sh.c (shiftcosts): Don't use shiftcosts array for modes wider
	than SImode.

Index: config/sh/sh.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/sh/sh.c,v
retrieving revision 1.89.2.8
diff -p -r1.89.2.8 sh.c
*** sh.c	2001/09/20 11:26:53	1.89.2.8
--- sh.c	2001/09/20 11:42:33
*************** shiftcosts (x)
*** 1005,1010 ****
--- 1005,1020 ----
  {
    int value;
  
+   if (GET_MODE_SIZE (GET_MODE (x)) > UNITS_PER_WORD)
+     {
+       if (GET_MODE (x) == DImode
+ 	  && GET_CODE (XEXP (x, 1)) == CONST_INT
+ 	  && INTVAL (XEXP (x, 1)) == 1)
+ 	return 2;
+ 
+       /* Everything else is invalid, because there is no pattern for it.  */
+       return 10000;
+     }
    /* If shift by a non constant, then this will be expensive.  */
    if (GET_CODE (XEXP (x, 1)) != CONST_INT)
      return SH_DYNAMIC_SHIFT_COST;


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