diff options
author | sayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-05-30 21:34:04 +0000 |
---|---|---|
committer | sayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-05-30 21:34:04 +0000 |
commit | 5f4f36179fad688358074cd9dd9cd0461168334a (patch) | |
tree | e8c7d9474db25736fdee60d42de43372bd6ae36e /gcc/testsuite/gcc.dg | |
parent | f5ecb8bdad7d1c93386fd9bfd6669cf0f51550b4 (diff) | |
download | gcc-5f4f36179fad688358074cd9dd9cd0461168334a.tar.gz |
PR tree-optimization/23452
* fold-const.c (fold_mult_zconjz): New subroutine of fold_binary,
to optimize z * conj(z) as realpart(z)^2 + imagpart(z)^2.
(fold_binary) <MULT_EXPR>: Call fold_mult_zconjz for integral
complex values and with -ffast-math for FP complex values.
* gcc.dg/fold-mulconj-1.c: New test case.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@114246 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.dg')
-rw-r--r-- | gcc/testsuite/gcc.dg/fold-mulconj-1.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/fold-mulconj-1.c b/gcc/testsuite/gcc.dg/fold-mulconj-1.c new file mode 100644 index 00000000000..0e04653e393 --- /dev/null +++ b/gcc/testsuite/gcc.dg/fold-mulconj-1.c @@ -0,0 +1,16 @@ +/* PR tree-optimization/23452 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -ffast-math -fdump-tree-gimple" } */ + +_Complex double foo(_Complex double z) +{ + return z * ~z; +} + +_Complex int bar(_Complex int z) +{ + return z * ~z; +} + +/* { dg-final { scan-tree-dump-times "CONJ_EXPR" 0 "gimple" } } */ +/* { dg-final { cleanup-tree-dump "gimple" } } */ |