[Bug middle-end/123635] _BitInt bitint_extended vs. abi_limb_prec > limb_prec or even just bitint_extended

cvs-commit at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Apr 20 07:12:43 GMT 2026


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

--- Comment #9 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:9ad67f1d996700bdba62092ec15e249387c844df

commit r16-8758-g9ad67f1d996700bdba62092ec15e249387c844df
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Mon Apr 20 09:11:24 2026 +0200

    bitintlower: Padding bit fixes, part 3 [PR123635]

    I've debugged the rest of the failures on riscv64-linux (in particular
    torture/bitint-{87,89}.c FAILs at -O2).
    This is on top of
https://gcc.gnu.org/pipermail/gcc-patches/2026-April/713242.html
    patch.
    One problem was that the lower_shift_stmt RSHIFT_EXPR change to iterate
    until p2 rather than p (where p2 is p + 1 if bitint_ext_full and there is
    full limb of padding bits), the loop is emitted with a condition before the
    header and another condition before the latch edge and I've mistakenly
fixed
    just the latter and not the former.
    ANother problem was that in all the 3 RSHIFT_EXPRs added meant to set
    a full limb to 0 or all ones based on most significant bit I've mistakenly
used
    unsigned type rather than signed, so it was set to 0 or 1 instead (this
    was twice in lower_shift_stmt, for the LSHIFT_EXPR case in both cases and
    once in lower_float_conv_stmt).
    And finally, because unsigned MULT_EXPR doesn't have overflow undefined, we
    actually don't need to just clear the full padding bit limb (if any) but
    even the padding bits in the partial limb (if any; and this actually
doesn't
    affect just arm and riscv, but also affects s390x and loongarch).

    2026-04-20  Jakub Jelinek  <jakub@redhat.com>

            PR middle-end/123635
            * gimple-lower-bitint.cc (bitint_large_huge::lower_shift_stmt): In
the
            RSHIFT_EXPR case, use p2 in two LE_EXPR conditions rather than just
            one.  In LSHIFT_EXPR case, use signed RSHIFT_EXPR instead of
unsigned.
            (bitint_large_huge::lower_muldiv_stmt): For unsigned MULT_EXPR with
            bitint_extended if prec is not multiple of limb_prec, clear padding
            bits after libgcc call.
            (bitint_large_huge::lower_float_conv_stmt): Use signed RSHIFT_EXPR
            instead of unsigned.

    Reviewed-by: Jeffrey Law <jeffrey.law@oss.qualcomm.com>


More information about the Gcc-bugs mailing list