URL
https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk
Only display areas with differences |
Details |
Blame |
View Log
Rev 318 |
Rev 384 |
/* PR middle-end/37870 */
|
/* PR middle-end/37870 */
|
/* { dg-do run } */
|
/* { dg-do run } */
|
/* { dg-options "-O2" } */
|
/* { dg-options "-O2" } */
|
|
|
unsigned int
|
unsigned int
|
foo (long double x)
|
foo (long double x)
|
{
|
{
|
struct { char a[8]; unsigned int b:7; } c;
|
struct { char a[8]; unsigned int b:7; } c;
|
__builtin_memcpy (&c, &x, sizeof (c));
|
__builtin_memcpy (&c, &x, sizeof (c));
|
return c.b;
|
return c.b;
|
}
|
}
|
|
|
unsigned int
|
unsigned int
|
bar (long double x)
|
bar (long double x)
|
{
|
{
|
union { struct { char a[8]; unsigned int b:7; } c; long double d; } u;
|
union { struct { char a[8]; unsigned int b:7; } c; long double d; } u;
|
u.d = x;
|
u.d = x;
|
return u.c.b;
|
return u.c.b;
|
}
|
}
|
|
|
int
|
int
|
main (void)
|
main (void)
|
{
|
{
|
if (foo (1.245L) != bar (1.245L)
|
if (foo (1.245L) != bar (1.245L)
|
|| foo (245.67L) != bar (245.67L)
|
|| foo (245.67L) != bar (245.67L)
|
|| foo (0.00567L) != bar (0.00567L))
|
|| foo (0.00567L) != bar (0.00567L))
|
__builtin_abort ();
|
__builtin_abort ();
|
return 0;
|
return 0;
|
}
|
}
|
|
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.