re PR tree-optimization/53805 (combine_comparisons changes trapping behavior)

2012-08-02  Marc Glisse  <marc.glisse@inria.fr>

	PR tree-optimization/53805
	* gcc/fold-const.c (invert_tree_comparison): Invert ORDERED_EXPR and
	UNORDERED_EXPR even for trapping floating point.
	* gcc/testsuite/gcc.dg/fold-notunord.c: New testcase.

From-SVN: r190100
This commit is contained in:
Marc Glisse 2012-08-02 21:54:43 +02:00 committed by Marc Glisse
parent c2381fb2f0
commit 77b5132f66
4 changed files with 25 additions and 2 deletions

View File

@ -1,3 +1,9 @@
2012-08-02 Marc Glisse <marc.glisse@inria.fr>
PR tree-optimization/53805
* fold-const.c (invert_tree_comparison): Invert ORDERED_EXPR and
UNORDERED_EXPR even for trapping floating point.
2012-08-02 H.J. Lu <hongjiu.lu@intel.com>
PR middle-end/53321

View File

@ -2094,12 +2094,14 @@ pedantic_non_lvalue_loc (location_t loc, tree x)
/* Given a tree comparison code, return the code that is the logical inverse.
It is generally not safe to do this for floating-point comparisons, except
for EQ_EXPR and NE_EXPR, so we return ERROR_MARK in this case. */
for EQ_EXPR, NE_EXPR, ORDERED_EXPR and UNORDERED_EXPR, so we return
ERROR_MARK in this case. */
enum tree_code
invert_tree_comparison (enum tree_code code, bool honor_nans)
{
if (honor_nans && flag_trapping_math && code != EQ_EXPR && code != NE_EXPR)
if (honor_nans && flag_trapping_math && code != EQ_EXPR && code != NE_EXPR
&& code != ORDERED_EXPR && code != UNORDERED_EXPR)
return ERROR_MARK;
switch (code)

View File

@ -1,3 +1,8 @@
2012-08-02 Marc Glisse <marc.glisse@inria.fr>
PR tree-optimization/53805
* gcc.dg/fold-notunord.c: New testcase.
2012-08-02 Mikael Morin <mikael@gcc.gnu.org>
PR fortran/48820

View File

@ -0,0 +1,10 @@
/* { dg-do compile } */
/* { dg-options "-O -ftrapping-math -fdump-tree-optimized" } */
int f (double d)
{
return !__builtin_isnan (d);
}
/* { dg-final { scan-tree-dump " ord " "optimized" } } */
/* { dg-final { cleanup-tree-dump "optimized" } } */