This patch teaches match.pd to recognize the branchless conditional negate idiom
(x ^ -cmp) + cmp when cmp is known to be zero or one. The expression is folded to a conditional negate form. For the sign-test spelling based on x < 0, the patch exposes ABS_EXPR. I could not comment on the PR because my GCC Bugzilla account is still pending, so I am sending the patch here. Bootstrapped on x86_64-pc-linux-gnu. Tested with gcc.dg/tree-ssa/tree-ssa.exp and the new gcc.dg/tree-ssa/pr113894.c testcase. I do not have commit access. [https://res.public.onecdn.static.microsoft/assets/fluentui-resources/1.1.0/app-min/assets/item-types/24_1.5x/code.png]pr113894.patch<https://1drv.ms/u/c/5a41b3fa58bb8071/IQAXsKqhUTaaQb_gOXEu4L8RAXgQUmxYo5d_eBzRtnqcKSI>
