Handle T_HRESULT types in CodeView records
[official-gcc.git] / gcc / testsuite / gcc.target / powerpc / ti_math2.c
blobb9c03300d8463ed8f9090b13847951ad536704f2
1 /* { dg-do run { target { powerpc*-*-* && lp64 } } } */
2 /* { dg-options "-O2 -fno-inline" } */
4 union U {
5 __int128 i128;
6 struct {
7 long l1;
8 long l2;
9 } s;
12 union U u1,u2;
14 __int128
15 create_128 (long most_sig, long least_sig)
17 union U u;
19 #if __LITTLE_ENDIAN__
20 u.s.l1 = least_sig;
21 u.s.l2 = most_sig;
22 #else
23 u.s.l1 = most_sig;
24 u.s.l2 = least_sig;
25 #endif
26 return u.i128;
29 long most_sig (union U * u)
31 #if __LITTLE_ENDIAN__
32 return (*u).s.l2;
33 #else
34 return (*u).s.l1;
35 #endif
38 long least_sig (union U * u)
40 #if __LITTLE_ENDIAN__
41 return (*u).s.l1;
42 #else
43 return (*u).s.l2;
44 #endif
47 __int128
48 add_128 (__int128 *ptr, __int128 val)
50 return (*ptr + val);
53 __int128
54 sub_128 (__int128 *ptr, __int128 val)
56 return (*ptr - val);
59 int
60 main (void)
62 /* Do a simple add/sub to make sure carry is happening between the dwords
63 and that dwords are in correct endian order. */
64 u1.i128 = create_128 (1, -1);
65 u2.i128 = add_128 (&u1.i128, 1);
66 if ((most_sig (&u2) != 2) || (least_sig (&u2) != 0))
67 __builtin_abort ();
68 u2.i128 = sub_128 (&u2.i128, 1);
69 if ((most_sig (&u2) != 1) || (least_sig (&u2) != -1))
70 __builtin_abort ();
71 return 0;