r266142 - in /trunk/gcc: ChangeLog match.pd tes...

wilco@gcc.gnu.org wilco@gcc.gnu.org
Wed Nov 14 12:45:00 GMT 2018


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



More information about the Gcc-cvs mailing list