summaryrefslogtreecommitdiffstats
path: root/polly/test/CodeGen/reduction.c
blob: 73a5e1e5381c76dc59199347991d49414beed53a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include <string.h>
#include <stdio.h>
#define N 1021

int main () {
  int i;
  int A[N];
  int red;

  memset(A, 0, sizeof(int) * N);

  A[0] = 1;
  A[1] = 1;
  red = 0;

  __sync_synchronize();

  for (i = 2; i < N; i++) {
    A[i] = A[i-1] + A[i-2];
    red += A[i-2];
  }

  __sync_synchronize();

  if (red != 382399368)
    return 1;
}
OpenPOWER on IntegriCloud