Files
llvm-project/offload/test/offloading/target_constexpr_mapping.cpp
fineg74 1611a23a5b [OFFLOAD] Add spirv implementation for named barrier (#180393)
This change adds implementation for named barriers for SPIRV backend.
Since there is no built in API/intrinsics for named barrier in SPIRV,
the implementation loosely follows implementation for AMD
2026-03-27 20:14:09 +01:00

35 lines
623 B
C++

// RUN: %libomptarget-compileoptxx-run-and-check-generic
#include <omp.h>
#include <stdio.h>
#pragma omp declare target
class A {
public:
constexpr static double pi = 3.141592653589793116;
A() { ; }
~A() { ; }
};
#pragma omp end declare target
#pragma omp declare target
constexpr static double anotherPi = 3.14;
#pragma omp end declare target
int main() {
double a[2];
#pragma omp target map(tofrom : a[:2])
{
a[0] = A::pi;
a[1] = anotherPi;
}
// CHECK: pi = 3.141592653589793116
printf("pi = %.18f\n", a[0]);
// CHECK: anotherPi = 3.14
printf("anotherPi = %.2f\n", a[1]);
return 0;
}