PATCH: PR rtl-optimization/50696: [x32] Unnecessary lea

H.J. Lu hjl.tools@gmail.com
Thu Oct 13 21:51:00 GMT 2011


On Thu, Oct 13, 2011 at 2:23 PM, Richard Kenner
<kenner@vlsi1.ultra.nyu.edu> wrote:
>> Does it look OK?
>
> No.
>
> If I understand your code correctly, there's essentially the same code
> as you have a bit above that:
>
>      /* If the constant is one less than a power of two, this might be
>         representable by an extraction even if no shift is present.
>         If it doesn't end up being a ZERO_EXTEND, we will ignore it unless
>         we are in a COMPARE.  */
>      else if ((i = exact_log2 (INTVAL (XEXP (x, 1)) + 1)) >= 0)
>        new_rtx = make_extraction (mode,
>                               make_compound_operation (XEXP (x, 0),
>                                                        next_code),
>                               0, NULL_RTX, i, 1, 0, in_code == COMPARE);
>
> So you need to understand why your code "fires" and it doesn't.
>
>

It is because mask 0xffffffff is optimized to 0xfffffffc by keeping track
of non-zero bits in registers and the above code doesn't take that
into account.

-- 
H.J.



More information about the Gcc-patches mailing list