OSDN Git Service

Backported from mainline
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / ext-elim-1.c
1 /* PR rtl-optimization/51924 */
2 /* Testcase by Zdenek Sojka <zsojka@seznam.cz> */
3
4 /* { dg-do run } */
5 /* { dg-options "-O -free -fno-rename-registers -ftree-vectorize -funroll-loops" } */
6
7 typedef __UINT64_TYPE__ uint64_t;
8
9 uint64_t __attribute__ ((noinline, noclone))
10 bn_sub_words (uint64_t * r, const uint64_t * a, const uint64_t * b, int n)
11 {
12   uint64_t t1, t2;
13   unsigned c = 0;
14
15   while (n)
16     {
17       t1 = a[0];
18       t2 = b[0];
19       r[0] = (t1 - t2 - c);
20       if (t1 != t2)
21         c = (t1 < t2);
22       a++;
23       b++;
24       r++;
25       n--;
26     }
27   return (c);
28 }
29
30 int
31 main (void)
32 {
33   uint64_t r[2];
34   uint64_t a[2] = { -1, -1 };
35   uint64_t b[2] = { 0, 0 };
36   if (bn_sub_words (r, a, b, 2) != 0)
37     __builtin_abort ();
38   return 0;
39 }