Commit eeb57981 by Richard Biener Committed by Richard Biener

match.pd (copysign(x, CST) -> [-]abs (x)): New pattern.

2016-10-05  Richard Biener  <rguenther@suse.de>

	* match.pd (copysign(x, CST) -> [-]abs (x)): New pattern.

	* gcc.dg/fold-copysign-1.c: New testcase.

From-SVN: r240775
parent a5382f1c
2016-10-05 Richard Biener <rguenther@suse.de>
* match.pd (copysign(x, CST) -> [-]abs (x)): New pattern.
2016-10-05 Richard Biener <rguenther@suse.de>
PR middle-end/77842
* genmatch.c (parser::parse_c_expr): Handle premature EOF.
......
......@@ -452,6 +452,14 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
(hypots @0 (copysigns @1 @2))
(hypots @0 @1)))
/* copysign(x, CST) -> [-]abs (x). */
(for copysigns (COPYSIGN)
(simplify
(copysigns @0 REAL_CST@1)
(if (REAL_VALUE_NEGATIVE (TREE_REAL_CST (@1)))
(negate (abs @0))
(abs @0))))
/* copysign(copysign(x, y), z) -> copysign(x, z). */
(for copysigns (COPYSIGN)
(simplify
......
2016-10-05 Richard Biener <rguenther@suse.de>
* gcc.dg/fold-copysign-1.c: New testcase.
2016-10-05 Andreas Schwab <schwab@suse.de>
* g++.dg/pr49847-2.C: Remove.
......
/* { dg-do compile } */
/* { dg-options "-O -fdump-tree-cddce1" } */
double foo (double x)
{
double one = 1.;
return __builtin_copysign (x, one);
}
double bar (double x)
{
double minuszero = -0.;
return __builtin_copysign (x, minuszero);
}
/* { dg-final { scan-tree-dump-times "= -" 1 "cddce1" } } */
/* { dg-final { scan-tree-dump-times "= ABS_EXPR" 2 "cddce1" } } */
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