Update ChangeLog and version files for release
[official-gcc.git] / gcc / testsuite / gcc.target / aarch64 / pr68106.c
blobdc552ecce09c34497062c0207df52ef1dab98bfd
1 /* { dg-do run { target aarch64*-*-* } } */
2 /* { dg-options "-O" } */
4 typedef signed long long int S;
5 typedef unsigned long long int U;
6 typedef __int128 W;
7 __attribute__ ((noinline, noclone))
8 U upseu (U x, S y, int *ovf)
10 U res;
11 *ovf = __builtin_add_overflow (x, y, &res);
12 return res;
15 usueu (U x, U y, int *ovf)
17 U res;
18 *ovf = __builtin_sub_overflow (x, y, &res);
19 return res;
22 usseu (U x, S y, int *ovf)
24 U res;
25 *ovf = __builtin_sub_overflow (x, y, &res);
26 return res;
28 int
29 main ()
31 int i, j;
32 for (i = 0; i < ((unsigned char) ~0); i++)
33 for (j = 0; j < ((unsigned char) ~0); j++)
35 U u1 = ((W) i << ((8 - 1) * 8));
36 S s2 = ((W) j << ((8 - 1) * 8)) + (-0x7fffffffffffffffLL - 1);
37 U u2 = ((W) j << ((8 - 1) * 8));
38 W w;
39 int ovf;
40 w = ((W) u1) + ((W) s2);
41 if (upseu (u1, s2, &ovf) != (U) w || ovf != (w != (U) w))
42 __builtin_abort ();
43 w = ((W) u1) - ((W) u2);
44 if (usueu (u1, u2, &ovf) != (U) w || ovf != (w != (U) w))
45 __builtin_abort ();
46 w = ((W) u1) - ((W) s2);
47 if (usseu (u1, s2, &ovf) != (U) w || ovf != (w != (U) w))
48 __builtin_abort ();