1 // RUN: %libomptarget-compile-run-and-check-generic
6 * Verify that for the target OpenMP APIs, the return address is non-null and
13 #include "callbacks.h"
14 #include "register_non_emi.h"
17 int dev
= omp_get_default_device();
18 int host
= omp_get_initial_device();
24 // Allocate space on the device
25 dev_ptr
= omp_target_alloc(sizeof(int), dev
);
30 if (omp_target_memcpy(dev_ptr
, &host_var1
, sizeof(int), 0, 0, dev
, host
))
34 if (omp_target_memcpy(dev_ptr
, dev_ptr
, sizeof(int), 0, 0, dev
, dev
))
38 if (omp_target_memcpy(&host_var2
, dev_ptr
, sizeof(int), 0, 0, host
, dev
))
41 // Free the device location
42 omp_target_free(dev_ptr
, dev
);
44 // Both host variables should have the same value.
45 return host_var1
!= host_var2
;
49 /// CHECK: Callback DataOp: target_id=[[TARGET_ID:[0-9]+]] host_op_id=[[HOST_OP_ID:[0-9]+]] optype=1
50 /// CHECK-SAME: src_device_num=[[HOST:[0-9]+]]
51 /// CHECK-SAME: dest_device_num=[[DEVICE:[0-9]+]]
52 /// CHECK-NOT: code=(nil)
53 /// CHECK: code=[[CODE1:0x[0-f]+]]
54 /// CHECK: Callback DataOp: target_id=[[TARGET_ID:[0-9]+]] host_op_id=[[HOST_OP_ID:[0-9]+]] optype=2
55 /// CHECK-SAME: src_device_num=[[HOST]] {{.+}} dest_device_num=[[DEVICE]]
56 /// CHECK-NOT: code=(nil)
57 /// CHECK-NOT: code=[[CODE1]]
58 /// CHECK: code=[[CODE2:0x[0-f]+]]
59 /// CHECK: Callback DataOp: target_id=[[TARGET_ID:[0-9]+]] host_op_id=[[HOST_OP_ID:[0-9]+]] optype=3
60 /// CHECK-SAME: src_device_num=[[DEVICE]] {{.+}} dest_device_num=[[DEVICE]]
61 /// CHECK-NOT: code=(nil)
62 /// CHECK-NOT: code=[[CODE2]]
63 /// CHECK: code=[[CODE3:0x[0-f]+]]
64 /// CHECK: Callback DataOp: target_id=[[TARGET_ID:[0-9]+]] host_op_id=[[HOST_OP_ID:[0-9]+]] optype=3
65 /// CHECK-SAME: src_device_num=[[DEVICE]] {{.+}} dest_device_num=[[HOST]]
66 /// CHECK-NOT: code=(nil)
67 /// CHECK-NOT: code=[[CODE3]]
68 /// CHECK: code=[[CODE4:0x[0-f]+]]
69 /// CHECK: Callback DataOp: target_id=[[TARGET_ID:[0-9]+]] host_op_id=[[HOST_OP_ID:[0-9]+]] optype=4
70 /// CHECK-NOT: code=(nil)
71 /// CHECK-NOT: code=[[CODE4]]