OSDN Git Service

Add NIOS2 support. Code from SourceyG++.
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.target / i386 / pr37870.c
1 /* PR middle-end/37870 */
2 /* { dg-do run } */
3 /* { dg-options "-O2" } */
4
5 unsigned int
6 foo (long double x)
7 {
8   struct { char a[8]; unsigned int b:7; } c;
9   __builtin_memcpy (&c, &x, sizeof (c));
10   return c.b;
11 }
12
13 unsigned int
14 bar (long double x)
15 {
16   union { struct { char a[8]; unsigned int b:7; } c; long double d; } u;
17   u.d = x;
18   return u.c.b;
19 }
20
21 int
22 main (void)
23 {
24   if (foo (1.245L) != bar (1.245L)
25       || foo (245.67L) != bar (245.67L)
26       || foo (0.00567L) != bar (0.00567L))
27     __builtin_abort ();
28   return 0;
29 }