1// { dg-require-effective-target vect_simd_clones }
2// { dg-additional-options "-fopenmp-simd -fno-inline" }
3// { dg-additional-options "-mavx" { target avx_runtime } }
4
5#include "../../gcc.dg/vect/tree-vect.h"
6
7struct S
8{
9  int s;
10  #pragma omp declare simd notinbranch linear(x)
11  int f (int x);
12};
13
14#pragma omp declare simd notinbranch linear(x)
15int
16S::f (int x)
17{
18  return x;
19}
20
21template <int N>
22struct T
23{
24  int t;
25  #pragma omp declare simd notinbranch linear(x)
26  int f (int x);
27};
28
29#pragma omp declare simd notinbranch linear(x)
30template <int N>
31int
32T<N>::f (int x)
33{
34  return x;
35}
36
37void
38do_main ()
39{
40  int i, r = 0;
41  S s;
42  T<0> t;
43  #pragma omp simd reduction(+:r)
44  for (i = 0; i < 64; i++)
45    r += s.f (i) + t.f (i);
46  if (r != 64 * 63)
47    abort ();
48}
49
50int
51main ()
52{
53  check_vect ();
54  do_main ();
55}
56