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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Both
        && ((~((HOST_WIDE_INT_1U << tree_to_uhwi (@1)) - 1)) & tree_to_uhwi
(@4)) == 0
and
        && (((((HOST_WIDE_INT_1U << tree_to_uhwi (@1)) - 1)) & tree_to_uhwi
(@2)) == 0)
in there of course only work if tree_to_uhwi (@1) < HOST_BITS_PER_WIDE_INT,
which is not the case for __int128 rotates or _BitInt(N) for N > 64.
So, either the optimization should be guarded on tree_to_uhwi (@1) <
HOST_BITS_PER_WIDE_INT, or better rewrite it with wide_int APIs,
(~((HOST_WIDE_INT_1U << tree_to_uhwi (@1)) - 1))
is wi::mask (tree_to_uhwi (@1), true, TYPE_PRECISION (type))
and
(((HOST_WIDE_INT_1U << tree_to_uhwi (@1)) - 1))
is wi::mask (tree_to_uhwi (@1), false, TYPE_PRECISION (type)),
the tree_fits_uhwi_p (@2) or (@4) should go and be masked with wi::to_wide on
that.

Reply via email to