From e8d76a395e5f1d93a17f4a353b8c80e620cb1597 Mon Sep 17 00:00:00 2001 From: Richard Stallman Date: Sat, 19 Sep 1992 04:48:37 +0000 Subject: [PATCH] (fold_rtx): For SUBREG, actually test subreg_lowpart_p in the code to handle narrowing subregs. (fold_rtx): For SUBREG, actually test subreg_lowpart_p in the code to handle narrowing subregs. And exclude binary ops like DIV where truncating the args is not valid. From-SVN: r2160 --- gcc/cse.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/gcc/cse.c b/gcc/cse.c index e76a1300d81..85ecc774842 100644 --- a/gcc/cse.c +++ b/gcc/cse.c @@ -4457,7 +4457,8 @@ fold_rtx (x, insn) can use the inner value. */ if (GET_CODE (folded_arg0) == REG - && GET_MODE_SIZE (mode) < GET_MODE_SIZE (GET_MODE (folded_arg0))) + && GET_MODE_SIZE (mode) < GET_MODE_SIZE (GET_MODE (folded_arg0)) + && subreg_lowpart_p (x)) { struct table_elt *elt; @@ -4472,6 +4473,8 @@ fold_rtx (x, insn) for (; elt; elt = elt->next_same_value) { + enum rtx_code eltcode = GET_CODE (elt->exp); + /* Just check for unary and binary operations. */ if (GET_RTX_CLASS (GET_CODE (elt->exp)) == '1' && GET_CODE (elt->exp) != SIGN_EXTEND @@ -4491,6 +4494,10 @@ fold_rtx (x, insn) } else if ((GET_RTX_CLASS (GET_CODE (elt->exp)) == '2' || GET_RTX_CLASS (GET_CODE (elt->exp)) == 'c') + && eltcode != DIV && eltcode != MOD + && eltcode != UDIV && eltcode != UMOD + && eltcode != ASHIFTRT && eltcode != LSHIFTRT + && eltcode != ROTATE && eltcode != ROTATERT && ((GET_CODE (XEXP (elt->exp, 0)) == SUBREG && (GET_MODE (SUBREG_REG (XEXP (elt->exp, 0))) == mode)) -- 2.30.2