]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/testsuite/c-c++-common/cilk-plus/PS/reduction-2.c
[Patch AArch64] Fixup floating point division with -march=armv8-a+nosimd
[thirdparty/gcc.git] / gcc / testsuite / c-c++-common / cilk-plus / PS / reduction-2.c
CommitLineData
c02065fc
AH
1/* { dg-do run } */
2/* { dg-options "-O3 -fcilkplus" } */
3
4/* FIXME: This test has been xfailed until reductions are fixed. */
5
6#include <stdio.h>
7
8#define ARRAY_SIZE (256)
9int a[ARRAY_SIZE];
10
11__attribute__((noinline))
12int addit (int *arr, int N)
13{
14 int s=0;
15#pragma simd reduction (+:s)
16 for (int i = 0; i < N; i++)
17 s += arr[i];
18 return s;
19}
20
21int main () {
22 int i, s = 0, r = 0;
23 for (i = 0; i < ARRAY_SIZE; i++)
24 {
25 a[i] = i;
26 }
27
28 s = addit (a, ARRAY_SIZE);
29
30 for (i = 0; i < ARRAY_SIZE; i++)
31 r += i;
32
33 if (s == r)
34 return 0;
35 return 1;
36}