From 9dd791c86c770caf0b6a12a0dfae7cf0e0469f89 Mon Sep 17 00:00:00 2001 From: Alexandre Oliva Date: Thu, 21 Feb 2002 19:21:35 +0000 Subject: rtlanal.c (replace_rtx): Don't make a CONST_INT the operand of SUBREG or ZERO_EXTEND. * rtlanal.c (replace_rtx): Don't make a CONST_INT the operand of SUBREG or ZERO_EXTEND. From-SVN: r49935 --- gcc/rtlanal.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'gcc/rtlanal.c') diff --git a/gcc/rtlanal.c b/gcc/rtlanal.c index 37f1e64..5f338e8 100644 --- a/gcc/rtlanal.c +++ b/gcc/rtlanal.c @@ -2417,6 +2417,40 @@ replace_rtx (x, from, to) if (x == 0) return 0; + if (GET_CODE (x) == SUBREG) + { + rtx new = replace_rtx (SUBREG_REG (x), from, to); + + if (GET_CODE (new) == CONST_INT) + { + x = simplify_subreg (GET_MODE (x), new, + GET_MODE (SUBREG_REG (x)), + SUBREG_BYTE (x)); + if (! x) + abort (); + } + else + SUBREG_REG (x) = new; + + return x; + } + else if (GET_CODE (x) == ZERO_EXTEND) + { + rtx new = replace_rtx (XEXP (x, 0), from, to); + + if (GET_CODE (new) == CONST_INT) + { + x = simplify_unary_operation (ZERO_EXTEND, GET_MODE (x), + new, GET_MODE (XEXP (x, 0))); + if (! x) + abort (); + } + else + XEXP (x, 0) = new; + + return x; + } + fmt = GET_RTX_FORMAT (GET_CODE (x)); for (i = GET_RTX_LENGTH (GET_CODE (x)) - 1; i >= 0; i--) { -- cgit v1.1