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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
! RUN: %flang_fc1 -fdebug-unparse %s 2>&1 | FileCheck %s
! Test that compiler directives can appear in various places.
#define PROC(KIND) \
interface; integer(KIND) function foo(a); \
integer(KIND), intent(in) :: a; \
!dir$ ignore_tkr a; \
end; end interface
!dir$ integer
module m
!dir$ integer
use iso_fortran_env
!dir$ integer
implicit integer(a-z)
!dir$ integer
!dir$ integer=64
!dir$ integer = 64
!dir$ integer = 64
PROC(4)
!dir$ optimize:1
!dir$ optimize : 1
!dir$ loop count (10000)
!dir$ loop count (1, 500, 5000, 10000)
type stuff
real(8), allocatable :: d(:)
!dir$ align : 1024 :: d
end type stuff
end
subroutine vector_always
!dir$ vector always
! CHECK: !DIR$ VECTOR ALWAYS
do i=1,10
enddo
end subroutine
subroutine unroll
!dir$ unroll
! CHECK: !DIR$ UNROLL
do i=1,10
enddo
!dir$ unroll 2
! CHECK: !DIR$ UNROLL 2
do i=1,10
enddo
!dir$ nounroll
! CHECK: !DIR$ NOUNROLL
do i=1,10
enddo
end subroutine
subroutine unroll_and_jam
!dir$ unroll_and_jam
! CHECK: !DIR$ UNROLL_AND_JAM
do i=1,10
enddo
!dir$ unroll_and_jam 2
! CHECK: !DIR$ UNROLL_AND_JAM 2
do i=1,10
enddo
!dir$ nounroll_and_jam
! CHECK: !DIR$ NOUNROLL_AND_JAM
do i=1,10
enddo
end subroutine
subroutine no_vector
!dir$ novector
! CHECK: !DIR$ NOVECTOR
do i=1,10
enddo
end subroutine
subroutine inline
integer :: a
!dir$ forceinline
! CHECK: !DIR$ FORCEINLINE
a = f(2)
!dir$ inline
! CHECK: !DIR$ INLINE
call g()
!dir$ noinline
! CHECK: !DIR$ NOINLINE
call g()
contains
function f(x)
integer :: x
f = x**2
end function
subroutine g()
end subroutine
end subroutine
|