* gcc.target/i386/mpx/hard-reg-1-nov.c (mpx_test): Use "esp"
[official-gcc.git] / gcc / testsuite / gcc.c-torture / execute / bitfld-3.c
blob52a4147ccec11b0de0426488d54cc955f46f503a
1 /* Test that operations on bit-fields yield results reduced to bit-field
2 type. */
3 /* Origin: Joseph Myers <jsm@polyomino.org.uk> */
5 extern void exit (int);
6 extern void abort (void);
8 struct s {
9 unsigned long long u33: 33;
10 unsigned long long u40: 40;
11 unsigned long long u41: 41;
14 struct s a = { 0x100000, 0x100000, 0x100000 };
15 struct s b = { 0x100000000ULL, 0x100000000ULL, 0x100000000ULL };
16 struct s c = { 0x1FFFFFFFFULL, 0, 0 };
18 int
19 main (void)
21 if (a.u33 * a.u33 != 0 || a.u33 * a.u40 != 0 || a.u40 * a.u33 != 0
22 || a.u40 * a.u40 != 0)
23 abort ();
24 if (a.u33 * a.u41 != 0x10000000000ULL
25 || a.u40 * a.u41 != 0x10000000000ULL
26 || a.u41 * a.u33 != 0x10000000000ULL
27 || a.u41 * a.u40 != 0x10000000000ULL
28 || a.u41 * a.u41 != 0x10000000000ULL)
29 abort ();
30 if (b.u33 + b.u33 != 0)
31 abort ();
32 if (b.u33 + b.u40 != 0x200000000ULL
33 || b.u33 + b.u41 != 0x200000000ULL
34 || b.u40 + b.u33 != 0x200000000ULL
35 || b.u40 + b.u40 != 0x200000000ULL
36 || b.u40 + b.u41 != 0x200000000ULL
37 || b.u41 + b.u33 != 0x200000000ULL
38 || b.u41 + b.u40 != 0x200000000ULL
39 || b.u41 + b.u41 != 0x200000000ULL)
40 abort ();
41 if (a.u33 - b.u33 != 0x100100000ULL
42 || a.u33 - b.u40 != 0xFF00100000ULL
43 || a.u33 - b.u41 != 0x1FF00100000ULL
44 || a.u40 - b.u33 != 0xFF00100000ULL
45 || a.u40 - b.u40 != 0xFF00100000ULL
46 || a.u40 - b.u41 != 0x1FF00100000ULL
47 || a.u41 - b.u33 != 0x1FF00100000ULL
48 || a.u41 - b.u40 != 0x1FF00100000ULL
49 || a.u41 - b.u41 != 0x1FF00100000ULL)
50 abort ();
51 if (++c.u33 != 0 || --c.u40 != 0xFFFFFFFFFFULL || c.u41-- != 0)
52 abort ();
53 exit (0);