Commit 7ac9a201 by Marc Glisse Committed by Marc Glisse

fold_real_zero_addition_p for vectors

2019-06-11  Marc Glisse  <marc.glisse@inria.fr>

	PR tree-optimization/62041
	* fold-const.c (fold_real_zero_addition_p): Handle vectors.

From-SVN: r272151
parent 92812757
2019-06-11 Marc Glisse <marc.glisse@inria.fr>
PR tree-optimization/62041
* fold-const.c (fold_real_zero_addition_p): Handle vectors.
2019-06-11 Jason Merrill <jason@redhat.com> 2019-06-11 Jason Merrill <jason@redhat.com>
* gdbhooks.py (TreePrinter.to_string): Recognize ggc_free'd memory. * gdbhooks.py (TreePrinter.to_string): Recognize ggc_free'd memory.
......
...@@ -6722,15 +6722,21 @@ fold_real_zero_addition_p (const_tree type, const_tree addend, int negate) ...@@ -6722,15 +6722,21 @@ fold_real_zero_addition_p (const_tree type, const_tree addend, int negate)
return false; return false;
/* Don't allow the fold with -fsignaling-nans. */ /* Don't allow the fold with -fsignaling-nans. */
if (HONOR_SNANS (element_mode (type))) if (HONOR_SNANS (type))
return false; return false;
/* Allow the fold if zeros aren't signed, or their sign isn't important. */ /* Allow the fold if zeros aren't signed, or their sign isn't important. */
if (!HONOR_SIGNED_ZEROS (element_mode (type))) if (!HONOR_SIGNED_ZEROS (type))
return true; return true;
/* There is no case that is safe for all rounding modes. */
if (HONOR_SIGN_DEPENDENT_ROUNDING (type))
return false;
/* In a vector or complex, we would need to check the sign of all zeros. */ /* In a vector or complex, we would need to check the sign of all zeros. */
if (TREE_CODE (addend) != REAL_CST) if (TREE_CODE (addend) == VECTOR_CST)
addend = uniform_vector_p (addend);
if (!addend || TREE_CODE (addend) != REAL_CST)
return false; return false;
/* Treat x + -0 as x - 0 and x - -0 as x + 0. */ /* Treat x + -0 as x - 0 and x - -0 as x + 0. */
...@@ -6739,9 +6745,8 @@ fold_real_zero_addition_p (const_tree type, const_tree addend, int negate) ...@@ -6739,9 +6745,8 @@ fold_real_zero_addition_p (const_tree type, const_tree addend, int negate)
/* The mode has signed zeros, and we have to honor their sign. /* The mode has signed zeros, and we have to honor their sign.
In this situation, there is only one case we can return true for. In this situation, there is only one case we can return true for.
X - 0 is the same as X unless rounding towards -infinity is X - 0 is the same as X with default rounding. */
supported. */ return negate;
return negate && !HONOR_SIGN_DEPENDENT_ROUNDING (element_mode (type));
} }
/* Subroutine of match.pd that optimizes comparisons of a division by /* Subroutine of match.pd that optimizes comparisons of a division by
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment