1 // RUN: %libomptarget-compile-aarch64-unknown-linux-gnu && env LIBOMPTARGET_DEBUG=1 %libomptarget-run-aarch64-unknown-linux-gnu 2>&1 | %fcheck-aarch64-unknown-linux-gnu -allow-empty -check-prefix=DEBUG
2 // RUN: %libomptarget-compile-powerpc64-ibm-linux-gnu && env LIBOMPTARGET_DEBUG=1 %libomptarget-run-powerpc64-ibm-linux-gnu 2>&1 | %fcheck-powerpc64-ibm-linux-gnu -allow-empty -check-prefix=DEBUG
3 // RUN: %libomptarget-compile-powerpc64le-ibm-linux-gnu && env LIBOMPTARGET_DEBUG=1 %libomptarget-run-powerpc64le-ibm-linux-gnu 2>&1 | %fcheck-powerpc64le-ibm-linux-gnu -allow-empty -check-prefix=DEBUG
4 // RUN: %libomptarget-compile-x86_64-pc-linux-gnu && env LIBOMPTARGET_DEBUG=1 %libomptarget-run-x86_64-pc-linux-gnu 2>&1 | %fcheck-x86_64-pc-linux-gnu -allow-empty -check-prefix=DEBUG
5 // RUN: %libomptarget-compile-nvptx64-nvidia-cuda && env LIBOMPTARGET_DEBUG=1 %libomptarget-run-nvptx64-nvidia-cuda 2>&1 | %fcheck-nvptx64-nvidia-cuda -allow-empty -check-prefix=DEBUG
6 // REQUIRES: libomptarget-debug
7 
8 /*
9   Test for the 'requires' clause check.
10   When a target region is used, the requires flags are set in the
11   runtime for the entire compilation unit. If the flags are set again,
12   (for whatever reason) the set must be consistent with previously
13   set values.
14 */
15 #include <stdio.h>
16 #include <omp.h>
17 
18 // ---------------------------------------------------------------------------
19 // Various definitions copied from OpenMP RTL
20 
21 extern void __tgt_register_requires(int64_t);
22 
23 // End of definitions copied from OpenMP RTL.
24 // ---------------------------------------------------------------------------
25 
run_reg_requires()26 void run_reg_requires() {
27   // Before the target region is registered, the requires registers the status
28   // of the requires clauses. Since there are no requires clauses in this file
29   // the flags state can only be OMP_REQ_NONE i.e. 1.
30 
31   // This is the 2nd time this function is called so it should print the debug
32   // info belonging to the check.
33   __tgt_register_requires(1);
34   __tgt_register_requires(1);
35   // DEBUG: New requires flags 1 compatible with existing 1!
36 }
37 
38 // ---------------------------------------------------------------------------
main()39 int main() {
40   run_reg_requires();
41 
42 // This also runs reg requires for the first time.
43 #pragma omp target
44   {}
45 
46   return 0;
47 }
48