https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109829
--- Comment #10 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The trunk branch has been updated by Andrew Pinski <pins...@gcc.gnu.org>: https://gcc.gnu.org/g:82502b5c3463bde98d4b7ffb9ecef9b123799ed1 commit r14-813-g82502b5c3463bde98d4b7ffb9ecef9b123799ed1 Author: Andrew Pinski <apin...@marvell.com> Date: Sat May 13 22:25:21 2023 +0000 MATCH: Add pattern for `signbit(x) ? x : -x` into abs (and swapped) 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.