Debian Codegraph @

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

raw
1 ! { dg-do compile { target { { i?86-*-* x86_64-*-* } && vect_simd_clones } } } */
2 ! { dg-additional-options "-mno-sse3 -O1 -fdump-tree-gimple -fdump-tree-optimized" }
3
4 module main
5
6 implicit none
7
8 interface
9 integer function f01 (x)
10 integer, intent (in) :: x
11 end function
12
13 integer function f02 (x)
14 integer, intent (in) :: x
15 end function
16
17 integer function f03 (x)
18 integer, intent (in) :: x
19 end function
20
21 integer function f04 (x)
22 integer, intent(in) :: x
23
24 !$omp declare variant (f01) match (device={isa("avx512f")}) ! 4 or 8
25 !$omp declare variant (f02) match (implementation={vendor(score(3):gnu)},device={kind(cpu)}) ! (1 or 2) + 3
26 !$omp declare variant (f03) match (implementation={vendor(score(5):gnu)},device={kind(host)}) ! (1 or 2) + 5
27 end function
28
29 end interface
30
31 contains
32
33 integer function test1 (x)
34 !$omp declare simd
35 integer, intent (in) :: x
36 integer :: a, b
37
38 ! At gimplification time, we can't decide yet which function to call.
39 ! { dg-final { scan-tree-dump-times "f04 \\\(x" 2 "gimple" { target { !aarch64*-*-* } } } }
40 ! After simd clones are created, the original non-clone test1 shall
41 ! call f03 (score 6), the sse2/avx/avx2 clones too, but avx512f clones
42 ! shall call f01 with score 8.
43 ! { dg-final { scan-tree-dump-not "f04 \\\(x" "optimized" } }
44 ! { dg-final { scan-tree-dump-times "f03 \\\(x" 14 "optimized" } }
45 ! { dg-final { scan-tree-dump-times "f01 \\\(x" 4 "optimized" } }
46 a = f04 (x)
47 b = f04 (x)
48 test1 = a + b
49 end function
50 end module