LLVM OpenMP 20.0.0git
omp__kmpc_fork_call_if.c
Go to the documentation of this file.
1// RUN: %libomp-compile && %t | FileCheck %s
2
3#include <stdio.h>
4#include <omp.h>
5
6typedef int32_t kmp_int32;
7typedef void *ident_t;
8typedef void *kmpc_micro;
9
10#ifdef __cplusplus
11extern "C" {
12#endif
13extern void __kmpc_fork_call_if(ident_t *loc, kmp_int32 argc,
15 void *args);
16#ifdef __cplusplus
17}
18#endif
19
20// Microtask function for parallel region
21void microtask(int *global_tid, int *bound_tid) {
22 // CHECK: PASS
23 if (omp_in_parallel()) {
24 printf("FAIL\n");
25 } else {
26 printf("PASS\n");
27 }
28}
29
30int 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, 0, microtask, cond, NULL);
35 return 0;
36}
void __kmpc_fork_call_if(ident_t *loc, kmp_int32 argc, kmpc_micro microtask, kmp_int32 cond, void *args)
#define args
void microtask(int *global_tid, int *bound_tid)
int32_t kmp_int32
void * kmpc_micro
void * ident_t
int main()
static id loc