xref: /llvm-project/flang/test/Lower/OpenMP/omp-lib-num-threads.f90 (revision bfeebda3b1cc1a05e435e94f54bf2d2a2570b4e2)
1! REQUIRES: openmp_runtime
2
3! RUN: %flang_fc1 -emit-hlfir %openmp_flags %s -o - 2>&1 | FileCheck %s
4! RUN: bbc %openmp_flags -emit-hlfir -o - %s 2>&1 | FileCheck %s
5! RUN: %flang_fc1 -emit-fir %openmp_flags %s -o - 2>&1 | FileCheck %s
6! RUN: bbc -emit-fir %openmp_flags -o - %s 2>&1 | FileCheck %s
7!
8! Test that the calls to omp_lib's omp_get_num_threads and omp_set_num_threads
9! get lowered even though their implementation is not in the omp_lib module
10! (and this matters because this is an intrinsic module - and calls to
11! intrinsics are specially resolved).
12
13program main
14  use omp_lib
15  integer(omp_integer_kind) :: num_threads
16  integer(omp_integer_kind), parameter :: requested_num_threads = 4
17  call omp_set_num_threads(requested_num_threads)
18  num_threads = omp_get_num_threads()
19  print *, num_threads
20end program
21
22!CHECK-NOT: not yet implemented: intrinsic: omp_set_num_threads
23!CHECK-NOT: not yet implemented: intrinsic: omp_get_num_threads
24!CHECK: fir.call @omp_set_num_threads
25!CHECK: fir.call @omp_get_num_threads
26