brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.2 KiB · 11ad4a8 Raw
81 lines · c
1// --------------------------------------------------2// Check 'to' and extends before3// --------------------------------------------------4 5// RUN: %libomptarget-compile-generic \6// RUN:   -DCLAUSE=to -DEXTENDS=BEFORE7// RUN: %libomptarget-run-fail-generic 2>&1 \8// RUN: | %fcheck-generic9 10// --------------------------------------------------11// Check 'from' and extends before12// --------------------------------------------------13 14// RUN: %libomptarget-compile-generic \15// RUN:   -DCLAUSE=from -DEXTENDS=BEFORE16// RUN: %libomptarget-run-fail-generic 2>&1 \17// RUN: | %fcheck-generic18 19// --------------------------------------------------20// Check 'to' and extends after21// --------------------------------------------------22 23// RUN: %libomptarget-compile-generic \24// RUN:   -DCLAUSE=to -DEXTENDS=AFTER25// RUN: %libomptarget-run-fail-generic 2>&1 \26// RUN: | %fcheck-generic27 28// --------------------------------------------------29// Check 'from' and extends after30// --------------------------------------------------31 32// RUN: %libomptarget-compile-generic \33// RUN:   -DCLAUSE=from -DEXTENDS=AFTER34// RUN: %libomptarget-run-fail-generic 2>&1 \35// RUN: | %fcheck-generic36 37// END.38 39#include <stdio.h>40 41#define BEFORE 042#define AFTER 143 44#if EXTENDS == BEFORE45#define SMALL 2 : 346#define LARGE 0 : 547#elif EXTENDS == AFTER48#define SMALL 0 : 349#define LARGE 0 : 550#else51#error EXTENDS undefined52#endif53 54int main() {55  int arr[5];56 57  // CHECK: addr=0x[[#%x,HOST_ADDR:]], size=[[#%u,SIZE:]]58  fprintf(stderr, "addr=%p, size=%ld\n", arr, sizeof arr);59 60  // CHECK-NOT: omptarget61#pragma omp target data map(alloc : arr[LARGE])62  {63#pragma omp target update CLAUSE(present : arr[SMALL])64  }65 66  // CHECK: arr is present67  fprintf(stderr, "arr is present\n");68 69  // CHECK: omptarget message: device mapping required by 'present' motion modifier does not exist for host address 0x{{0*}}[[#HOST_ADDR]] ([[#SIZE]] bytes)70  // CHECK: omptarget fatal error 1: failure of target construct while offloading is mandatory71#pragma omp target data map(alloc : arr[SMALL])72  {73#pragma omp target update CLAUSE(present : arr[LARGE])74  }75 76  // CHECK-NOT: arr is present77  fprintf(stderr, "arr is present\n");78 79  return 0;80}81