https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71636

Marc Glisse <glisse at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |missed-optimization

--- Comment #2 from Marc Glisse <glisse at gcc dot gnu.org> ---
For -march=core2, we get for g

        movl    $-1, %edx
        movl    %esi, %ecx
        movl    %edx, %eax
        sall    %cl, %eax
        notl    %eax
        andl    %edi, %eax

The use of %edx seems strange, llvm puts -1 directly in %eax. RA issue?

For the original issue, I guess doing the transformation very early with
something like the following might do

(simplify
 (minus (lshift:s integer_each_onep@1 @0) @1)
 (bit_not (lshift { build_all_ones_cst (type); } @0)))

(maybe with some extra code to handle conversions in the middle)

Or we could restrict the transformation to the case with bit_and, but I have
the vague impression that it would complicate things, especially if (1U<<b)-1
is used several times (although that case is probably less interesting, since
there is less to gain). I don't know if delaying the transformation to RTL
would be better / worse.

Reply via email to