Debian Codegraph @

gcc/testsuite/gfortran.dg/gomp/declare-variant-1.f90

raw
1 module main
2 implicit none
3
4 interface
5 integer function foo (a, b, c)
6 integer, intent(in) :: a, b
7 integer, intent(inout) :: c
8 end function
9
10 integer function bar (a, b, c)
11 integer, intent(in) :: a, b
12 integer, intent(inout) :: c
13 end function
14
15 integer function baz (a, b, c)
16 integer, intent(in) :: a, b
17 integer, intent(inout) :: c
18
19 !$omp declare variant (foo) &
20 !$omp & match (construct={parallel,do}, &
21 !$omp & device={isa(avx512f,avx512vl),kind(host,cpu)}, &
22 !$omp & implementation={vendor(score(0):gnu),unified_shared_memory}, &
23 !$omp & user={condition(score(0):.false.)})
24 !$omp declare variant (bar) &
25 !$omp & match (device={arch(x86_64,powerpc64),isa(avx512f,popcntb)}, &
26 !$omp & implementation={atomic_default_mem_order(seq_cst),made_up_selector("foo", 13, "bar")}, &
27 !$omp & user={condition(.true. .AND. (.not. .true.))})
28 ! { dg-warning "unknown selector 'made_up_selector'" "" { target *-*-* } .-2 }
29 end function
30
31 subroutine quux
32 end subroutine quux
33
34 integer function baz3 (x, y, z)
35 integer, intent(in) :: x, y
36 integer, intent(inout) :: z
37
38 !$omp declare variant (bar) match &
39 !$omp & (implementation={atomic_default_mem_order(score(3): acq_rel)})
40 end function
41 end interface
42 contains
43 integer function qux ()
44 integer :: i = 3
45
46 qux = baz (1, 2, i)
47 end function
48
49 subroutine corge
50 integer :: i
51 !$omp declare variant (quux) match (construct={parallel,do})
52
53 interface
54 subroutine waldo (x)
55 integer, intent(in) :: x
56 end subroutine
57 end interface
58
59 call waldo (5)
60 !$omp parallel do
61 do i = 1, 3
62 call waldo (6)
63 end do
64 !$omp end parallel do
65
66 !$omp parallel
67 !$omp taskgroup
68 !$omp do
69 do i = 1, 3
70 call waldo (7)
71 end do
72 !$omp end do
73 !$omp end taskgroup
74 !$omp end parallel
75
76 !$omp parallel
77 !$omp master
78 call waldo (8)
79 !$omp end master
80 !$omp end parallel
81 end subroutine
82
83 integer function baz2 (x, y, z)
84 integer, intent(in) :: x, y
85 integer, intent(inout) :: z
86
87 !$omp declare variant (bar) match &
88 !$omp & (implementation={atomic_default_mem_order(relaxed), &
89 !$omp & unified_address, unified_shared_memory, &
90 !$omp & dynamic_allocators, reverse_offload})
91
92 baz2 = x + y + z
93 end function
94 end module