| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-O -fno-tree-sra -fdump-tree-fre1-details" } */ |
| 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 |
union U { |
| 11 |
intflt i; |
| 12 |
float f; |
| 13 |
}; |
| 14 |
intflt foo(int i, int b) |
| 15 |
{ |
| 16 |
union U u; |
| 17 |
if (b) |
| 18 |
{ |
| 19 |
i = i << 2; |
| 20 |
u.i = i; |
| 21 |
return u.f; |
| 22 |
} |
| 23 |
else |
| 24 |
{ |
| 25 |
i = i << 2; |
| 26 |
u.i = i; |
| 27 |
return u.f; |
| 28 |
} |
| 29 |
} |
| 30 |
|
| 31 |
/* { dg-final { scan-tree-dump-times "Replaced u.f with" 2 "fre1" } } */ |
| 32 |
/* { dg-final { scan-tree-dump-times "Inserted" 2 "fre1" } } */ |