OSDN Git Service

patch for PR rtl-optimization/25130
[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 extern void abort (void);
6
7 typedef float SFtype __attribute__ ((mode (SF)));
8 typedef float DFtype __attribute__ ((mode (DF)));
9
10 typedef int HItype __attribute__ ((mode (HI)));
11 typedef int SItype __attribute__ ((mode (SI)));
12 typedef int DItype __attribute__ ((mode (DI)));
13
14 typedef unsigned int UHItype __attribute__ ((mode (HI)));
15 typedef unsigned int USItype __attribute__ ((mode (SI)));
16 typedef unsigned int UDItype __attribute__ ((mode (DI)));
17
18 typedef UDItype fractype;
19 typedef USItype halffractype;
20 typedef DFtype FLO_type;
21 typedef DItype intfrac;
22
23
24 typedef union
25 {
26   long long foo;
27   FLO_type value;
28   struct
29     {
30       fractype fraction:52 __attribute__ ((packed));
31       unsigned int exp:11 __attribute__ ((packed));
32       unsigned int sign:1 __attribute__ ((packed));
33     }
34   bits;
35 } FLO_union_type;
36
37 void foo (long long a);
38 long long x; 
39
40 void
41 pack_d ()
42 {
43   FLO_union_type dst = { 0x0123456789abcdefLL };
44
45   x = dst.bits.fraction;
46 }
47
48 main ()
49 {
50   pack_d ();
51   foo (x);
52   return 0;
53 }
54
55 void
56 foo (long long a)
57 {
58   if (a != 0x0123456789abcLL)
59     abort ();
60 }