aboutsummaryrefslogtreecommitdiff
path: root/gcc/simplify-rtx.c
diff options
context:
space:
mode:
authorPaolo Bonzini <bonzini@gnu.org>2006-02-28 20:32:20 +0000
committerAdam Nemet <nemet@gcc.gnu.org>2006-02-28 20:32:20 +0000
commitd3b726902460a92cefbb1be7472d2cafece201ed (patch)
treeb59a2ff0c0c65abbe656b96ae1d8a37028083f6b /gcc/simplify-rtx.c
parente5c7f9f582b4148974efae8c9289652601909753 (diff)
downloadgcc-d3b726902460a92cefbb1be7472d2cafece201ed.zip
gcc-d3b726902460a92cefbb1be7472d2cafece201ed.tar.gz
gcc-d3b726902460a92cefbb1be7472d2cafece201ed.tar.bz2
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 <anemet@caviumnetworks.com> From-SVN: r111573
Diffstat (limited to 'gcc/simplify-rtx.c')
-rw-r--r--gcc/simplify-rtx.c17
1 files changed, 10 insertions, 7 deletions
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);