On Sun, Jul 14, 2024 at 1:12 AM Kugan Vivekanandarajah <kvivekana...@nvidia.com> wrote: > > This patch extends abs detection in matched for half float. > > Bootstrapped and regression test on aarch64-linux-gnu. Is this OK for trunk?
This is basically this pattern: ``` /* A >=/> 0 ? A : -A same as abs (A) */ (for cmp (ge gt) (simplify (cnd (cmp @0 zerop) @1 (negate @1)) (if (!HONOR_SIGNED_ZEROS (TREE_TYPE(@0)) && !TYPE_UNSIGNED (TREE_TYPE(@0)) && bitwise_equal_p (@0, @1)) (if (TYPE_UNSIGNED (type)) (absu:type @0) (abs @0))))) ``` except extended to handle an optional convert. Why didn't you just extend the above pattern to handle the convert instead? Also I think you have an issue with unsigned types with the comparison. Also you should extend the -abs(A) pattern right below it in a similar fashion. Thanks, Andrew Pinski > > gcc/ChangeLog: > > * match.pd: Add pattern to convert (type)A >=/> 0 ? A : -A into abs (A) for > half float. > > gcc/testsuite/ChangeLog: > > * gcc.dg/tree-ssa/absfloat16.c: New test. > > Signed-off-by: Kugan Vivekanandarajah <kvivekana...@nvidia.com> >