1! This test checks that chunk size is passed correctly when lowering of 2! OpenMP DO Directive(Worksharing) with chunk size 3 4! RUN: bbc -fopenmp -emit-hlfir %s -o - | FileCheck %s 5 6program wsloop 7 integer :: i 8 integer :: chunk 9 10! CHECK-LABEL: func.func @_QQmain() attributes {fir.bindc_name = "wsloop"} { 11! CHECK: %[[CHUNK_REF:.*]] = fir.alloca i32 {bindc_name = "chunk", uniq_name = "_QFEchunk"} 12! CHECK: %[[VAL_0:.*]]:2 = hlfir.declare %[[CHUNK_REF]] {uniq_name = "_QFEchunk"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>) 13 14!$OMP DO SCHEDULE(static, 4) 15 16do i=1, 9 17 print*, i 18 19! CHECK: %[[VAL_2:.*]] = arith.constant 4 : i32 20! CHECK: %[[VAL_3:.*]] = arith.constant 1 : i32 21! CHECK: %[[VAL_4:.*]] = arith.constant 9 : i32 22! CHECK: %[[VAL_5:.*]] = arith.constant 1 : i32 23! CHECK: omp.wsloop nowait schedule(static = %[[VAL_2]] : i32) { 24! CHECK-NEXT: omp.loop_nest (%[[ARG0:.*]]) : i32 = (%[[VAL_3]]) to (%[[VAL_4]]) inclusive step (%[[VAL_5]]) { 25! CHECK: fir.store %[[ARG0]] to %[[STORE_IV:.*]]#1 : !fir.ref<i32> 26! CHECK: %[[LOAD_IV:.*]] = fir.load %[[STORE_IV]]#0 : !fir.ref<i32> 27! CHECK: {{.*}} = fir.call @_FortranAioOutputInteger32({{.*}}, %[[LOAD_IV]]) {{.*}}: (!fir.ref<i8>, i32) -> i1 28! CHECK: omp.yield 29! CHECK: } 30! CHECK: } 31 32end do 33!$OMP END DO NOWAIT 34!$OMP DO SCHEDULE(static, 2+2) 35 36do i=1, 9 37 print*, i*2 38 39! CHECK: %[[VAL_14:.*]] = arith.constant 4 : i32 40! CHECK: %[[VAL_15:.*]] = arith.constant 1 : i32 41! CHECK: %[[VAL_16:.*]] = arith.constant 9 : i32 42! CHECK: %[[VAL_17:.*]] = arith.constant 1 : i32 43! CHECK: omp.wsloop nowait schedule(static = %[[VAL_14]] : i32) { 44! CHECK-NEXT: omp.loop_nest (%[[ARG1:.*]]) : i32 = (%[[VAL_15]]) to (%[[VAL_16]]) inclusive step (%[[VAL_17]]) { 45! CHECK: fir.store %[[ARG1]] to %[[STORE_IV1:.*]]#1 : !fir.ref<i32> 46! CHECK: %[[VAL_24:.*]] = arith.constant 2 : i32 47! CHECK: %[[LOAD_IV1:.*]] = fir.load %[[STORE_IV1]]#0 : !fir.ref<i32> 48! CHECK: %[[VAL_25:.*]] = arith.muli %[[VAL_24]], %[[LOAD_IV1]] : i32 49! CHECK: {{.*}} = fir.call @_FortranAioOutputInteger32({{.*}}, %[[VAL_25]]) {{.*}}: (!fir.ref<i8>, i32) -> i1 50! CHECK: omp.yield 51! CHECK: } 52! CHECK: } 53 54end do 55!$OMP END DO NOWAIT 56chunk = 6 57!$OMP DO SCHEDULE(static, chunk) 58 59do i=1, 9 60 print*, i*3 61end do 62!$OMP END DO NOWAIT 63! CHECK: %[[VAL_28:.*]] = arith.constant 6 : i32 64! CHECK: hlfir.assign %[[VAL_28]] to %[[VAL_0]]#0 : i32, !fir.ref<i32> 65! CHECK: %[[VAL_29:.*]] = fir.load %[[VAL_0]]#0 : !fir.ref<i32> 66! CHECK: %[[VAL_30:.*]] = arith.constant 1 : i32 67! CHECK: %[[VAL_31:.*]] = arith.constant 9 : i32 68! CHECK: %[[VAL_32:.*]] = arith.constant 1 : i32 69! CHECK: omp.wsloop nowait schedule(static = %[[VAL_29]] : i32) { 70! CHECK-NEXT: omp.loop_nest (%[[ARG2:.*]]) : i32 = (%[[VAL_30]]) to (%[[VAL_31]]) inclusive step (%[[VAL_32]]) { 71! CHECK: fir.store %[[ARG2]] to %[[STORE_IV2:.*]]#1 : !fir.ref<i32> 72! CHECK: %[[VAL_39:.*]] = arith.constant 3 : i32 73! CHECK: %[[LOAD_IV2:.*]] = fir.load %[[STORE_IV2]]#0 : !fir.ref<i32> 74! CHECK: %[[VAL_40:.*]] = arith.muli %[[VAL_39]], %[[LOAD_IV2]] : i32 75! CHECK: {{.*}} = fir.call @_FortranAioOutputInteger32({{.*}}, %[[VAL_40]]) {{.*}}: (!fir.ref<i8>, i32) -> i1 76! CHECK: omp.yield 77! CHECK: } 78! CHECK: } 79! CHECK: return 80! CHECK: } 81 82end 83