PR inline-asm/84742
[official-gcc.git] / gcc / testsuite / gcc.target / spu / subti3.c
blob4112c958cc380e12a1fdd25b01be5b0154cee7c8
1 /* { dg-do run } */
2 /* { dg-options "-std=c99" } */
3 #include <stdlib.h>
4 typedef int TItype __attribute__ ((mode (TI)));
5 typedef int DItype __attribute__ ((mode (DI)));
6 typedef unsigned int UDItype __attribute__ ((mode (DI)));
8 struct DIstruct {DItype high, low;};
9 typedef union
11 struct DIstruct s;
12 TItype t;
13 } TIunion;
15 static
16 void sub_ddmmss (UDItype *sh, UDItype *sl, UDItype ah, UDItype al, UDItype bh, UDItype bl)
18 UDItype x;
19 x = al - bl;
20 *sh = ah - bh - (x > al);
21 *sl = x;
24 int main(void)
26 TIunion aa, bb, cc;
27 TItype m = 0x1111111111111110ULL;
28 TItype n = 0x1111111111111111ULL;
29 TItype d;
31 aa.s.high = m;
32 aa.s.low = m;
33 bb.s.high = n;
34 bb.s.low = n;
37 sub_ddmmss (&cc.s.high, &cc.s.low, aa.s.high, aa.s.low, bb.s.high, bb.s.low);
38 d = aa.t - bb.t;
39 if (d != cc.t)
40 abort();
41 cc.t = aa.t -d;
42 if (cc.t != bb.t)
43 abort();
44 return 0;