On 5/13/23 21:12, Andrew Pinski via Gcc-patches wrote:
This adds a simple pattern to match.pd for `signbit(x) ? x : -x`
into abs<x>. This can be done for all types even ones that honor
signed zeros and NaNs because both signbit and - are considered
only looking at/touching the sign bit of those types and does
not trap either.

OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions.

        PR tree-optimization/109829

gcc/ChangeLog:

        * match.pd: Add pattern for `signbit(x) !=/== 0 ? x : -x`.

gcc/testsuite/ChangeLog:

        * gcc.dg/tree-ssa/abs-3.c: New test.
        * gcc.dg/tree-ssa/abs-4.c: New test.

OK.
jeff

Reply via email to