[Bug target/82259] missed optimization: use LEA to add 1 to flip the low bit when copying before AND with 1

peter at cordes dot ca gcc-bugzilla@gcc.gnu.org
Tue Sep 19 16:50:00 GMT 2017


--- Comment #3 from Peter Cordes <peter at cordes dot ca> ---
Oops, BT sets CF, not ZF.  So

        bt      $13, %edi
        setnc   %al            # aka setae

This is what clang does for the bt_ functions, and might be optimal for many
use-cases.  (For branching with an immediate, test/jcc is of course better
because it can macro-fuse into a test+branch uop on Intel and AMD.)

More information about the Gcc-bugs mailing list