On Thu, Jul 21, 2022 at 05:28:34PM -0400, Sam Feifer via Gcc-patches wrote: > This patch is intended to fix a missed optimization in match.pd. It optimizes > (x >= 0 ? x : 0) + (x <= 0 ? -x : 0) to just abs(x). Additionally, the > pattern (x <= 0 ? -x : 0) now gets optimized to max(-x, 0), which helps with > the other simplification rule. > > Tests are also included to be added to the testsuite. To clarify, this patch has been approved by Richi in an earlier thread, so...
> Bootstrapped/regtested on x86_64-pc-linux-gnu, ok for trunk? ...this line isn't really asking for a review. > PR tree-optimization/94920 > > gcc/ChangeLog: > > * match.pd (x >= 0 ? x : 0) + (x <= 0 ? -x : 0): New simplification. > (x <= 0 ? -x : 0): New simplification. The second line ought to be formatted 8 spaces to the left, so that it's aligned with '* match.pd'. Marek