Commit 54f84ca9 by Richard Biener Committed by Richard Biener

re PR middle-end/55152 (MAX_EXPR(a,-a) is really ABS_EXPR(a))

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

	PR middle-end/55152
	* match.pd (min(a,-a) -> -abs(a)): New pattern.

	* gcc.dg/pr55152-2.c: New testcase.

From-SVN: r240770
parent 17beda50
2016-10-05 Richard Biener <rguenther@suse.de>
PR middle-end/55152
* match.pd (min(a,-a) -> -abs(a)): New pattern.
2016-10-04 Ian Lance Taylor <iant@golang.org>
* explow.c (allocate_dynamic_stack_space): Call
......
......@@ -1291,6 +1291,13 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
&& (! ANY_INTEGRAL_TYPE_P (type)
|| TYPE_OVERFLOW_UNDEFINED (type)))
(abs @0)))
/* min(a,-a) -> -abs(a). */
(simplify
(min:c @0 (negate @0))
(if (TREE_CODE (type) != COMPLEX_TYPE
&& (! ANY_INTEGRAL_TYPE_P (type)
|| TYPE_OVERFLOW_UNDEFINED (type)))
(negate (abs @0))))
(simplify
(min @0 @1)
(switch
......
2016-10-05 Richard Biener <rguenther@suse.de>
PR middle-end/55152
* gcc.dg/pr55152-2.c: New testcase.
2016-10-04 Jerry DeLisle <jvdelisle@gcc.gnu.org>
* gfortran.dg/dtio_15.f90: New test.
......
/* { dg-do compile } */
/* { dg-options "-O -ffinite-math-only -fno-signed-zeros -fstrict-overflow -fdump-tree-optimized" } */
double g (double a)
{
return (a<-a)?a:-a;
}
int f(int a)
{
return (a<-a)?a:-a;
}
/* { dg-final { scan-tree-dump-times "ABS_EXPR" 2 "optimized" } } */
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