1 ! RUN: bbc -emit-fir -o - %s | FileCheck %s
3 ! CHECK-LABEL: loop_test
5 ! CHECK: %[[VAL_2:.*]] = fir.alloca i16 {bindc_name = "i"}
6 ! CHECK: %[[VAL_3:.*]] = fir.alloca i16 {bindc_name = "i"}
7 ! CHECK: %[[VAL_4:.*]] = fir.alloca i16 {bindc_name = "i"}
8 ! CHECK: %[[VAL_5:.*]] = fir.alloca i8 {bindc_name = "k"}
9 ! CHECK: %[[VAL_6:.*]] = fir.alloca i8 {bindc_name = "j"}
10 ! CHECK: %[[VAL_7:.*]] = fir.alloca i8 {bindc_name = "i"}
11 ! CHECK: %[[VAL_8:.*]] = fir.alloca i32 {bindc_name = "k"}
12 ! CHECK: %[[VAL_9:.*]] = fir.alloca i32 {bindc_name = "j"}
13 ! CHECK: %[[VAL_10:.*]] = fir.alloca i32 {bindc_name = "i"}
14 ! CHECK: %[[VAL_11:.*]] = fir.alloca !fir.array<5x5x5xi32> {bindc_name = "a", uniq_name = "_QFloop_testEa"}
15 ! CHECK: %[[VAL_12:.*]] = fir.alloca i32 {bindc_name = "asum", uniq_name = "_QFloop_testEasum"}
16 ! CHECK: %[[VAL_13:.*]] = fir.alloca i32 {bindc_name = "i", uniq_name = "_QFloop_testEi"}
17 ! CHECK: %[[VAL_14:.*]] = fir.alloca i32 {bindc_name = "j", uniq_name = "_QFloop_testEj"}
18 ! CHECK: %[[VAL_15:.*]] = fir.alloca i32 {bindc_name = "k", uniq_name = "_QFloop_testEk"}
19 ! CHECK: %[[VAL_16:.*]] = fir.alloca f32 {bindc_name = "x", uniq_name = "_QFloop_testEx"}
20 ! CHECK: %[[VAL_17:.*]] = fir.alloca i32 {bindc_name = "xsum", uniq_name = "_QFloop_testExsum"}
22 integer(4) :: a(5,5,5), i
, j
, k
, asum
, xsum
28 ! CHECK-COUNT-3: fir.do_loop {{.*}} unordered
29 do concurrent (i
=1:5, j
=1:5, k
=1:5) ! shared(a)
30 ! CHECK: fir.coordinate_of
33 ! CHECK: fir.call @_FortranAioBeginExternalListOutput
36 ! CHECK-COUNT-3: fir.do_loop {{.*}} unordered
38 do concurrent (integer(1)::i
=1:5, j
=1:5, k
=1:5, i
.ne
.j
.and
. k
.ne
.3) shared(a
)
39 ! CHECK-COUNT-2: fir.coordinate_of
40 a(i
,j
,k
) = a(i
,j
,k
) + 1
43 ! CHECK-COUNT-3: fir.do_loop {{[^un]*}} -> (index, i32)
48 ! CHECK: fir.coordinate_of
49 asum
= asum
+ a(i
,j
,k
)
53 ! CHECK: fir.call @_FortranAioBeginExternalListOutput
54 print*, 'B:', i
, j
, k
, '-', asum
56 ! CHECK: fir.do_loop {{.*}} unordered
57 ! CHECK-COUNT-2: fir.if
58 do concurrent (integer(2)::i
=1:5, i
.ne
.3)
59 if (i
.eq
.2 .or
. i
.eq
.4) goto 5 ! fir.if
60 ! CHECK: fir.call @_FortranAioBeginExternalListOutput
65 ! CHECK: fir.do_loop {{.*}} unordered
66 ! CHECK-COUNT-2: fir.if
67 do concurrent (integer(2)::i
=1:5, i
.ne
.3)
68 if (i
.eq
.2 .or
. i
.eq
.4) then ! fir.if
71 ! CHECK: fir.call @_FortranAioBeginExternalListOutput
76 ! CHECK-NOT: fir.do_loop
78 do concurrent (integer(2)::i
=1:5, i
.ne
.3)
80 ! CHECK: fir.call @_FortranAioBeginExternalListOutput
86 ! CHECK-NOT: fir.do_loop
90 ! CHECK: fir.call @_FortranAioBeginExternalFormattedOutput
91 print '(" F:",X,F3.1,A,I2)', x
, ' -', xsum
92 end subroutine loop_test
94 ! CHECK-LABEL: print_nothing
95 subroutine print_nothing(k1
, k2
)
97 ! CHECK: br [[header:\^bb[0-9]+]]
100 print*, k1
, k2
! no output
102 ! CHECK: br [[header]]
108 call print_nothing(2, 2)