From d3b726902460a92cefbb1be7472d2cafece201ed Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Tue, 28 Feb 2006 20:32:20 +0000 Subject: rtl.h (truncated_to_mode): Declare it. * rtl.h (truncated_to_mode): Declare it. (struct rtl_hooks): Add reg_truncated_to_mode hook. * rtlhooks-def.h (RTL_HOOKS_REG_TRUNCATED_TO_MODE): New macro. (RTL_HOOKS_INITIALIZER): Include it. * rtlhooks.c (reg_truncated_to_mode_general): New function. * combine.c (RTL_HOOKS_REG_TRUNCATED_TO_MODE): Override to reg_truncated_to_mode. * rtlanal.c (truncated_to_mode): Define it. * simplify-rtx.c (simplify_unary_operation_1): Use it. Co-Authored-By: Adam Nemet From-SVN: r111573 --- gcc/simplify-rtx.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'gcc/simplify-rtx.c') diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c index e84beda..aded68e 100644 --- a/gcc/simplify-rtx.c +++ b/gcc/simplify-rtx.c @@ -631,14 +631,17 @@ simplify_unary_operation_1 (enum rtx_code code, enum machine_mode mode, rtx op) GET_MODE (XEXP (SUBREG_REG (op), 0))); /* If we know that the value is already truncated, we can - replace the TRUNCATE with a SUBREG if TRULY_NOOP_TRUNCATION - is nonzero for the corresponding modes. But don't do this - for an (LSHIFTRT (MULT ...)) since this will cause problems - with the umulXi3_highpart patterns. */ - if (TRULY_NOOP_TRUNCATION (GET_MODE_BITSIZE (mode), + replace the TRUNCATE with a SUBREG. Note that this is also + valid if TRULY_NOOP_TRUNCATION is false for the corresponding + modes we just have to apply a different definition for + truncation. But don't do this for an (LSHIFTRT (MULT ...)) + since this will cause problems with the umulXi3_highpart + patterns. */ + if ((TRULY_NOOP_TRUNCATION (GET_MODE_BITSIZE (mode), GET_MODE_BITSIZE (GET_MODE (op))) - && num_sign_bit_copies (op, GET_MODE (op)) - >= (unsigned int) (GET_MODE_BITSIZE (mode) + 1) + ? (num_sign_bit_copies (op, GET_MODE (op)) + >= (unsigned int) (GET_MODE_BITSIZE (mode) + 1)) + : truncated_to_mode (mode, op)) && ! (GET_CODE (op) == LSHIFTRT && GET_CODE (XEXP (op, 0)) == MULT)) return rtl_hooks.gen_lowpart_no_emit (mode, op); -- cgit v1.1