OSDN Git Service

PR rtl-optimization/52139
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / tree-ssa / ssa-fre-7.c
1 /* { dg-do compile } */
2 /* { dg-options "-O -fno-tree-sra -fdump-tree-fre1-details -fdump-tree-optimized" } */
3 #if (__SIZEOF_INT__ == __SIZEOF_FLOAT__)
4 typedef int intflt;
5 #elif (__SIZEOF_LONG__ == __SIZEOF_FLOAT__)
6 typedef long intflt;
7 #else
8 #error Add target support here for type that will union float size
9 #endif
10
11 struct X {
12   int i;
13   union {
14     intflt j;
15     intflt k;
16     float f;
17   } u;
18 };
19
20 intflt foo(intflt j)
21 {
22   struct X a;
23
24   a.u.j = j;
25   a.u.f = a.u.f;
26   a.u.f = a.u.f;
27   a.u.j = a.u.j;
28   a.u.f = a.u.f;
29   return a.u.k;
30 }
31
32 /* { dg-final { scan-tree-dump-times "Inserted pretmp" 1 "fre1" } } */
33 /* { dg-final { scan-tree-dump-times "Replaced a.u.f with pretmp" 3 "fre1" } } */
34 /* { dg-final { scan-tree-dump-times "Replaced a.u.k with j" 1 "fre1" } } */
35 /* { dg-final { scan-tree-dump "= VIEW_CONVERT_EXPR<float>\\\(j_" "fre1" } } */
36 /* { dg-final { scan-tree-dump "return j" "optimized" } } */
37 /* { dg-final { cleanup-tree-dump "fre1" } } */
38 /* { dg-final { cleanup-tree-dump "optimized" } } */