aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Kenner <kenner@gcc.gnu.org>1993-09-17 18:10:33 -0400
committerRichard Kenner <kenner@gcc.gnu.org>1993-09-17 18:10:33 -0400
commit31c85c78b1a99acc017177f21ac497ec243a8028 (patch)
tree9bdc7d502577b727def0ab39f3ffa85025869075
parentc1719013cf972ac1af92e6e23c1d3017d047a43a (diff)
downloadgcc-31c85c78b1a99acc017177f21ac497ec243a8028.zip
gcc-31c85c78b1a99acc017177f21ac497ec243a8028.tar.gz
gcc-31c85c78b1a99acc017177f21ac497ec243a8028.tar.bz2
(fold_rtx, case SUBREG): If paradoxical SUBREG of a constant, return
the constant. From-SVN: r5346
-rw-r--r--gcc/cse.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/gcc/cse.c b/gcc/cse.c
index 540c777..dd98146 100644
--- a/gcc/cse.c
+++ b/gcc/cse.c
@@ -4582,7 +4582,9 @@ fold_rtx (x, insn)
extra bits would have. However, if the operand is equivalent
to a SUBREG whose operand is the same as our mode, and all the
modes are within a word, we can just use the inner operand
- because these SUBREGs just say how to treat the register. */
+ because these SUBREGs just say how to treat the register.
+
+ Similarly if we find an integer constant. */
if (GET_MODE_SIZE (mode) > GET_MODE_SIZE (GET_MODE (SUBREG_REG (x))))
{
@@ -4593,9 +4595,13 @@ fold_rtx (x, insn)
&& GET_MODE_SIZE (imode) <= UNITS_PER_WORD
&& (elt = lookup (SUBREG_REG (x), HASH (SUBREG_REG (x), imode),
imode)) != 0)
- {
- for (elt = elt->first_same_value;
- elt; elt = elt->next_same_value)
+ for (elt = elt->first_same_value;
+ elt; elt = elt->next_same_value)
+ {
+ if (CONSTANT_P (elt->exp)
+ && GET_MODE (elt->exp) == VOIDmode)
+ return elt->exp;
+
if (GET_CODE (elt->exp) == SUBREG
&& GET_MODE (SUBREG_REG (elt->exp)) == mode
&& exp_equiv_p (elt->exp, elt->exp, 1, 0))