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

--- Comment #15 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Andrew Pinski <pins...@gcc.gnu.org>:

https://gcc.gnu.org/g:75a4143d69a842d691c14a477b0ba277d8708fc7

commit r15-3550-g75a4143d69a842d691c14a477b0ba277d8708fc7
Author: Andrew Pinski <quic_apin...@quicinc.com>
Date:   Thu Aug 29 12:10:44 2024 -0700

    middle-end: also optimized `popcount(a) <= 1` [PR90693]

    This expands on optimizing `popcount(a) == 1` to also handle
    `popcount(a) <= 1`. `<= 1` can be expanded as `(a & -a) == 0`
    like what is done for `== 1` if we know that a was nonzero.
    We have to do the optimization in 2 places due to if we have
    an optab entry for popcount or not.

    Built and tested for aarch64-linux-gnu.

            PR middle-end/90693

    gcc/ChangeLog:

            * internal-fn.cc (expand_POPCOUNT): Handle the second argument
            being `-1` for `<= 1`.
            * tree-ssa-math-opts.cc (match_single_bit_test): Handle LE/GT
            cases.
            (math_opts_dom_walker::after_dom_children): Call
match_single_bit_test
            for LE_EXPR/GT_EXPR also.

    gcc/testsuite/ChangeLog:

            * gcc.target/aarch64/popcnt-le-1.c: New test.
            * gcc.target/aarch64/popcnt-le-2.c: New test.
            * gcc.target/aarch64/popcnt-le-3.c: New test.

    Signed-off-by: Andrew Pinski <quic_apin...@quicinc.com>
  • [Bug tree-optimization/90693] M... cvs-commit at gcc dot gnu.org via Gcc-bugs

Reply via email to