Files
clang-p2996/openmp/libomptarget/test/offloading/bug51982.c
Johannes Doerfert e5a3d5ba88 [OpenMP][NFC] Enable more runtime tests and also run them with O3
The test run fine on my AMD GPU machine, we should verify them on others
too and put them into our regular testing. Not testing O1/2/3 is really
bad and not testing all architecturs is similarly problematic.

Differential Revision: https://reviews.llvm.org/D148576
2023-07-31 15:45:53 -07:00

26 lines
512 B
C

// RUN: %libomptarget-compile-generic -O1 && %libomptarget-run-generic
// -O1 to run openmp-opt
// RUN: %libomptarget-compileopt-generic -O1 && %libomptarget-run-generic
int main(void) {
long int aa = 0;
int ng = 12;
int nxyz = 5;
const long exp = ng * nxyz;
#pragma omp target map(tofrom : aa)
for (int gid = 0; gid < nxyz; gid++) {
#pragma omp parallel for
for (unsigned int g = 0; g < ng; g++) {
#pragma omp atomic
aa += 1;
}
}
if (aa != exp) {
return 1;
}
return 0;
}