aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorAlexandre Oliva <aoliva@redhat.com>2000-12-01 03:29:02 +0000
committerAlexandre Oliva <aoliva@gcc.gnu.org>2000-12-01 03:29:02 +0000
commit3d422cb195ff12f1775103d5308495d459d860ec (patch)
tree1b58068f19d3b2610de8c6488b8ad77801f819f3 /gcc
parentb927e8c7203c92b0580665b6ee75cff290c64d0d (diff)
downloadgcc-3d422cb195ff12f1775103d5308495d459d860ec.zip
gcc-3d422cb195ff12f1775103d5308495d459d860ec.tar.gz
gcc-3d422cb195ff12f1775103d5308495d459d860ec.tar.bz2
sh.c (shiftcosts): Don't get INTVAL before testing whether X is a CONST_INT.
* config/sh/sh.c (shiftcosts): Don't get INTVAL before testing whether X is a CONST_INT. (addsubcosts): Likewise. From-SVN: r37911
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog4
-rw-r--r--gcc/config/sh/sh.c7
2 files changed, 9 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 5d064f8..3dc102c 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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.
diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c
index b17295f..80b1808 100644
--- a/gcc/config/sh/sh.c
+++ b/gcc/config/sh/sh.c
@@ -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