OSDN Git Service

Add new tests for xstormy16
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.target / xstormy16 / data_below100 / 26_if1_b100w_bitfield_3.c
1 /* { dg-options { -nostartfiles below100.o -Tbelow100.ld -O2 } } */
2 /* { dg-final { scan-assembler "b\[np\] B100A,#3," } } */
3 /* { dg-final { scan-assembler "b\[np\] B100B,#3," } } */
4
5 typedef struct
6 {
7   unsigned short b0:1;
8   unsigned short b1:1;
9   unsigned short b2:1;
10   unsigned short b3:1;
11   unsigned short b4:1;
12   unsigned short b5:1;
13   unsigned short b6:1;
14   unsigned short b7:1;
15   unsigned short b8:1;
16   unsigned short b9:1;
17   unsigned short b10:1;
18   unsigned short b11:1;
19   unsigned short b12:1;
20   unsigned short b13:1;
21   unsigned short b14:1;
22   unsigned short b15:1;
23 } BitField;
24
25 char acDummy[0xf0] __attribute__ ((__BELOW100__));
26 BitField B100A __attribute__ ((__BELOW100__)) =
27 {
28 1, 1, 0, 1, 0, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1};
29 unsigned short *pA = (unsigned short *) &B100A;
30 BitField B100B __attribute__ ((__BELOW100__)) =
31 {
32 0, 0, 1, 0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0};
33 unsigned short *pB = (unsigned short *) &B100B;
34
35 char *
36 Do (void)
37 {
38   if (B100A.b3)
39     {
40       if (B100B.b3)
41         return "Fail";
42       else
43         return "Success";
44     }
45   else
46     return "Fail";
47 }
48
49 int
50 main (void)
51 {
52   return Do ()[0] == 'F';
53 }