diff options
Diffstat (limited to 'gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-8.c')
-rw-r--r-- | gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-8.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-8.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-8.c new file mode 100644 index 000000000..bc9f8e399 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-8.c @@ -0,0 +1,33 @@ +/* { dg-do compile } */ +/* { dg-options "-O -fno-tree-sra -fdump-tree-fre-details" } */ +#if (__SIZEOF_INT__ == __SIZEOF_FLOAT__) +typedef int intflt; +#elif (__SIZEOF_LONG__ == __SIZEOF_FLOAT__) +typedef long intflt; +#else +#error Add target support here for type that will union float size +#endif +union U { + intflt i; + float f; +}; +intflt foo(int i, int b) +{ + union U u; + if (b) + { + i = i << 2; + u.i = i; + return u.f; + } + else + { + i = i << 2; + u.i = i; + return u.f; + } +} + +/* { dg-final { scan-tree-dump-times "Replaced u.f with pretmp" 2 "fre" } } */ +/* { dg-final { scan-tree-dump-times "Inserted pretmp" 2 "fre" } } */ +/* { dg-final { cleanup-tree-dump "fre" } } */ |