[PATCH] Simplify floating point comparisons
Jeff Law
law@redhat.com
Mon Apr 30 17:41:00 GMT 2018
On 01/12/2018 06:21 AM, Wilco Dijkstra wrote:
> Hi,
>
> Here is the updated version:
>
> This patch implements some of the optimizations discussed in
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71026.
>
> Simplify (C / x >= 0.0) into x >= 0.0 with -fno-signed-zeros
> and -ffinite-math-only. If C is negative the comparison is reversed.
> Only handle >= and <= for now since C / x can underflow if C is small.
>
>
> Simplify (x * C1) > C2 into x > (C2 / C1) with -funsafe-math-optimizations.
> If C1 is negative the comparison is reversed.
>
> OK for commit?
>
> ChangeLog
> 2018-01-10 Wilco Dijkstra <wdijkstr@arm.com>
> Jackson Woodruff <jackson.woodruff@arm.com>
>
> gcc/
> PR 71026/tree-optimization
> * match.pd: Simplify floating point comparisons.
>
> gcc/testsuite/
> PR 71026/tree-optimization
> * gcc.dg/div-cmp-1.c: New test.
> * gcc.dg/div-cmp-2.c: New test.
OK for the trunk. I don't think there is a need to backport to gcc-8.
jeff
More information about the Gcc-patches
mailing list