Break circular dependency between FIR dialect and utilities
[llvm-project.git] / flang / test / Lower / OpenMP / ordered-threads.f90
blob3b896d24ea6d2280f2e8d90f0c6f93c1881d641a
1 ! This test checks lowering of OpenMP ordered directive with threads Clause.
2 ! Without clause in ordered direcitve, it behaves as if threads clause is
3 ! specified.
5 !RUN: %flang_fc1 -emit-fir -fopenmp %s -o - | FileCheck %s --check-prefix=FIRDialect
6 !RUN: %flang_fc1 -emit-fir -fopenmp %s -o - | fir-opt --fir-to-llvm-ir | FileCheck %s --check-prefix=LLVMIRDialect
7 !RUN: %flang_fc1 -emit-fir -fopenmp %s -o - | fir-opt --fir-to-llvm-ir | tco | FileCheck %s --check-prefix=LLVMIR
9 subroutine ordered
10 integer :: i
11 integer :: a(20)
13 !FIRDialect: omp.ordered_region {
14 !LLVMIRDialect: omp.ordered_region {
15 !LLVMIR: [[TMP0:%.*]] = call i32 @__kmpc_global_thread_num(ptr @[[GLOB0:[0-9]+]])
16 !LLVMIR-NEXT: call void @__kmpc_ordered(ptr @[[GLOB0]], i32 [[TMP0]])
17 !$OMP ORDERED
18 a(i) = a(i-1) + 1
19 !FIRDialect: omp.terminator
20 !FIRDialect-NEXT: }
21 !LLVMIRDialect: omp.terminator
22 !LLVMIRDialect-NEXT: }
23 !LLVMIR: call void @__kmpc_end_ordered(ptr @[[GLOB0]], i32 [[TMP0]])
24 !$OMP END ORDERED
26 !FIRDialect: omp.ordered_region {
27 !LLVMIRDialect: omp.ordered_region {
28 !LLVMIR: [[TMP1:%.*]] = call i32 @__kmpc_global_thread_num(ptr @[[GLOB1:[0-9]+]])
29 !LLVMIR-NEXT: call void @__kmpc_ordered(ptr @[[GLOB1]], i32 [[TMP1]])
30 !$OMP ORDERED THREADS
31 a(i) = a(i-1) + 1
32 !FIRDialect: omp.terminator
33 !FIRDialect-NEXT: }
34 !LLVMIRDialect: omp.terminator
35 !LLVMIRDialect-NEXT: }
36 !LLVMIR: call void @__kmpc_end_ordered(ptr @[[GLOB1]], i32 [[TMP1]])
37 !LLVMIR-NEXT: ret void
38 !$OMP END ORDERED
40 end