Break circular dependency between FIR dialect and utilities
[llvm-project.git] / flang / test / Semantics / OpenMP / do18.f90
blobcdac323240eebef35050ddfe6593264a0039fe84
1 ! RUN: %flang_fc1 -fdebug-unparse-with-symbols %s 2>&1 | FileCheck %s
2 ! RUN: %flang_fc1 -fopenmp -fdebug-unparse-with-symbols %s 2>&1 | FileCheck %s
3 ! CHECK-NOT: do *[1-9]
5 program P
6 implicit none
7 integer OMP_GET_NUM_THREADS, OMP_GET_THREAD_NUM
8 integer NUMTHRDS, TID
9 integer N, CSZ, CNUM, I
10 parameter (N=100)
11 parameter (CSZ=10)
12 real A(N), B(N), C(N)
14 do 10 I = 1, N
15 A(I) = I * 1.0
16 10 continue
18 B = A
19 CNUM = CSZ
21 !$OMP PARALLEL SHARED(A,B,C,NUMTHRDS,CNUM) PRIVATE(I,TID)
22 TID = OMP_GET_THREAD_NUM()
23 if (TID .EQ. 0) then
24 NUMTHRDS = OMP_GET_NUM_THREADS()
25 print *, "Number of threads =", NUMTHRDS
26 end if
27 print *, "Thread", TID, " is starting..."
29 !$OMP DO SCHEDULE(DYNAMIC,CNUM)
30 do 20 I = 1, N
31 C(I) = A(I) + B(I)
32 write (*,100) TID, I, C(I)
33 20 continue
34 !$OMP END DO NOWAIT
36 print *, "Thread", TID, " done."
38 !$OMP END PARALLEL
39 100 format(" Thread", I2, ": C(", I3, ")=", F8.2)
40 end program P