| 1 |
! { dg-do compile } |
| 2 |
! { dg-additional-options "-fdump-tree-gimple" } |
| 3 |
|
| 4 |
! Check that, when the novariants or nocontext clauses cannot be evaluated at |
| 5 |
! compile time, both variants are emitted. |
| 6 |
|
| 7 |
module main |
| 8 |
use iso_c_binding, only: c_ptr |
| 9 |
implicit none |
| 10 |
interface |
| 11 |
integer function f0 () |
| 12 |
end function |
| 13 |
integer function f1 () |
| 14 |
end function |
| 15 |
integer function f2 () |
| 16 |
!$omp declare variant (f0) match (construct={dispatch}) |
| 17 |
!$omp declare variant (f1) match (implementation={vendor(gnu)}) |
| 18 |
end function |
| 19 |
end interface |
| 20 |
contains |
| 21 |
|
| 22 |
subroutine test () |
| 23 |
integer :: a, n |
| 24 |
|
| 25 |
!$omp dispatch novariants(n < 1024) nocontext(n > 1024) |
| 26 |
a = f2 () |
| 27 |
end subroutine |
| 28 |
end module |
| 29 |
|
| 30 |
! { dg-final { scan-tree-dump-times "D\.\[0-9]+ = n <= 1023;" 1 "gimple" } } |
| 31 |
! { dg-final { scan-tree-dump-times "D\.\[0-9]+ = n > 1024;" 1 "gimple" } } |
| 32 |
! { dg-final { scan-tree-dump-times "#pragma omp dispatch novariants\\(0\\) nocontext\\(0\\)" 1 "gimple" } } |
| 33 |
! { dg-final { scan-tree-dump-times "a = f2 \\\(\\\);" 1 "gimple" } } |
| 34 |
! { dg-final { scan-tree-dump-times "a = f1 \\\(\\\);" 1 "gimple" } } |
| 35 |
! { dg-final { scan-tree-dump-times "a = f0 \\\(\\\);" 1 "gimple" } } |
| 36 |
|