| 1 |
! { dg-additional-options "-fdump-tree-original -fdump-tree-gimple" } |
| 2 |
|
| 3 |
subroutine f |
| 4 |
implicit none |
| 5 |
type t |
| 6 |
integer :: i |
| 7 |
end type t |
| 8 |
integer, target :: scalar |
| 9 |
integer, target :: array(5) |
| 10 |
integer, pointer :: ptr1, ptr2(:) |
| 11 |
integer, allocatable :: alloc1, alloc2(:) |
| 12 |
type(t) :: agg1, agg2(2) |
| 13 |
|
| 14 |
scalar = 1 |
| 15 |
array = [1,2,3,4,5] |
| 16 |
ptr1 => scalar |
| 17 |
ptr2 => array |
| 18 |
alloc1 = 5 |
| 19 |
alloc2 = [1,2] |
| 20 |
agg1%i = 1 |
| 21 |
agg2(:)%i = [1,2] |
| 22 |
|
| 23 |
! firstprivate + unspecified modifer. |
| 24 |
!$omp target defaultmap(firstprivate) |
| 25 |
block |
| 26 |
scalar = 1; |
| 27 |
array(1) = 2; |
| 28 |
if (associated(ptr1)) & |
| 29 |
agg1%i = 3; |
| 30 |
if (associated(ptr2)) & |
| 31 |
agg2(1)%i = 3; |
| 32 |
if (allocated(alloc1)) & |
| 33 |
alloc2(1) = 0 |
| 34 |
end block |
| 35 |
|
| 36 |
! equivalent: firstprivate + ALL modifer. |
| 37 |
!$omp target defaultmap(firstprivate : all) |
| 38 |
block |
| 39 |
scalar = 1; |
| 40 |
array(1) = 2; |
| 41 |
if (associated(ptr1)) & |
| 42 |
agg1%i = 3; |
| 43 |
if (associated(ptr2)) & |
| 44 |
agg2(1)%i = 3; |
| 45 |
if (allocated(alloc1)) & |
| 46 |
alloc2(1) = 0 |
| 47 |
end block |
| 48 |
|
| 49 |
! tofrom + ALL modifer. |
| 50 |
!$omp target defaultmap(tofrom : all) |
| 51 |
block |
| 52 |
scalar = 1; |
| 53 |
array(1) = 2; |
| 54 |
if (associated(ptr1)) & |
| 55 |
agg1%i = 3; |
| 56 |
if (associated(ptr2)) & |
| 57 |
agg2(1)%i = 3; |
| 58 |
if (allocated(alloc1)) & |
| 59 |
alloc2(1) = 0 |
| 60 |
end block |
| 61 |
end subroutine |
| 62 |
|
| 63 |
! { dg-final { scan-tree-dump-times "#pragma omp target defaultmap\\(firstprivate\\)" 1 "original" } } |
| 64 |
! { dg-final { scan-tree-dump-times "#pragma omp target defaultmap\\(firstprivate:all\\)" 1 "original" } } |
| 65 |
! { dg-final { scan-tree-dump-times "#pragma omp target defaultmap\\(tofrom:all\\)" 1 "original" } } |
| 66 |
|
| 67 |
! { dg-final { scan-tree-dump-times "#pragma omp target.* defaultmap\\(firstprivate\\) firstprivate\\(scalar\\) firstprivate\\(ptr2\\) firstprivate\\(ptr1\\) firstprivate\\(array\\) firstprivate\\(alloc2\\) firstprivate\\(alloc1\\) firstprivate\\(agg2\\) firstprivate\\(agg1\\)" 1 "gimple" } } |
| 68 |
|
| 69 |
! { dg-final { scan-tree-dump-times "#pragma omp target.* defaultmap\\(firstprivate:all\\) firstprivate\\(scalar\\) firstprivate\\(ptr2\\) firstprivate\\(ptr1\\) firstprivate\\(array\\) firstprivate\\(alloc2\\) firstprivate\\(alloc1\\) firstprivate\\(agg2\\) firstprivate\\(agg1\\)" 1 "gimple" } } |
| 70 |
|
| 71 |
! { dg-final { scan-tree-dump-times "#pragma omp target.* defaultmap\\(tofrom:all\\) map\\(tofrom:scalar \\\[len: .\\\] \\\[runtime_implicit\\\]\\) map\\(tofrom:.*ptr2.data \\\[len: .*\\\] \\\[runtime_implicit\\\]\\) map\\(to:ptr2 \\\[pointer set, len: ..\\\]\\) map\\(always_pointer:.*ptr2.data \\\[pointer assign, bias: 0\\\]\\) map\\(tofrom:\\*ptr1 \\\[len: .\\\] \\\[runtime_implicit\\\]\\) map\\(alloc:ptr1 \\\[pointer assign, bias: 0\\\]\\) map\\(tofrom:array \\\[len: ..\\\] \\\[runtime_implicit\\\]\\) map\\(tofrom:.*alloc2.data \\\[len: .*\\\] \\\[runtime_implicit\\\]\\) map\\(to:alloc2 \\\[pointer set, len: ..\\\]\\) map\\(alloc:.*alloc2.data \\\[pointer assign, bias: 0\\\]\\) map\\(tofrom:\\*alloc1 \\\[len: .\\\] \\\[runtime_implicit\\\]\\) map\\(alloc:alloc1 \\\[pointer assign, bias: 0\\\]\\) map\\(tofrom:agg2 \\\[len: .\\\] \\\[runtime_implicit\\\]\\) map\\(tofrom:agg1 \\\[len: .\\\] \\\[runtime_implicit\\\]\\)" 1 "gimple" } } |