OSDN Git Service

* config/sh/sh.c (shiftcosts): Don't get INTVAL before testing
authoraoliva <aoliva@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 1 Dec 2000 03:29:02 +0000 (03:29 +0000)
committeraoliva <aoliva@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 1 Dec 2000 03:29:02 +0000 (03:29 +0000)
whether X is a CONST_INT.
(addsubcosts): Likewise.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@37911 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/config/sh/sh.c

index 5d064f8..3dc102c 100644 (file)
@@ -1,5 +1,9 @@
 2000-12-01  Alexandre Oliva  <aoliva@redhat.com>
 
+       * config/sh/sh.c (shiftcosts): Don't get INTVAL before testing
+       whether X is a CONST_INT.
+       (addsubcosts): Likewise.
+
        * config/sh/sh.h (OUTPUT_ADDR_CONST_EXTRA): Use INTVAL instead of
        mis-used XINT.
        (ARG_POINTER_REGNUM): Set to AP_REG.
index b17295f..80b1808 100644 (file)
@@ -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