Clean an inconsistency with -ffinite-math-only.

Backported from the gcc-4_3-branch, revision 118001,
under the GPLv2.

This issue was also fixed in Apple's gcc.

PR:		157025
Reviewed by:	mm
Approved by:	jhb (mentor)
MFC:		2 weeks
This commit is contained in:
Pedro F. Giffuni 2011-12-21 01:58:35 +00:00
parent 855291741d
commit 4ee8547efb
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=228756
2 changed files with 15 additions and 7 deletions

View File

@ -96,6 +96,14 @@
* doc/invoke.texi: Add entry about geode processor.
2006-10-24 Richard Guenther <rguenther@suse.de>
PR middle-end/28796
* builtins.c (fold_builtin_classify): Use HONOR_INFINITIES
and HONOR_NANS instead of MODE_HAS_INFINITIES and MODE_HAS_NANS
for deciding optimizations in consistency with fold-const.c
(fold_builtin_unordered_cmp): Likewise.
2006-10-22 H.J. Lu <hongjiu.lu@intel.com> (r117958)
* config.gcc (i[34567]86-*-*): Add tmmintrin.h to extra_headers.

View File

@ -8720,7 +8720,7 @@ fold_builtin_classify (tree fndecl, tree arglist, int builtin_index)
switch (builtin_index)
{
case BUILT_IN_ISINF:
if (!MODE_HAS_INFINITIES (TYPE_MODE (TREE_TYPE (arg))))
if (!HONOR_INFINITIES (TYPE_MODE (TREE_TYPE (arg))))
return omit_one_operand (type, integer_zero_node, arg);
if (TREE_CODE (arg) == REAL_CST)
@ -8736,8 +8736,8 @@ fold_builtin_classify (tree fndecl, tree arglist, int builtin_index)
return NULL_TREE;
case BUILT_IN_FINITE:
if (!MODE_HAS_NANS (TYPE_MODE (TREE_TYPE (arg)))
&& !MODE_HAS_INFINITIES (TYPE_MODE (TREE_TYPE (arg))))
if (!HONOR_NANS (TYPE_MODE (TREE_TYPE (arg)))
&& !HONOR_INFINITIES (TYPE_MODE (TREE_TYPE (arg))))
return omit_one_operand (type, integer_zero_node, arg);
if (TREE_CODE (arg) == REAL_CST)
@ -8750,7 +8750,7 @@ fold_builtin_classify (tree fndecl, tree arglist, int builtin_index)
return NULL_TREE;
case BUILT_IN_ISNAN:
if (!MODE_HAS_NANS (TYPE_MODE (TREE_TYPE (arg))))
if (!HONOR_NANS (TYPE_MODE (TREE_TYPE (arg))))
return omit_one_operand (type, integer_zero_node, arg);
if (TREE_CODE (arg) == REAL_CST)
@ -8833,13 +8833,13 @@ fold_builtin_unordered_cmp (tree fndecl, tree arglist,
if (unordered_code == UNORDERED_EXPR)
{
if (!MODE_HAS_NANS (TYPE_MODE (TREE_TYPE (arg0))))
if (!HONOR_NANS (TYPE_MODE (TREE_TYPE (arg0))))
return omit_two_operands (type, integer_zero_node, arg0, arg1);
return fold_build2 (UNORDERED_EXPR, type, arg0, arg1);
}
code = MODE_HAS_NANS (TYPE_MODE (TREE_TYPE (arg0))) ? unordered_code
: ordered_code;
code = HONOR_NANS (TYPE_MODE (TREE_TYPE (arg0))) ? unordered_code
: ordered_code;
return fold_build1 (TRUTH_NOT_EXPR, type,
fold_build2 (code, type, arg0, arg1));
}