OSDN Git Service

2006-02-20 Andrew Pinski <pinskia@physics.uc.edu>
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / tree-ssa / complex-3.c
1 /* { dg-do compile } */
2 /* { dg-options "-O -fdump-tree-optimized" } */
3
4 typedef _Complex float COMPLEX_FLOAT;
5 float real_part(COMPLEX_FLOAT a)
6 {
7   return *(float*)(&a);
8 }
9
10 float real_part_2(COMPLEX_FLOAT a)
11 {
12   return ((float*)(&a))[0];
13 }
14
15
16 float imag_part(COMPLEX_FLOAT a)
17 {
18   return ((float*)(&a))[1];
19 }
20
21 /* Test that the above gets optimized to REALPART_EXPR and IMAGPART_EXPR
22    respectively. */
23
24 /* { dg-final { scan-tree-dump-times "REALPART_EXPR" 2 "optimized" } } */
25 /* { dg-final { scan-tree-dump-times "IMAGPART_EXPR" 1 "optimized" } } */
26 /* { dg-final { cleanup-tree-dump "optimized" } } */
27