This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
SH costs fixes for bugs detected by RTL strict checking
- To: gcc-patches at gcc dot gnu dot org
- Subject: SH costs fixes for bugs detected by RTL strict checking
- From: Alexandre Oliva <aoliva at redhat dot com>
- Date: 01 Dec 2000 01:26:01 -0200
- Organization: GCC Team, Red Hat
I'm checking this in, under the ``obviously correct'' rule.
Index: gcc/ChangeLog
from Alexandre Oliva <aoliva@redhat.com>
* config/sh/sh.c (shiftcosts): Don't get INTVAL before testing
whether X is a CONST_INT.
(addsubcosts): Likewise.
* final.c (output_addr_const) <PLUS>: Don't assume at least one
operand is a CONST_INT.
Index: gcc/config/sh/sh.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/sh/sh.c,v
retrieving revision 1.78
diff -u -p -r1.78 sh.c
--- gcc/config/sh/sh.c 2000/11/25 04:42:27 1.78
+++ gcc/config/sh/sh.c 2000/12/01 03:24:07
@@ -965,12 +965,14 @@ int
shiftcosts (x)
rtx x;
{
- int value = INTVAL (XEXP (x, 1));
+ int value;
/* If shift by a non constant, then this will be expensive. */
if (GET_CODE (XEXP (x, 1)) != CONST_INT)
return SH_DYNAMIC_SHIFT_COST;
+ value = INTVAL (XEXP (x, 1));
+
/* Otherwise, return the true cost in instructions. */
if (GET_CODE (x) == ASHIFTRT)
{
@@ -1025,7 +1027,8 @@ addsubcosts (x)
return 1;
/* Likewise for small constants. */
- if (CONST_OK_FOR_I (INTVAL (XEXP (x, 1))))
+ if (GET_CODE (XEXP (x, 1)) == CONST_INT
+ && CONST_OK_FOR_I (INTVAL (XEXP (x, 1))))
return 1;
/* Any other constant requires a 2 cycle pc-relative load plus an
--
Alexandre Oliva Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist *Please* write to mailing lists, not to me