summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/gomp/linear-3.C
blob: 0936cf89155a9800c8fd2e4953f4ad09280d3a55 (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
53
54
// { dg-do compile { target c++11 } }
// { dg-options "-fopenmp" }

int i;

#pragma omp declare simd linear (x : ref, step (1)) linear (y : step (2), uval)
int bar (int &x, int &y, int z);
#pragma omp declare simd linear (x : step (1), uval)
int baz (int &x, int y, int z);
#pragma omp declare simd linear (ref (x) : ref) uniform (ref)
int qux (int &x, int ref);
#pragma omp declare simd linear (x : ref, step (ref)) uniform (ref)
int corge (int &x, int ref);
#pragma omp declare simd linear (x : ref)
int grault (int &x);
#pragma omp declare simd linear (x : uval)
int waldo (int &x);
constexpr int step (int x) { return x; }

void
foo (int &x, int &y)
{
  #pragma omp simd linear (x: step (y + 1))
  for (i = 0; i < 10; i++)
    x += y + 1;
  #pragma omp simd linear (x: val, step (y + 1))
  for (i = 0; i < 10; i++)
    x += y + 1;
  #pragma omp parallel for linear (x: step (y + 1))
  for (i = 0; i < 10; i++)
    x += y + 1;
  #pragma omp parallel for linear (x: step (y + 1), val)
  for (i = 0; i < 10; i++)
    x += y + 1;
  #pragma omp parallel for simd linear (x: step (y + 1))
  for (i = 0; i < 10; i++)
    x += y + 1;
  #pragma omp parallel for simd linear (x: val, step (y + 1))
  for (i = 0; i < 10; i++)
    x += y + 1;
  #pragma omp parallel for simd linear (x: step (1) + 0)
  for (i = 0; i < 10; i++)
    x += step (1) + 0;
  {
    constexpr int ref = 1;
    constexpr int uval = 2;
    #pragma omp parallel for simd linear (x: ref + 0)
    for (i = 0; i < 10; i++)
      x += ref + 0;
    #pragma omp parallel for simd linear (x: uval * 1)
    for (i = 0; i < 10; i++)
      x += uval;
  }
}