PR tree-optimization/81384 - built-in form of strnlen missing
[official-gcc.git] / gcc / testsuite / gcc.c-torture / execute / usad-run.c
blob904a634a497688eda6331845e2bf2805aa8a7991
1 extern void abort ();
2 extern int abs (int __x) __attribute__ ((__nothrow__, __leaf__)) __attribute__ ((__const__));
4 static int
5 foo (unsigned char *w, int i, unsigned char *x, int j)
7 int tot = 0;
8 for (int a = 0; a < 16; a++)
10 for (int b = 0; b < 16; b++)
11 tot += abs (w[b] - x[b]);
12 w += i;
13 x += j;
15 return tot;
18 void
19 bar (unsigned char *w, unsigned char *x, int i, int *result)
21 *result = foo (w, 16, x, i);
24 int
25 main (void)
27 unsigned char m[256];
28 unsigned char n[256];
29 int sum, i;
31 for (i = 0; i < 256; ++i)
32 if (i % 2 == 0)
34 m[i] = (i % 8) * 2 + 1;
35 n[i] = -(i % 8);
37 else
39 m[i] = -((i % 8) * 2 + 2);
40 n[i] = -((i % 8) >> 1);
43 bar (m, n, 16, &sum);
45 if (sum != 32384)
46 abort ();
48 return 0;