Debian Codegraph @

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

raw
1 ! { dg-do compile { target vect_simd_clones } }
2 ! { dg-additional-options "-fdump-tree-gimple" }
3 ! { dg-additional-options "-mno-sse3" { target { i?86-*-* x86_64-*-* } } }
4
5 module main
6
7 implicit none
8
9 interface
10 integer function f01 (x)
11 integer, intent(in) :: x
12 end function
13
14 integer function f02 (x)
15 integer, intent(in) :: x
16 end function
17
18 integer function f03 (x)
19 integer, intent(in) :: x
20 end function
21
22 integer function f04 (x)
23 integer, intent(in) :: x
24 end function
25
26 integer function f05 (x)
27 integer, intent(in) :: x
28
29 !$omp declare variant (f01) match (device={isa("avx512f")}) ! 4 or 8
30 !$omp declare variant (f02) match (implementation={vendor(score(3):gnu)},device={kind(cpu)}) ! (1 or 2) + 3
31 !$omp declare variant (f03) match (user={condition(score(9):.true.)})
32 !$omp declare variant (f04) match (implementation={vendor(score(6):gnu)},device={kind(host)}) ! (1 or 2) + 6
33 end function
34 end interface
35
36 contains
37
38 integer function test1 (x)
39 !$omp declare simd
40 integer, intent(in) :: x
41
42 ! 0 or 1 (the latter if in a declare simd clone) constructs in OpenMP context,
43 ! isa has score 2^2 or 2^3. We can't decide on whether avx512f will match or
44 ! not, that also depends on whether it is a declare simd clone or not and which
45 ! one, but the f03 variant has a higher score anyway. */
46 test1 = f05 (x)
47 ! { dg-final { scan-tree-dump "f03 \\\(" "gimple" } }
48 ! { dg-final { scan-tree-dump-not "f05 \\\(" "gimple" } }
49 end function
50
51 end module