diff options
author | Andrew Pinski <pinskia@physics.uc.edu> | 2006-02-09 14:13:57 +0000 |
---|---|---|
committer | Andrew Pinski <pinskia@gcc.gnu.org> | 2006-02-09 06:13:57 -0800 |
commit | 4853940ccb7949141793454476b7436c1a431598 (patch) | |
tree | 66b2befe15094d2b37c15fe8a652cdbf2492f627 /gcc/testsuite/gcc.dg | |
parent | 58e0c554fd7a78dad40f5b0ab705955cfd8bba43 (diff) | |
download | gcc-4853940ccb7949141793454476b7436c1a431598.zip gcc-4853940ccb7949141793454476b7436c1a431598.tar.gz gcc-4853940ccb7949141793454476b7436c1a431598.tar.bz2 |
re PR middle-end/26134 (fold *(float*)(&complex_float_var) into REALPART_EXPR<complex_float_var>)
2006-02-09 Andrew Pinski <pinskia@physics.uc.edu>
PR middle-end/26134
* fold-const.c (fold_indirect_ref_1): Fold
"*(foo *)&complexfoo" to "__real__ complexfoo"
and "((foo*)&complexfoo)[1]" to "__imag__ complexfoo".
2006-02-09 Andrew Pinski <pinskia@physics.uc.edu>
PR middle-end/26134
* gcc.dg/tree-ssa/complex-3.c: New test.
From-SVN: r110800
Diffstat (limited to 'gcc/testsuite/gcc.dg')
-rw-r--r-- | gcc/testsuite/gcc.dg/tree-ssa/complex-3.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/complex-3.c b/gcc/testsuite/gcc.dg/tree-ssa/complex-3.c new file mode 100644 index 0000000..5f4b110 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/complex-3.c @@ -0,0 +1,27 @@ +/* { dg-do compile } */ +/* { dg-options "-O -fdump-tree-optimized" } */ + +typedef _Complex float COMPLEX_FLOAT; +float real_part(COMPLEX_FLOAT a) +{ + return *(float*)(&a); +} + +float real_part_2(COMPLEX_FLOAT a) +{ + return ((float*)(&a))[0]; +} + + +float imag_part(COMPLEX_FLOAT a) +{ + return ((float*)(&a))[1]; +} + +/* Test that the above gets optimized to REALPART_EXPR and IMAGPART_EXPR + respectively. */ + +/* { dg-final { scan-tree-dump-times "REALPART_EXPR" 2 "optimized" } } */ +/* { dg-final { scan-tree-dump-times "IMAGPART_EXPR" 1 "optimized" } } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */ + |