2013-10-21 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.dg / pr45415.c
blob12d9fc0f5a1c8eee818990641e9a152fedc00f19
1 /* { dg-do compile } */
2 /* { dg-options "-O1 -fno-tree-dominator-opts" } */
4 typedef unsigned long int st;
5 typedef unsigned long long dt;
6 typedef union
8 dt d;
9 struct
11 st h, l;
14 } t_be;
16 typedef union
18 dt d;
19 struct
21 st l, h;
24 } t_le;
26 #define df(f, t) \
27 int \
28 f (t afh, t bfh) \
29 { \
30 t hh; \
31 t hp, lp, dp, m; \
32 st ad, bd; \
33 int s; \
34 s = 0; \
35 ad = afh.s.h - afh.s.l; \
36 bd = bfh.s.l - bfh.s.h; \
37 if (bd > bfh.s.l) \
38 { \
39 bd = -bd; \
40 s = ~s; \
41 } \
42 lp.d = (dt) afh.s.l * bfh.s.l; \
43 hp.d = (dt) afh.s.h * bfh.s.h; \
44 dp.d = (dt) ad *bd; \
45 dp.d ^= s; \
46 hh.d = hp.d + hp.s.h + lp.s.h + dp.s.h; \
47 m.d = (dt) lp.s.h + hp.s.l + lp.s.l + dp.s.l; \
48 return hh.s.l + m.s.l; \
51 df(f_le, t_le)
52 df(f_be, t_be)
54 void abort (void);
55 void exit (int);
56 main ()
58 t_be x;
59 x.s.h = 0x10000000U;
60 x.s.l = 0xe0000000U;
61 if (x.d == 0x10000000e0000000ULL
62 && f_be ((t_be) 0x100000000ULL, (t_be) 0x100000000ULL) != -1)
63 abort ();
64 if (x.d == 0xe000000010000000ULL
65 && f_le ((t_le) 0x100000000ULL, (t_le) 0x100000000ULL) != -1)
66 abort ();
67 exit (0);