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

"cvs-commit at gcc dot gnu.org via Gcc-bugs" <[email protected]>
Newsgroups gmane.comp.gcc.bugs
Message-ID <[email protected]/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126471

--- Comment #3 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:1f4cc0f7a14b52fdfbd02ac890cc7aedbdfb1979

commit r17-2811-g1f4cc0f7a14b52fdfbd02ac890cc7aedbdfb1979
Author: Jakub Jelinek <[email protected]>
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  <[email protected]>

            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 <[email protected]>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.