brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.2 KiB · ca932c1 Raw
42 lines · plain
1! RUN: bbc -fopenacc -emit-hlfir %s -o - | FileCheck %s2 3! Verify collapse(force:2) sinks prologue (between loops) and epilogue (after inner loop)4! into the acc.loop region body.5 6subroutine collapse_force_sink(n, m)7  integer, intent(in) :: n, m8  real, dimension(n,m) :: a9  real, dimension(n) :: bb, cc10  integer :: i, j11 12  !$acc parallel loop collapse(force:2)13  do i = 1, n14    bb(i) = 4.2     ! prologue (between loops)15    do j = 1, m16      a(i,j) = a(i,j) + 2.017    end do18    cc(i) = 7.3     ! epilogue (after inner loop)19  end do20  !$acc end parallel loop21end subroutine22 23! CHECK: func.func @_QPcollapse_force_sink(24! CHECK: acc.parallel25! Ensure outer acc.loop is combined(parallel)26! CHECK: acc.loop combined(parallel)27! Prologue: constant 4.2 and an assign before inner loop28! CHECK: arith.constant 4.200000e+0029! CHECK: hlfir.assign30! Inner loop and its body include 2.0 add and an assign31! CHECK: acc.loop32! CHECK: arith.constant 2.000000e+0033! CHECK: arith.addf34! CHECK: hlfir.assign35! Epilogue: constant 7.3 and an assign after inner loop36! CHECK: arith.constant 7.300000e+0037! CHECK: hlfir.assign38! And the outer acc.loop has collapse = [2]39! CHECK: } attributes {collapse = [2]40 41 42