aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@issan.cs.uni-dortmund.de>1999-05-08 01:34:55 +0000
committerRichard Henderson <rth@gcc.gnu.org>1999-05-07 18:34:55 -0700
commitccc4ae070d86aebd022b7609c8477bd46a7695c7 (patch)
tree68b9ea358e14d47ebe5bf789990ddda92faa07d0
parente9996db7413238dcd6a71b110d0e7ed30d6d4207 (diff)
downloadgcc-ccc4ae070d86aebd022b7609c8477bd46a7695c7.zip
gcc-ccc4ae070d86aebd022b7609c8477bd46a7695c7.tar.gz
gcc-ccc4ae070d86aebd022b7609c8477bd46a7695c7.tar.bz2
reload1.c (gen_mode_int): New function.
* reload1.c (gen_mode_int): New function. (reload_cse_move2add): Use it to generate the new constants. From-SVN: r26834
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/reload1.c29
2 files changed, 30 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 3081ed5..1f5eda9 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+Sat May 8 01:34:19 1999 Andreas Schwab <schwab@issan.cs.uni-dortmund.de>
+
+ * reload1.c (gen_mode_int): New function.
+ (reload_cse_move2add): Use it to generate the new constants.
+
Sat May 8 01:25:09 1999 Andreas Schwab <schwab@issan.cs.uni-dortmund.de>
* varasm.c (output_constant): Do nothing if -fsyntax-only.
diff --git a/gcc/reload1.c b/gcc/reload1.c
index c566d38..f16ed10 100644
--- a/gcc/reload1.c
+++ b/gcc/reload1.c
@@ -9962,6 +9962,24 @@ static enum machine_mode reg_mode[FIRST_PSEUDO_REGISTER];
reload_cse_move2add and move2add_note_store. */
static int move2add_luid;
+/* Generate a CONST_INT and force it in the range of MODE. */
+static rtx
+gen_mode_int (mode, value)
+ enum machine_mode mode;
+ HOST_WIDE_INT value;
+{
+ HOST_WIDE_INT cval = value & GET_MODE_MASK (mode);
+ int width = GET_MODE_BITSIZE (mode);
+
+ /* If MODE is narrower than HOST_WIDE_INT and CVAL is a negative number,
+ sign extend it. */
+ if (width > 0 && width < HOST_BITS_PER_WIDE_INT
+ && (cval & ((HOST_WIDE_INT) 1 << (width - 1))) != 0)
+ cval |= (HOST_WIDE_INT) -1 << width;
+
+ return GEN_INT (cval);
+}
+
static void
reload_cse_move2add (first)
rtx first;
@@ -10013,8 +10031,9 @@ reload_cse_move2add (first)
if (GET_CODE (src) == CONST_INT && reg_base_reg[regno] < 0)
{
int success = 0;
- rtx new_src = GEN_INT (INTVAL (src)
- - INTVAL (reg_offset[regno]));
+ rtx new_src
+ = gen_mode_int (GET_MODE (reg),
+ INTVAL (src) - INTVAL (reg_offset[regno]));
/* (set (reg) (plus (reg) (const_int 0))) is not canonical;
use (set (reg) (reg)) instead.
We don't delete this insn, nor do we convert it into a
@@ -10059,8 +10078,10 @@ reload_cse_move2add (first)
&& GET_CODE (XEXP (SET_SRC (set), 1)) == CONST_INT)
{
rtx src3 = XEXP (SET_SRC (set), 1);
- rtx new_src = GEN_INT (INTVAL (src3)
- - INTVAL (reg_offset[regno]));
+ rtx new_src
+ = gen_mode_int (GET_MODE (reg),
+ INTVAL (src3)
+ - INTVAL (reg_offset[regno]));
int success = 0;
if (new_src == const0_rtx)