re PR tree-optimization/16107 (missed optimization with some math function builtins)

2015-08-17  Richard Biener  <rguenther@suse.de>
	    Naveen H.S  <Naveen.Hurugalawadi@caviumnetworks.com>

	PR middle-end/16107
	* match.pd (div (coss (op @0) : New simplifier.


Co-Authored-By: Naveen H.S <Naveen.Hurugalawadi@caviumnetworks.com>

From-SVN: r226934
This commit is contained in:
Richard Biener 2015-08-17 04:47:45 +00:00 committed by Naveen H.S
parent df2c2c54f6
commit d202f9bdb4
3 changed files with 31 additions and 0 deletions

View file

@ -1,3 +1,9 @@
2015-08-17 Richard Biener <rguenther@suse.de>
Naveen H.S <Naveen.Hurugalawadi@caviumnetworks.com>
PR middle-end/16107
* match.pd (div (coss (op @0) : New simplifier.
2015-08-14 Alexandre Oliva <aoliva@redhat.com>
PR rtl-optimization/64164

View file

@ -55,6 +55,8 @@ along with GCC; see the file COPYING3. If not see
(define_operator_list POW10 BUILT_IN_POW10F BUILT_IN_POW10 BUILT_IN_POW10L)
(define_operator_list SQRT BUILT_IN_SQRTF BUILT_IN_SQRT BUILT_IN_SQRTL)
(define_operator_list CBRT BUILT_IN_CBRTF BUILT_IN_CBRT BUILT_IN_CBRTL)
(define_operator_list COS BUILT_IN_COS BUILT_IN_COSL BUILT_IN_COSF)
(define_operator_list COSH BUILT_IN_COSH BUILT_IN_COSHL BUILT_IN_COSHF)
/* Simplifications of operations with one constant operand and
@ -304,6 +306,13 @@ along with GCC; see the file COPYING3. If not see
&& TYPE_OVERFLOW_UNDEFINED (type))
@0)))
/* Simplify cos (-x) -> cos (x). */
(for op (negate abs)
(for coss (COS COSH)
(simplify
(coss (op @0))
(coss @0))))
/* X % Y is smaller than Y. */
(for cmp (lt ge)
(simplify

View file

@ -0,0 +1,16 @@
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-optimized" } */
#include <math.h>
double t (double x)
{
x = -x;
x = cos (x);
x = -x;
x = cosh (x);
return x;
}
/* { dg-final { scan-tree-dump-not "-x" "optimized" } } */