1 // Basic offloading test for function compiled with flang
2 // REQUIRES: flang, amdgcn-amd-amdhsa
4 // RUN: %flang -c -fopenmp -fopenmp-targets=amdgcn-amd-amdhsa \
5 // RUN: %S/../../Inputs/basic_array.f90 -o basic_array.o
6 // RUN: %libomptarget-compile-generic basic_array.o
7 // RUN: %t | %fcheck-generic
10 #define TEST_ARR_LEN 10
12 #pragma omp declare target
13 void increment_at(int i
, int *array
);
14 #pragma omp end declare target
16 void increment_array(int *b
, int n
) {
17 #pragma omp target map(tofrom : b [0:n])
18 for (int i
= 0; i
< n
; i
++) {
24 int arr
[TEST_ARR_LEN
] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
26 increment_array(arr
, TEST_ARR_LEN
);
27 for (int i
= 0; i
< TEST_ARR_LEN
; i
++) {
28 printf("%d = %d\n", i
, arr
[i
]);