Skip to content

Commit

Permalink
PR tree-optimization/61441
Browse files Browse the repository at this point in the history
	* simplify-rtx.c (simplify_const_unary_operation): For
	-fsignaling-nans and sNaN operand, return NULL_RTX rather than
	the sNaN unmodified.


git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@245620 138bc75d-0d04-0410-961f-82ee72b054a4
  • Loading branch information
jakub committed Feb 21, 2017
1 parent 734dc20 commit d4a7abd
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
7 changes: 7 additions & 0 deletions gcc/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
2017-02-21 Jakub Jelinek <jakub@redhat.com>

PR tree-optimization/61441
* simplify-rtx.c (simplify_const_unary_operation): For
-fsignaling-nans and sNaN operand, return NULL_RTX rather than
the sNaN unmodified.

2017-02-20 Bernd Edlinger <bernd.edlinger@hotmail.de>

* Makefile.in (BUILD_SYSTEM_HEADER_DIR): New make variabe.
Expand Down
19 changes: 11 additions & 8 deletions gcc/simplify-rtx.c
Original file line number Diff line number Diff line change
Expand Up @@ -1889,23 +1889,26 @@ simplify_const_unary_operation (enum rtx_code code, machine_mode mode,
case FLOAT_TRUNCATE:
/* Don't perform the operation if flag_signaling_nans is on
and the operand is a signaling NaN. */
if (!(HONOR_SNANS (mode) && REAL_VALUE_ISSIGNALING_NAN (d)))
d = real_value_truncate (mode, d);
if (HONOR_SNANS (mode) && REAL_VALUE_ISSIGNALING_NAN (d))
return NULL_RTX;
d = real_value_truncate (mode, d);
break;
case FLOAT_EXTEND:
/* All this does is change the mode, unless changing
mode class. */
/* Don't perform the operation if flag_signaling_nans is on
and the operand is a signaling NaN. */
if (GET_MODE_CLASS (mode) != GET_MODE_CLASS (GET_MODE (op))
&& !(HONOR_SNANS (mode) && REAL_VALUE_ISSIGNALING_NAN (d)))
if (HONOR_SNANS (mode) && REAL_VALUE_ISSIGNALING_NAN (d))
return NULL_RTX;
/* All this does is change the mode, unless changing
mode class. */
if (GET_MODE_CLASS (mode) != GET_MODE_CLASS (GET_MODE (op)))
real_convert (&d, mode, &d);
break;
case FIX:
/* Don't perform the operation if flag_signaling_nans is on
and the operand is a signaling NaN. */
if (!(HONOR_SNANS (mode) && REAL_VALUE_ISSIGNALING_NAN (d)))
real_arithmetic (&d, FIX_TRUNC_EXPR, &d, NULL);
if (HONOR_SNANS (mode) && REAL_VALUE_ISSIGNALING_NAN (d))
return NULL_RTX;
real_arithmetic (&d, FIX_TRUNC_EXPR, &d, NULL);
break;
case NOT:
{
Expand Down

0 comments on commit d4a7abd

Please sign in to comment.