+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.
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;
}
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:
}
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
? 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;
}