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

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

https://gcc.gnu.org/g:25d51fb7d098a9ac8880ccb2121d889815680177

commit r15-3364-g25d51fb7d098a9ac8880ccb2121d889815680177
Author: Jakub Jelinek <ja...@redhat.com>
Date:   Mon Sep 2 09:44:09 2024 +0200

    ranger: Fix up range computation for CLZ [PR116486]

    The initial CLZ gimple-range-op.cc implementation handled just the
    case where second argument to .CLZ is equal to prec, but in
    r15-1014 I've added also handling of the -1 case.  As the following
    testcase shows, incorrectly though for the case where the first argument
    has [0,0] range.  If the second argument is prec, then the result should
    be [prec,prec] and that was handled correctly, but when the second argument
    is -1, the result should be [-1,-1] but instead it was incorrectly computed
    as [prec-1,prec-1] (when second argument is prec, mini is 0 and maxi is
    prec, while when second argument is -1, mini is -1 and maxi is prec-1).

    Fixed thusly (the actual handling is then similar to the CTZ [0,0] case).

    2024-09-02  Jakub Jelinek  <ja...@redhat.com>

            PR middle-end/116486
            * gimple-range-op.cc (cfn_clz::fold_range): If lh is [0,0]
            and mini is -1, return [-1,-1] range rather than [prec-1,prec-1].

            * gcc.dg/bitint-109.c: New test.

Reply via email to