[Bug tree-optimization/126471] Wrong parity folding with non-even precision

cvs-commit at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sat Aug 1 10:16:44 GMT 2026


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

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

https://gcc.gnu.org/g:62ee81f37c57cced2ea25d216c4621a4ba7f5456

commit r15-11439-g62ee81f37c57cced2ea25d216c4621a4ba7f5456
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Thu Jul 30 09:52:45 2026 +0200

    match.pd: Fix .PARITY(~x) simplification [PR126471]

    The parity(~X) simpliciation to parity(X) is incorrect for types with
    odd element precision, in that case parity(~X) is equivalent to
    parity(X) ^ 1.
    The following patch fixes this.

    2026-07-30  Jakub Jelinek  <jakub@redhat.com>

            PR tree-optimization/126471
            * match.pd (parity(~X) is parity(X)): Only optimize this way
            if element_precision is even, otherwise optimize into parity(X) ^
1.

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

    Reviewed-by: Andrea Pinski <andrew.pinski@oss.qualcomm.com>
    (cherry picked from commit 1f4cc0f7a14b52fdfbd02ac890cc7aedbdfb1979)


More information about the Gcc-bugs mailing list