> Here is the new patch discussed in the other thread.
>
> Thanks
> Yvan
>
> 2013-09-11 Yvan Roux <[email protected]>
> Vladimir Makarov <[email protected]>
>
> * rtlanal.c (lsb_bitfield_op_p): New predicate for bitfield operations
> from the least significant bit.
> (strip_address_mutations): Add bitfield operations handling.
> (shift_code_p): New predicate for shifting operations.
> (must_be_index_p): Add shifting operations handling.
> (set_address_index): Likewise.
+/* Return true if X is a sign_extract or zero_extract from the least
+ significant bit. */
+
+static bool
+lsb_bitfield_op_p (rtx x)
+{
+ if (GET_RTX_CLASS (GET_CODE (x)) == RTX_BITFIELD_OPS)
+ {
+ enum machine_mode mode = GET_MODE(x);
+ unsigned HOST_WIDE_INT len = INTVAL (XEXP (x, 1));
+ HOST_WIDE_INT pos = INTVAL (XEXP (x, 2));
+
+ return (pos == (BITS_BIG_ENDIAN ? GET_MODE_PRECISION (mode) - len :
0));
It seems strange to use the destination mode to decide whether this is the LSB
of the source.
+/* Return true if X is a shifting operation. */
+
+static bool
+shift_code_p (rtx x)
+{
+ return (GET_CODE (x) == ASHIFT
+ || GET_CODE (x) == ASHIFTRT
+ || GET_CODE (x) == LSHIFTRT
+ || GET_CODE (x) == ROTATE
+ || GET_CODE (x) == ROTATERT);
+}
ROTATE and ROTATERT aren't really shifting operations though, so are they
really needed here?
--
Eric Botcazou