This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Missing TRULY_NOOP_TRUNCATION + remove comparison modes on MIPS
Eric Christopher writes:
> Might be nice to see this in a comment above the check.
Thanks for the quick review. Would something like this work?
Index: combine.c
===================================================================
--- combine.c (revision 109679)
+++ combine.c (working copy)
@@ -10357,7 +10357,15 @@ simplify_comparison (enum rtx_code code,
& GET_MODE_MASK (mode))
+ 1)) >= 0
&& const_op >> i == 0
- && (tmode = mode_for_size (i, MODE_INT, 1)) != BLKmode)
+ && (tmode = mode_for_size (i, MODE_INT, 1)) != BLKmode
+ /* We can only do this if truncation to this mode either
+ does not require an explicit operation or the
+ register is known to hold a value already valid in
+ that mode. */
+ && (TRULY_NOOP_TRUNCATION (GET_MODE_BITSIZE (tmode),
+ GET_MODE_BITSIZE (GET_MODE (op0)))
+ || (REG_P (XEXP (op0, 0))
+ && reg_truncated_to_mode (tmode, XEXP (op0, 0)))))
{
op0 = gen_lowpart (tmode, XEXP (op0, 0));
continue;