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
+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
&& (! 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.
--- /dev/null
+/* { 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" } } */