brintos

brintos / llvm-project-archived public Read only

0
0
Text · 512 B · b19707a Raw
26 lines · c
1// RUN: %libomptarget-compile-generic -O2 && %libomptarget-run-generic2// -O2 to run openmp-opt3// RUN: %libomptarget-compileopt-generic -O2 && %libomptarget-run-generic4 5int main(void) {6  long int aa = 0;7 8  int ng = 12;9  int nxyz = 5;10 11  const long exp = ng * nxyz;12 13#pragma omp target map(tofrom : aa)14  for (int gid = 0; gid < nxyz; gid++) {15#pragma omp parallel for16    for (unsigned int g = 0; g < ng; g++) {17#pragma omp atomic18      aa += 1;19    }20  }21  if (aa != exp) {22    return 1;23  }24  return 0;25}26