Break circular dependency between FIR dialect and utilities
[llvm-project.git] / flang / test / Lower / OpenMP / critical.f90
blobc6ac818fe21aa6ee9fa141bc92514ae9d6c91cc5
1 !RUN: %flang_fc1 -emit-fir -fopenmp %s -o - | FileCheck %s --check-prefixes="OMPDialect"
2 !RUN: %flang_fc1 -emit-fir -fopenmp %s -o - | fir-opt --fir-to-llvm-ir | FileCheck %s --check-prefix="OMPDialect"
3 !RUN: %flang_fc1 -emit-fir -fopenmp %s -o - | fir-opt --fir-to-llvm-ir | tco | FileCheck %s --check-prefix="LLVMIR"
5 !OMPDialect: omp.critical.declare @help2 hint(none)
6 !OMPDialect: omp.critical.declare @help1 hint(contended)
8 subroutine omp_critical()
9 use omp_lib
10 integer :: x, y
11 !OMPDialect: omp.critical(@help1)
12 !LLVMIR: call void @__kmpc_critical_with_hint({{.*}}, {{.*}}, {{.*}} @{{.*}}help1.var, i32 2)
13 !$OMP CRITICAL(help1) HINT(omp_lock_hint_contended)
14 x = x + y
15 !OMPDialect: omp.terminator
16 !LLVMIR: call void @__kmpc_end_critical({{.*}}, {{.*}}, {{.*}} @{{.*}}help1.var)
17 !$OMP END CRITICAL(help1)
19 ! Test that the same name can be used again
20 ! Also test with the zero hint expression
21 !OMPDialect: omp.critical(@help2)
22 !LLVMIR: call void @__kmpc_critical_with_hint({{.*}}, {{.*}}, {{.*}} @{{.*}}help2.var, i32 0)
23 !$OMP CRITICAL(help2) HINT(omp_lock_hint_none)
24 x = x - y
25 !OMPDialect: omp.terminator
26 !LLVMIR: call void @__kmpc_end_critical({{.*}}, {{.*}}, {{.*}} @{{.*}}help2.var)
27 !$OMP END CRITICAL(help2)
29 !OMPDialect: omp.critical
30 !LLVMIR: call void @__kmpc_critical({{.*}}, {{.*}}, {{.*}} @{{.*}}_.var)
31 !$OMP CRITICAL
32 y = x + y
33 !OMPDialect: omp.terminator
34 !LLVMIR: call void @__kmpc_end_critical({{.*}}, {{.*}}, {{.*}} @{{.*}}_.var)
35 !$OMP END CRITICAL
36 end subroutine omp_critical