| 1 |
TYPE __attribute__ ((noinline)) |
| 2 |
foo_sign (int *__restrict__ a, int *__restrict__ b, TYPE l, TYPE n) |
| 3 |
{ |
| 4 |
TYPE i; |
| 5 |
for (i = l; n < i; i += C) |
| 6 |
*a++ = *b++ + 1; |
| 7 |
return i; |
| 8 |
} |
| 9 |
|
| 10 |
TYPE __attribute__ ((noinline)) |
| 11 |
bar_sign (int *__restrict__ a, int *__restrict__ b, TYPE l, TYPE n) |
| 12 |
{ |
| 13 |
TYPE i; |
| 14 |
for (i = l; i < n; i -= C) |
| 15 |
*a++ = *b++ + 1; |
| 16 |
return i; |
| 17 |
} |
| 18 |
|
| 19 |
int __attribute__ ((noinline)) neq (int a, int b) { return a != b; } |
| 20 |
|
| 21 |
int a[1000], b[1000]; |
| 22 |
int fail; |
| 23 |
|
| 24 |
int |
| 25 |
main () |
| 26 |
{ |
| 27 |
TYPE res; |
| 28 |
TYPE l; |
| 29 |
TYPE n; |
| 30 |
n = N_BASE; |
| 31 |
l = n - C; |
| 32 |
res = foo_sign (a, b, l, n); |
| 33 |
if (res != l) |
| 34 |
fail++; |
| 35 |
|
| 36 |
l = n; |
| 37 |
res = foo_sign (a, b, l, n); |
| 38 |
if (res != l) |
| 39 |
fail++; |
| 40 |
|
| 41 |
l = n + C; |
| 42 |
res = foo_sign (a, b, l, n); |
| 43 |
if (neq ((res - MIN) / C, 0)) |
| 44 |
fail++; |
| 45 |
|
| 46 |
n = N_BASE_DOWN; |
| 47 |
l = n - C; |
| 48 |
res = bar_sign (a, b, l, n); |
| 49 |
if (neq ((MAX - res) / C, 0)) |
| 50 |
fail++; |
| 51 |
|
| 52 |
l = n; |
| 53 |
res = bar_sign (a, b, l, n); |
| 54 |
if (res != l) |
| 55 |
fail++; |
| 56 |
|
| 57 |
l = n + C; |
| 58 |
res = bar_sign (a, b, l, n); |
| 59 |
if (res != l) |
| 60 |
fail++; |
| 61 |
|
| 62 |
if (fail) |
| 63 |
__builtin_abort (); |
| 64 |
return 0; |
| 65 |
} |