aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/goacc/pr89773.f90
blob: e0e5c4f6af5b83efe1d12bb33a2647a52a1ea33e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
! Valid usage of 'external' procedures with OpenACC 'routine' directives.

! { dg-additional-options "-fdump-tree-optimized-raw" }

  subroutine test (x)
    implicit none
    integer, intent(inout) :: x
    !$acc routine (test)

    integer, external :: f_1
    !$acc routine (f_1)

    integer f_2 ! No explicit EXTERNAL attribute.
    !$acc routine (f_2)

    external s_1
    !$acc routine (s_1)

    ! 's_2' will be an external subroutine without explicit EXTERNAL
    ! attribute, but we don't have a handle for it yet...
    !!$acc routine (s_2) ..., so can't specify this, here.

    if (x < 1) then
       x = 1
    else
       x = x * x - 1 + f_1(f_2(x))
       call s_1(x)
       call s_2(x)
    end if
  end subroutine test

! { dg-final { scan-tree-dump-times "gimple_call" 4 "optimized" } }
! { dg-final { scan-tree-dump-times "gimple_call <f_1," 1 "optimized" } }
! { dg-final { scan-tree-dump-times "gimple_call <f_2," 1 "optimized" } }
! { dg-final { scan-tree-dump-times "gimple_call <s_1," 1 "optimized" } }
! { dg-final { scan-tree-dump-times "gimple_call <s_2," 1 "optimized" } }