diff options
author | Richard Guenther <rguenther@suse.de> | 2007-01-22 11:11:00 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2007-01-22 11:11:00 +0000 |
commit | 2f397a93c0b178cb905f5ce0de61c4ea94d5fa9a (patch) | |
tree | 4e252e76c93f9c1a661427d2bf5a5d9b4e1dfcf9 /gcc/testsuite/gcc.dg | |
parent | 609610af72877b0ddadef9c20301d0b367e7ddc4 (diff) | |
download | gcc-2f397a93c0b178cb905f5ce0de61c4ea94d5fa9a.zip gcc-2f397a93c0b178cb905f5ce0de61c4ea94d5fa9a.tar.gz gcc-2f397a93c0b178cb905f5ce0de61c4ea94d5fa9a.tar.bz2 |
re PR tree-optimization/30038 (Call to sin(x), cos(x) should be transformed to sincos(x))
2007-01-22 Richard Guenther <rguenther@suse.de>
PR tree-optimization/30038
* tree-ssa-math-opts.c (maybe_record_sincos): New static helper
function.
(execute_cse_sincos_1): Likewise.
(execute_cse_sincos): Likewise.
(gate_cse_sincos): Likewise.
(pass_cse_sincos): New pass CSEing sin() and cos() calls using
the cexpi() canonicalization of sincos().
* tree-pass.h (pass_cse_sincos): Declare.
* passes.c (init_optimization_passes): New pass pas_cse_sincos.
* gcc.dg/builtins-62.c: New testcase.
From-SVN: r121052
Diffstat (limited to 'gcc/testsuite/gcc.dg')
-rw-r--r-- | gcc/testsuite/gcc.dg/builtins-62.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/builtins-62.c b/gcc/testsuite/gcc.dg/builtins-62.c new file mode 100644 index 0000000..af7a02a --- /dev/null +++ b/gcc/testsuite/gcc.dg/builtins-62.c @@ -0,0 +1,40 @@ +/* { dg-do compile } */ +/* { dg-options "-O -ffinite-math-only -fdump-tree-optimized" } */ + +double test1 (double x) +{ + double s, c; + s = __builtin_sin (x); + c = __builtin_cos (x); + return s + c; +} + +double test2 (double x) +{ + double s, c; + x = x * 2; + s = __builtin_sin (x); + c = __builtin_cos (x); + return s + c; +} + +double test3 (double x, int b) +{ + double s, c; + if (b) + x = x * 2; + s = __builtin_sin (x); + c = __builtin_cos (x); + return s + c; +} + +double test4 (double x) +{ + double s; + x = x * 2; + s = __builtin_sin (x); + return s; +} + +/* { dg-final { scan-tree-dump-times "cexpi" 3 "optimized" } } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */ |