Files
clang-p2996/openmp/libomptarget/test/offloading/global_constructor.cpp
Joseph Huber 9d3550c517 [OpenMP] Add AMDGPU calling convention to ctor / dtor functions
This patch adds the necessary AMDGPU calling convention to the ctor /
dtor kernels. These are fundamentally device kenels called by the host
on image load. Without this calling convention information the AMDGPU
plugin is unable to identify them.

Depends on D122504

Fixes #54091

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D122515
2022-03-25 22:44:20 -04:00

26 lines
350 B
C++

// RUN: %libomptarget-compilexx-generic && %libomptarget-run-generic | %fcheck-generic
#include <cstdio>
int foo() { return 1; }
class C {
public:
C() : x(foo()) {}
int x;
};
C c;
#pragma omp declare target(c)
int main() {
int x = 0;
#pragma omp target map(from : x)
{ x = c.x; }
// CHECK: PASS
if (x == 1)
printf("PASS\n");
}