On 7/23/2026 1:11 AM, Eikansh Gupta wrote:
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]>
OK.  Please commit to the trunk.
Jeff

Reply via email to