File: declare-variant-14.f90

package info (click to toggle)
gcc-arm-none-eabi 15%3A14.2.rel1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,099,328 kB
  • sloc: cpp: 3,627,108; ansic: 2,571,498; ada: 834,230; f90: 235,082; makefile: 79,231; asm: 74,984; xml: 51,692; exp: 39,736; sh: 33,298; objc: 15,629; python: 15,069; fortran: 14,429; pascal: 7,003; awk: 5,070; perl: 3,106; ml: 285; lisp: 253; lex: 204; haskell: 135
file content (51 lines) | stat: -rw-r--r-- 1,866 bytes parent folder | download
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
! { dg-do compile { target vect_simd_clones } }
! { dg-additional-options "-O0 -fdump-tree-gimple -fdump-tree-optimized" }
! { dg-additional-options "-mno-sse3" { target { i?86-*-* x86_64-*-* } } }

module main
  implicit none
contains
  integer function f01 (x)
    integer, intent (in) :: x
    f01 = x
  end function

  integer function f02 (x)
    integer, intent (in) :: x
    f02 = x
  end function

  integer function f03 (x)
    integer, intent (in) :: x
    f03 = x
  end function

  integer function f04 (x)
    integer, intent(in) :: x

    !$omp declare variant (f01) match (device={isa("avx512f")}) ! 4 or 8
    !$omp declare variant (f02) match (implementation={vendor(score(3):gnu)},device={kind(cpu)}) ! (1 or 2) + 3
    !$omp declare variant (f03) match (implementation={vendor(score(5):gnu)},device={kind(host)}) ! (1 or 2) + 5
    f04 = x
  end function

  integer function test1 (x)
    !$omp declare simd
    integer, intent (in) :: x
    integer :: a, b

    ! At gimplification time, we can't decide yet which function to call.
    ! { dg-final { scan-tree-dump-times "f04 \\\(x" 2 "gimple" { target { !aarch64*-*-* } } } }
    ! After simd clones are created, the original non-clone test1 shall
    ! call f03 (score 6), the sse2/avx/avx2 clones too, but avx512f clones
    ! shall call f01 with score 8.
    ! { dg-final { scan-tree-dump-not "f04 \\\(x" "optimized" } }
    ! { dg-final { scan-tree-dump-times "f03 \\\(x" 14 "optimized" { target { !aarch64*-*-* } } } }
    ! { dg-final { scan-tree-dump-times "f03 \\\(x" 6 "optimized" { target { aarch64*-*-* } } } }
    ! { dg-final { scan-tree-dump-times "f01 \\\(x" 4 "optimized" { target { !aarch64*-*-* } } } }
    ! { dg-final { scan-tree-dump-times "f01 \\\(x" 0 "optimized" { target { aarch64*-*-* } } } }
    a = f04 (x)
    b = f04 (x)
    test1 = a + b
  end function
end module