|
| 1 | +! Check that acc.terminator is not inserted in data construct |
| 2 | + |
| 3 | +! RUN: bbc -fopenacc -emit-hlfir %s -o - | FileCheck %s |
| 4 | + |
| 5 | +program main |
| 6 | + use, intrinsic :: iso_c_binding |
| 7 | + implicit none |
| 8 | + |
| 9 | + real(8), pointer :: a(:,:,:),b(:,:,:),c(:,:,:),c2(:,:,:) |
| 10 | + integer, parameter :: n1 = 400, n2 = 20 |
| 11 | + integer*4 :: stat |
| 12 | + integer :: i,j,k |
| 13 | + |
| 14 | + stat = 0 |
| 15 | + do i=1,n2 |
| 16 | + |
| 17 | + !$acc data copyin(a(:,:,i),b(:,:,i),c(:,:,i)) copyout(c2(:,:,i)) |
| 18 | + |
| 19 | + !$acc host_data use_device(a(:,:,i),b(:,:,i),c(:,:,i)) |
| 20 | + |
| 21 | + !$acc end host_data |
| 22 | + |
| 23 | + if ( stat .ne. 0 ) then |
| 24 | + print *, "stat = ",stat |
| 25 | + stop ! terminator here should be fir.unreachable |
| 26 | + end if |
| 27 | + |
| 28 | + !$acc parallel loop present(c(:,:,i),c2(:,:,i)) |
| 29 | + do j = 1,n1 |
| 30 | + do k = 1,n1 |
| 31 | + c2(k,j,i) = 1.5d0 * c(k,j,i) |
| 32 | + enddo |
| 33 | + enddo |
| 34 | + !$acc end parallel loop |
| 35 | + |
| 36 | + !$acc end data |
| 37 | + |
| 38 | + enddo |
| 39 | + |
| 40 | + !$acc wait |
| 41 | + |
| 42 | + deallocate(a,b,c,c2) |
| 43 | +end program |
| 44 | + |
| 45 | +! CHECK-LABEL: func.func @_QQmain() |
| 46 | +! CHECK: acc.data |
| 47 | +! CHECK: acc.host_data |
| 48 | +! CHECK: acc.terminator |
| 49 | +! CHECK: fir.call @_FortranAStopStatement |
| 50 | +! CHECK: fir.unreachable |
| 51 | +! CHECK: acc.parallel |
| 52 | +! CHECK-COUNT-3: acc.yield |
| 53 | +! CHECK: acc.terminator |
0 commit comments