xref: /llvm-project/flang/test/Parser/compiler-directives.f90 (revision e811cb00e533e9737db689e35ee6cb0d5af536cc)
1! RUN: %flang_fc1 -fdebug-unparse %s 2>&1 | FileCheck %s
2
3! Test that compiler directives can appear in various places.
4
5#define PROC(KIND) \
6  interface; integer(KIND) function foo(a); \
7    integer(KIND), intent(in) :: a; \
8    !dir$ ignore_tkr a; \
9  end; end interface
10
11!dir$ integer
12module m
13  !dir$ integer
14  use iso_fortran_env
15  !dir$ integer
16  implicit integer(a-z)
17  !dir$ integer
18  !dir$ integer=64
19  !dir$ integer = 64
20  !dir$  integer = 64
21  PROC(4)
22  !dir$ optimize:1
23  !dir$ optimize : 1
24  !dir$ loop count (10000)
25  !dir$ loop count (1, 500, 5000, 10000)
26  type stuff
27     real(8), allocatable :: d(:)
28     !dir$  align : 1024 :: d
29  end type stuff
30end
31
32subroutine vector_always
33  !dir$ vector always
34  ! CHECK: !DIR$ VECTOR ALWAYS
35  do i=1,10
36  enddo
37end subroutine
38
39subroutine unroll
40  !dir$ unroll
41  ! CHECK: !DIR$ UNROLL
42  do i=1,10
43  enddo
44  !dir$ unroll 2
45  ! CHECK: !DIR$ UNROLL 2
46  do i=1,10
47  enddo
48end subroutine
49