URL
https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk
Go to most recent revision |
Only display areas with differences |
Details |
Blame |
View Log
Rev 298 |
Rev 384 |
/* { dg-do compile } */
|
/* { dg-do compile } */
|
/* { dg-options "-O -fno-tree-sra -fdump-tree-fre-details" } */
|
/* { dg-options "-O -fno-tree-sra -fdump-tree-fre-details" } */
|
#if (__SIZEOF_INT__ == __SIZEOF_FLOAT__)
|
#if (__SIZEOF_INT__ == __SIZEOF_FLOAT__)
|
typedef int intflt;
|
typedef int intflt;
|
#elif (__SIZEOF_LONG__ == __SIZEOF_FLOAT__)
|
#elif (__SIZEOF_LONG__ == __SIZEOF_FLOAT__)
|
typedef long intflt;
|
typedef long intflt;
|
#else
|
#else
|
#error Add target support here for type that will union float size
|
#error Add target support here for type that will union float size
|
#endif
|
#endif
|
union U {
|
union U {
|
intflt i;
|
intflt i;
|
float f;
|
float f;
|
};
|
};
|
intflt foo(int i, int b)
|
intflt foo(int i, int b)
|
{
|
{
|
union U u;
|
union U u;
|
if (b)
|
if (b)
|
{
|
{
|
i = i << 2;
|
i = i << 2;
|
u.i = i;
|
u.i = i;
|
return u.f;
|
return u.f;
|
}
|
}
|
else
|
else
|
{
|
{
|
i = i << 2;
|
i = i << 2;
|
u.i = i;
|
u.i = i;
|
return u.f;
|
return u.f;
|
}
|
}
|
}
|
}
|
|
|
/* { dg-final { scan-tree-dump-times "Replaced u.f with pretmp" 2 "fre" } } */
|
/* { 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 { scan-tree-dump-times "Inserted pretmp" 2 "fre" } } */
|
/* { dg-final { cleanup-tree-dump "fre" } } */
|
/* { dg-final { cleanup-tree-dump "fre" } } */
|
|
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.