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

--- Comment #23 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <[email protected]>:

https://gcc.gnu.org/g:54f8428e0342935d5f9c3282fbae1db63cf90ac1

commit r17-550-g54f8428e0342935d5f9c3282fbae1db63cf90ac1
Author: Jakub Jelinek <[email protected]>
Date:   Sat May 16 10:50:57 2026 +0200

    Add __builtin_bitreverse128 [PR50481]

    We already have __builtin_bswap{16,32,64,128}, the last one has been
    added ~6 years ago.  So, I think we should have also
    __builtin_bitreverse128.

    The following patch does that.

    Note, we don't have __builtin_bswapg and I don't think we should, one can
    only byteswap something which has number of bits divisible by CHAR_BIT.
    For __builtin_bitreverseg that isn't a problem, but am not sure I want to
    spend time handling it on say unsigned _BitInt(357).  Perhaps only if there
    is some real-world use-case.

    2026-05-16  Jakub Jelinek  <[email protected]>

            PR target/50481
            * doc/extend.texi (__builtin_bitreverse32, __builtin_bitreverse64):
            Tweak wording for consistency with __builtin_bswap*.
            (__builtin_bitreverse128): Document.
            * builtins.def (BUILT_IN_BITREVERSE128): New.
            * builtins.cc (expand_builtin): Handle also BUILT_IN_BITREVERSE128.
            (is_inexpensive_builtin): Likewise.
            * fold-const-call.cc (fold_const_call_ss): Handle also
            CFN_BUILT_IN_BITREVERSE128.
            * fold-const.cc (tree_call_nonnegative_warnv_p): Likewise.
            * tree-ssa-ccp.cc (evaluate_stmt): Handle also
BUILT_IN_BITREVERSE128.
            * tree-ssa-phiopt.cc (empty_bb_or_one_feeding_into_p): Handle also
            CFN_BUILT_IN_BITREVERSE128.
            (cond_removal_in_builtin_zero_pattern): Likewise.

            * gcc.dg/builtin-bitreverse-1.c: Add __builtin_bitreverse128 tests.
            * gcc.dg/builtin-bitreverse-2.c: Likewise.

    Reviewed-by: Andrew Pinski <[email protected]>

Reply via email to