OSDN Git Service

PR target/6428
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / bf-spl1.c
1 /* { dg-do run { target m68k-*-* sparc-*-* } } */
2 /* { dg-options { -m68000 -O2 } { target m68k-*-* } } */
3 /* { dg-options { -O2 } { target sparc-*-* } } */
4
5 typedef SFtype __attribute__ ((mode (SF)));
6 typedef DFtype __attribute__ ((mode (DF)));
7
8 typedef int HItype __attribute__ ((mode (HI)));
9 typedef int SItype __attribute__ ((mode (SI)));
10 typedef int DItype __attribute__ ((mode (DI)));
11
12 typedef unsigned int UHItype __attribute__ ((mode (HI)));
13 typedef unsigned int USItype __attribute__ ((mode (SI)));
14 typedef unsigned int UDItype __attribute__ ((mode (DI)));
15
16 typedef UDItype fractype;
17 typedef USItype halffractype;
18 typedef DFtype FLO_type;
19 typedef DItype intfrac;
20
21
22 typedef union
23 {
24   long long foo;
25   FLO_type value;
26   struct
27     {
28       fractype fraction:52 __attribute__ ((packed));
29       unsigned int exp:11 __attribute__ ((packed));
30       unsigned int sign:1 __attribute__ ((packed));
31     }
32   bits;
33 } FLO_union_type;
34
35 void foo (long long a);
36 long long x; 
37
38 void
39 pack_d ()
40 {
41   FLO_union_type dst = { 0x0123456789abcdefLL };
42
43   x = dst.bits.fraction;
44 }
45
46 main ()
47 {
48   pack_d ();
49   foo (x);
50   return 0;
51 }
52
53 void
54 foo (long long a)
55 {
56   if (a != 0x0123456789abcLL)
57     abort ();
58 }