[Bug tree-optimization/125399] Missed optimization of __builtin_bitreverse8() when comparing to 0

cvs-commit at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri May 22 09:20:01 GMT 2026


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

--- Comment #5 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:1bdc9e13987fc7451a4f11cfdf8b6dfb827cf9f5

commit r17-672-g1bdc9e13987fc7451a4f11cfdf8b6dfb827cf9f5
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Fri May 22 11:19:18 2026 +0200

    match.pd: Handle BUILT_IN_BITREVERSE8 like other BUILT_IN_BITREVERSE*
[PR125399]

    I've mistakenly omitted BUILT_IN_BITREVERSE8 in the BITREVERSE
    operator list.

    The following patch fixes that, plus extends the __builtin_bitreverse32
    test with one further check and duplicates the test for the other
    builtins, i.e. __builtin_bitreverse{8,16,64,128}.

    2026-05-22  Jakub Jelinek  <jakub@redhat.com>

            PR tree-optimization/125399
            * match.pd (BITREVERSE): Add BUILT_IN_BITREVERSE8.

            * gcc.dg/builtin-bitreverse-4.c (foo9): New function.
            * gcc.dg/builtin-bitreverse-5.c: New test.
            * gcc.dg/builtin-bitreverse-6.c: New test.
            * gcc.dg/builtin-bitreverse-7.c: New test.
            * gcc.dg/builtin-bitreverse-8.c: New test.

    Reviewed-by: Richard Biener <rguenth@suse.de>


More information about the Gcc-bugs mailing list