| 1 | // RUN: %libomp-compile && %t | FileCheck %s |
| 2 | |
| 3 | #include <stdio.h> |
| 4 | #include <omp.h> |
| 5 | |
| 6 | typedef int32_t kmp_int32; |
| 7 | typedef void *ident_t; |
| 8 | typedef void *kmpc_micro; |
| 9 | |
| 10 | #ifdef __cplusplus |
| 11 | extern "C" { |
| 12 | #endif |
| 13 | extern void __kmpc_fork_call_if(ident_t *loc, kmp_int32 argc, |
| 14 | kmpc_micro microtask, kmp_int32 cond, |
| 15 | void *args); |
| 16 | #ifdef __cplusplus |
| 17 | } |
| 18 | #endif |
| 19 | |
| 20 | // Microtask function for parallel region |
| 21 | void microtask(int *global_tid, int *bound_tid) { |
| 22 | // CHECK: PASS |
| 23 | if (omp_in_parallel()) { |
| 24 | printf(format: "FAIL\n" ); |
| 25 | } else { |
| 26 | printf(format: "PASS\n" ); |
| 27 | } |
| 28 | } |
| 29 | |
| 30 | int main() { |
| 31 | // Condition for parallelization (false in this case) |
| 32 | int cond = 0; |
| 33 | // Call __kmpc_fork_call_if |
| 34 | __kmpc_fork_call_if(NULL, argc: 0, microtask, cond, NULL); |
| 35 | return 0; |
| 36 | } |
| 37 | |