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

--- Comment #6 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:215c7e3084ea9ec75dcc803f73c94b36e2751e54

commit r15-3306-g215c7e3084ea9ec75dcc803f73c94b36e2751e54
Author: Andrew Pinski <quic_apin...@quicinc.com>
Date:   Wed Aug 28 15:03:53 2024 -0700

    expand: Allow widdening optab when expanding popcount==1 [PR116508]

    After adding popcount{qi,hi}2 to the aarch64 backend, I noticed that
    the expansion for popcount==1 was no longer trying to do the trick
    of handling popcount==1 as `(arg ^ (arg - 1)) > arg - 1`. The problem
    is the expansion was using OPTAB_DIRECT, when using OPTAB_WIDEN
    will allow modes which are smaller than SImode (in the aarch64 case).

    Note QImode's cost still needs some improvements so part of popcnt-eq-1.c
    is xfailed. Though there is a check to make sure the costs are compared
now.

    Built and tested on aarch64-linux-gnu.

            PR middle-end/116508

    gcc/ChangeLog:

            * internal-fn.cc (expand_POPCOUNT): Use OPTAB_WIDEN for PLUS and
            XOR/AND expansion.

    gcc/testsuite/ChangeLog:

            * gcc.target/aarch64/popcnt-eq-1.c: New test.

    Signed-off-by: Andrew Pinski <quic_apin...@quicinc.com>

Reply via email to