blob: f5554f6b1aea0fb16e21b8e6f6c2cd4159bbd894 (
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
28
29
30
31
32
33
34
35
36
|
/* { dg-do run } */
/* { dg-options "-O3 -fcilkplus" } */
/* FIXME: This test has been xfailed until reductions are fixed. */
#include <stdio.h>
#define ARRAY_SIZE (256)
int a[ARRAY_SIZE];
__attribute__((noinline))
int addit (int *arr, int N)
{
int s=0;
#pragma simd reduction (+:s)
for (int i = 0; i < N; i++)
s += arr[i];
return s;
}
int main () {
int i, s = 0, r = 0;
for (i = 0; i < ARRAY_SIZE; i++)
{
a[i] = i;
}
s = addit (a, ARRAY_SIZE);
for (i = 0; i < ARRAY_SIZE; i++)
r += i;
if (s == r)
return 0;
return 1;
}
|