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

--- Comment #3 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Eikansh Gupta <[email protected]>:

https://gcc.gnu.org/g:1c8ca0108746d3a7452134f9d1c2e5d89857fed7

commit r17-2823-g1c8ca0108746d3a7452134f9d1c2e5d89857fed7
Author: Eikansh Gupta <[email protected]>
Date:   Wed Jun 17 09:58:16 2026 +0530

    MATCH: fold signbit comparison and conditional negate to copysign
[PR109843]

    Fold (signbit (x) cmp1 0) cmp (signbit (y) cmp2 0) ? y : -y
    to copysign (y, +-x).  The result keeps the magnitude of Y and takes its
    sign from X (or -X).  Emitted as IFN_COPYSIGN when the target supports it.

            PR tree-optimization/109843

    gcc/ChangeLog:

            * match.pd ((signbit (x) cmp 0) cmp (signbit (y) cmp 0) ? y : -y):
            New simplification to copysign (y, +-x).

    gcc/testsuite/ChangeLog:

            * gcc.dg/tree-ssa/pr109843.c: New test.

    Signed-off-by: Eikansh Gupta <[email protected]>

Reply via email to