aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cilk-plus/pragma_simd_tests/compile/tst1.cc
blob: b726af792dafb780352c9403838930a649752099 (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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/* { dg-do compile } */
/* { dg-options "-fcilkplus -O3 -w" } */

#define VLEN 4

/* The clauses really doesn't make sense in this, the main thing this code
   is checking is to see if it can catch the for-loop  correctly after
   the clauses, and compile successfully.  */
int main (void)
{
  int array[1000];
  int i, nphi = 100, w;


#pragma simd vectorlength(VLEN) reduction(+:w) 
for (i = 0; i < nphi; i++) 
{
  w += array[i];
}

#pragma simd reduction(+:w) vectorlength (VLEN)
for (i = 0; i < nphi; i++) 
{
  w += array[i];
}

#pragma simd vectorlength (VLEN) private(array)
for (i = 0; i < nphi; i++) 
{
  w += array[i];
}

#pragma simd reduction(+:w) noassert
for (i = 0; i < nphi; i++) 
{
  w += array[i];
}

#pragma simd vectorlength(VLEN) linear(nphi:1)
for (i = 0; i < nphi; i++) 
{
  w += array[i];
}

#pragma simd linear(nphi) vectorlength(VLEN) linear(nphi:1)
for (i = 0; i < nphi; i++) 
{
  w += array[i];
}
return w;
}