| 1 |
! { dg-do compile } |
| 2 |
! { dg-additional-options "-fdump-tree-original" } |
| 3 |
! { dg-additional-options "-fdump-tree-gimple" } |
| 4 |
|
| 5 |
program test |
| 6 |
implicit none |
| 7 |
integer, parameter :: N = 100 |
| 8 |
real :: a(N) |
| 9 |
|
| 10 |
!$omp target map(from: a) |
| 11 |
call f (a, 3.14159) |
| 12 |
!$omp end target |
| 13 |
|
| 14 |
call f (a, 2.71828) |
| 15 |
contains |
| 16 |
subroutine f (a, x) |
| 17 |
integer :: i |
| 18 |
real :: a(N), x |
| 19 |
!$omp declare target |
| 20 |
|
| 21 |
!$omp metadirective & |
| 22 |
!$omp& when (construct={target}: distribute parallel do ) & |
| 23 |
!$omp& default(parallel do simd) |
| 24 |
do i = 1, N |
| 25 |
a(i) = x * i |
| 26 |
end do |
| 27 |
end subroutine |
| 28 |
end program |
| 29 |
|
| 30 |
! The metadirective should be resolved during Gimplification. |
| 31 |
|
| 32 |
! { dg-final { scan-tree-dump-times "#pragma omp metadirective" 1 "original" } } |
| 33 |
! { dg-final { scan-tree-dump-times "when \\(construct = .*target.*\\):" 1 "original" } } |
| 34 |
! { dg-final { scan-tree-dump-times "otherwise:" 1 "original" } } |
| 35 |
! { dg-final { scan-tree-dump-times "#pragma omp parallel" 2 "original" } } |
| 36 |
|
| 37 |
! { dg-final { scan-tree-dump-not "#pragma omp metadirective" "gimple" } } |