mirror of
https://github.com/siemens-mobile-hacks/llvm-c166.git
synced 2026-11-25 21:45:57 +00:00
* Add a few tests for when a mapper does something like `map(s.p[0:10])` where `p` is a pointer. * Add a few tests that require propagation of bits like `present/always` into a mapper. * Fix a few tests that were expecting `p` to be mapped when the mapper only said `map(s.p[0:10])`. The output of a few tests is different from what we expect. They have been annotated with FIXMEs, and the expected output for when the follow-up changes in this stack to propagate the map-type-modifier bits and using attach-style mapping for mappers get merged. --------- Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
34 lines
623 B
C++
34 lines
623 B
C++
// RUN: %libomptarget-compile-run-and-check-generic
|
|
|
|
// UNSUPPORTED: intelgpu
|
|
|
|
#include <cstdio>
|
|
#include <cstdlib>
|
|
|
|
#define NUM 1024
|
|
|
|
class C {
|
|
public:
|
|
int *a;
|
|
};
|
|
|
|
#pragma omp declare mapper(id : C s) map(alloc : s.a) map(s.a[0 : NUM])
|
|
|
|
int main() {
|
|
C c;
|
|
c.a = (int *)malloc(sizeof(int) * NUM);
|
|
for (int i = 0; i < NUM; i++) {
|
|
c.a[i] = 1;
|
|
}
|
|
#pragma omp target teams distribute parallel for map(mapper(id), tofrom : c)
|
|
for (int i = 0; i < NUM; i++) {
|
|
++c.a[i];
|
|
}
|
|
int sum = 0;
|
|
for (int i = 0; i < NUM; i++) {
|
|
sum += c.a[i];
|
|
}
|
|
// CHECK: Sum = 2048
|
|
printf("Sum = %d\n", sum);
|
|
return 0;
|
|
}
|