aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2001-05-17 18:46:58 +0000
committerJan Hubicka <jh@suse.cz>2001-05-17 18:46:58 +0000
commit565d4262e73e8dc9582272f747a2813b432d5eaf (patch)
tree56b80c09408fe368396536eefa4327bd32d5c2f5
parentfcaad29e17f454ad7b1c385fbbecd92fdcdaf25a (diff)
* cse.c (fold_rtx): Use simplify_subreg.
* simplify-rtx.c (simplify_replace_rtx): Use simplify_gen_subreg. (simplify_gen_subreg): New. (simplify_rtx): Use simplify_subreg. * rtl.h (simplify_gen_subreg): Declare. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@42221 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog9
-rw-r--r--gcc/cse.c12
-rw-r--r--gcc/rtl.h4
-rw-r--r--gcc/simplify-rtx.c57
4 files changed, 65 insertions, 17 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 50551d9ea0f..b5be8d85fb1 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,12 @@
+Thu May 17 20:43:36 CEST 2001 Jan Hubicka <jh@suse.cz>
+
+ * cse.c (fold_rtx): Use simplify_subreg.
+
+ * simplify-rtx.c (simplify_replace_rtx): Use simplify_gen_subreg.
+ (simplify_gen_subreg): New.
+ (simplify_rtx): Use simplify_subreg.
+ * rtl.h (simplify_gen_subreg): Declare.
+
2001-05-17 Mark Mitchell <mark@codesourcery.com>
* doc/install.texi: Update Solaris information.
diff --git a/gcc/cse.c b/gcc/cse.c
index f3978e4b257..43cbf9ca020 100644
--- a/gcc/cse.c
+++ b/gcc/cse.c
@@ -3408,16 +3408,8 @@ fold_rtx (x, insn)
if (folded_arg0 != SUBREG_REG (x))
{
- new = 0;
-
- if (GET_MODE_CLASS (mode) == MODE_INT
- && GET_MODE_SIZE (mode) == UNITS_PER_WORD
- && GET_MODE (SUBREG_REG (x)) != VOIDmode)
- new = operand_subword (folded_arg0,
- (SUBREG_BYTE (x) / UNITS_PER_WORD), 0,
- GET_MODE (SUBREG_REG (x)));
- if (new == 0 && subreg_lowpart_p (x))
- new = gen_lowpart_if_possible (mode, folded_arg0);
+ new = simplify_subreg (mode, folded_arg0,
+ GET_MODE (SUBREG_REG (x)), SUBREG_BYTE (x));
if (new)
return new;
}
diff --git a/gcc/rtl.h b/gcc/rtl.h
index 6aa86136b6f..7ba5440ef74 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -1331,6 +1331,10 @@ extern rtx simplify_subreg PARAMS ((enum machine_mode,
rtx,
enum machine_mode,
unsigned int));
+extern rtx simplify_gen_subreg PARAMS ((enum machine_mode,
+ rtx,
+ enum machine_mode,
+ unsigned int));
extern rtx simplify_replace_rtx PARAMS ((rtx, rtx, rtx));
extern rtx simplify_rtx PARAMS ((rtx));
diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c
index fd1b6303768..a64b33e1836 100644
--- a/gcc/simplify-rtx.c
+++ b/gcc/simplify-rtx.c
@@ -259,13 +259,18 @@ simplify_replace_rtx (x, old, new)
simplify_replace_rtx (XEXP (x, 2), old, new));
case 'x':
- /* The only case we try to handle is a lowpart SUBREG of a single-word
- CONST_INT. */
- if (code == SUBREG && subreg_lowpart_p (x) && old == SUBREG_REG (x)
- && GET_CODE (new) == CONST_INT
- && GET_MODE_SIZE (GET_MODE (old)) <= UNITS_PER_WORD)
- return GEN_INT (INTVAL (new) & GET_MODE_MASK (mode));
-
+ /* The only case we try to handle is a SUBREG. */
+ if (code == SUBREG)
+ {
+ rtx exp;
+ exp = simplify_gen_subreg (GET_MODE (x),
+ simplify_replace_rtx (SUBREG_REG (x),
+ old, new),
+ GET_MODE (SUBREG_REG (x)),
+ SUBREG_BYTE (x));
+ if (exp)
+ x = exp;
+ }
return x;
default:
@@ -2385,6 +2390,37 @@ simplify_subreg (outermode, op, innermode, byte)
}
return NULL_RTX;
}
+/* Make a SUBREG operation or equivalent if it folds. */
+
+rtx
+simplify_gen_subreg (outermode, op, innermode, byte)
+ rtx op;
+ unsigned int byte;
+ enum machine_mode outermode, innermode;
+{
+ rtx new;
+ /* Little bit of sanity checking. */
+ if (innermode == VOIDmode || outermode == VOIDmode
+ || innermode == BLKmode || outermode == BLKmode)
+ abort ();
+
+ if (GET_MODE (op) != innermode
+ && GET_MODE (op) != VOIDmode)
+ abort ();
+
+ if (byte % GET_MODE_SIZE (outermode)
+ || byte >= GET_MODE_SIZE (innermode))
+ abort ();
+
+ new = simplify_subreg (outermode, op, innermode, byte);
+ if (new)
+ return new;
+
+ if (GET_CODE (op) == SUBREG || GET_MODE (op) == VOIDmode)
+ return NULL_RTX;
+
+ return gen_rtx_SUBREG (outermode, op, byte);
+}
/* Simplify X, an rtx expression.
Return the simplified expression or NULL if no simplifications
@@ -2454,6 +2490,13 @@ simplify_rtx (x)
? GET_MODE (XEXP (x, 0))
: GET_MODE (XEXP (x, 1))),
XEXP (x, 0), XEXP (x, 1));
+ case 'x':
+ /* The only case we try to handle is a SUBREG. */
+ if (code == SUBREG)
+ return simplify_gen_subreg (mode, SUBREG_REG (x),
+ GET_MODE (SUBREG_REG (x)),
+ SUBREG_BYTE (x));
+ return NULL;
default:
return NULL;
}