Update concepts branch to revision 131834
[official-gcc.git] / gcc / testsuite / gcc.target / spu / muldivti3.c
blob0363e34207514eb28d08c026a28a05b4b61eabe6
1 /* { dg-do run } */
2 /* { dg-options "-std=c99" } */
3 #include <stdlib.h>
4 typedef unsigned int uqword __attribute__((mode(TI)));
5 typedef int qword __attribute__((mode(TI)));
7 typedef union
9 uqword uq;
10 qword q;
11 unsigned long long ull[2];
12 } u;
14 int main(void)
16 uqword e, f;
17 qword g, h;
19 e = 0x1111111111111111ULL;
20 f = 0xFULL;
21 g = 0x0000000000111100ULL;
22 h = 0x0000000000000000ULL;
24 u m, n, o, p, q;
26 m.ull[0] = f;
27 m.ull[1] = e;
28 n.ull[0] = h;
29 n.ull[1] = g;
31 /* __multi3 */
32 o.q = m.q * n.q;
34 o.q = o.q + n.q + 0x1110FF;
35 /* __udivti3, __umodti3 */
36 p.uq = o.uq / n.uq;
37 q.uq = o.uq % n.uq;
38 if (p.uq != (m.uq+1)) abort();
39 if (q.uq != 0x1110FF) abort();
40 /* __divti3, __modti3 */
41 p.q = -o.q / n.q;
42 q.q = -o.q % n.q;
43 if ((-p.q * n.q - q.q) != o.q) abort();
45 return 0;