Commit 2066f795 by Rafael Tsuha Committed by Jeff Law

match.pd (sinh (x) / cosh (x)): New simplification rule.

        * match.pd (sinh (x) / cosh (x)): New simplification rule.

        * gcc.dg/sinhovercosh-1.c: New test.

From-SVN: r276595
parent 69b35f39
2019-10-04 Rafael Tsuha <rafael.tsuha@usp.br>
* match.pd (sinh (x) / cosh (x)): New simplification rule.
2019-10-04 Martin Jambor <mjambor@suse.cz> 2019-10-04 Martin Jambor <mjambor@suse.cz>
* tree-ssa-forwprop.c (simplify_builtin_call): Set gimple call * tree-ssa-forwprop.c (simplify_builtin_call): Set gimple call
......
...@@ -4922,6 +4922,11 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) ...@@ -4922,6 +4922,11 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
(rdiv (SIN:s @0) (COS:s @0)) (rdiv (SIN:s @0) (COS:s @0))
(TAN @0)) (TAN @0))
/* Simplify sinh(x) / cosh(x) -> tanh(x). */
(simplify
(rdiv (SINH:s @0) (COSH:s @0))
(TANH @0))
/* Simplify cos(x) / sin(x) -> 1 / tan(x). */ /* Simplify cos(x) / sin(x) -> 1 / tan(x). */
(simplify (simplify
(rdiv (COS:s @0) (SIN:s @0)) (rdiv (COS:s @0) (SIN:s @0))
......
2019-10-04 Rafael Tsuha <rafael.tsuha@usp.br>
* gcc.dg/sinhovercosh-1.c: New test.
2019-10-04 Joseph Myers <joseph@codesourcery.com> 2019-10-04 Joseph Myers <joseph@codesourcery.com>
* gcc.dg/c11-builtins-1.c, gcc.dg/c2x-builtins-1.c, * gcc.dg/c11-builtins-1.c, gcc.dg/c2x-builtins-1.c,
......
/* { dg-do compile } */
/* { dg-options "-Ofast -fdump-tree-optimized" } */
extern float sinhf (float);
extern float coshf (float);
extern float tanhf (float);
extern float sqrtf (float);
extern double sinh (double);
extern double cosh (double);
extern double sqrt (double);
extern double tanh (double);
extern long double sinhl (long double);
extern long double coshl (long double);
extern long double tanhl (long double);
extern long double sqrtl (long double);
double __attribute__ ((noinline))
sinhovercosh_ (double x)
{
return sinh (x) / cosh (x);
}
float __attribute__ ((noinline))
sinhfovercoshf_(float x)
{
return sinhf (x) / coshf (x);
}
long double __attribute__ ((noinline))
sinhlovercoshl_ (long double x)
{
return sinhl (x) / coshl (x);
}
/* There must be no calls to sinh, cosh, or atanh */
/* {dg-final { scan-tree-dump-not "sinh " "optimized" } } */
/* {dg-final { scan-tree-dump-not "cosh " "optimized" } } */
/* {dg-final { scan-tree-dump-not "sinfh " "optimized" } } */
/* {dg-final { scan-tree-dump-not "cosfh " "optimized" } } */
/* {dg-final { scan-tree-dump-not "sinlh " "optimized" } } */
/* {dg-final { scan-tree-dump-not "coslh " "optimized" } } */
/* {dg-final { scan-tree-dump-times "tanh " "1" "optimized" }} */
/* {dg-final { scan-tree-dump-times "tanhl " "1" "optimized" }} */
/* {dg-final { scan-tree-dump-times "tanhf " "1" "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