aboutsummaryrefslogtreecommitdiff
path: root/libgomp/testsuite/libgomp.c/target-44.c
blob: a5da81d7e2373d3f91e274202b430c079a2e89c1 (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
/* { dg-additional-options "-foffload-options=nvptx-none=-latomic" { target { offload_target_nvptx } } } */

#include <stdlib.h>

struct s
{
  int i;
};

#pragma omp declare reduction(+: struct s: omp_out.i += omp_in.i)

int
main (void)
{
  const int N0 = 32768;

  struct s counter_N0 = { 0 };
#pragma omp target
#pragma omp for simd reduction(+: counter_N0)
  for (int i0 = 0 ; i0 < N0 ; i0++ )
    counter_N0.i += 1;

  if (counter_N0.i != N0)
    abort ();

  return 0;
}