https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71026

--- Comment #11 from Wilco <wilco at gcc dot gnu.org> ---
Author: wilco
Date: Wed Nov 14 12:45:29 2018
New Revision: 266142

URL: https://gcc.gnu.org/viewcvs?rev=266142&root=gcc&view=rev
Log:
Simplify floating point comparisons

This patch implements some of the optimizations discussed in PR71026.

Simplify (C / x >= 0.0) into x >= 0.0 with -funsafe-math-optimizations
(since C / x can underflow to zero if x is huge, it's not safe otherwise).
If C is negative the comparison is reversed.

Simplify (x * C1) > C2 into x > (C2 / C1) with -funsafe-math-optimizations.
If C1 is negative the comparison is reversed.

    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.

Added:
    trunk/gcc/testsuite/gcc.dg/div-cmp-1.c
    trunk/gcc/testsuite/gcc.dg/div-cmp-2.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/match.pd
    trunk/gcc/testsuite/ChangeLog

Reply via email to