81 lines · plain
1!RUN: %flang_fc1 -fdebug-unparse-no-sema %s 2>&1 | FileCheck %s -check-prefix=UNPARSE2!RUN: %flang_fc1 -fdebug-dump-parse-tree-no-sema %s 2>&1 | FileCheck %s -check-prefix=TREE3 4subroutine test_prefetch_01(a, b)5 integer, intent(in) :: a6 integer, intent(inout) :: b(5)7 integer :: i = 28 integer :: res9 10!TREE: | | DeclarationConstruct -> SpecificationConstruct -> CompilerDirective -> Prefetch -> Designator -> DataRef -> Name = 'a'11 12!UNPARSE: !DIR$ PREFETCH a13 !dir$ prefetch a14 b(1) = a15 16!TREE: | | ExecutionPartConstruct -> ExecutableConstruct -> CompilerDirective -> Prefetch -> Designator -> DataRef -> Name = 'b'17 18!UNPARSE: !DIR$ PREFETCH b19 !dir$ prefetch b20 res = sum(b)21 22!TREE: | | ExecutionPartConstruct -> ExecutableConstruct -> CompilerDirective -> Prefetch -> Designator -> DataRef -> Name = 'a'23!TREE: | | Designator -> DataRef -> ArrayElement24!TREE: | | | DataRef -> Name = 'b'25!TREE: | | | SectionSubscript -> SubscriptTriplet26!TREE: | | | | Scalar -> Integer -> Expr -> LiteralConstant -> IntLiteralConstant = '3'27!TREE: | | | | Scalar -> Integer -> Expr -> LiteralConstant -> IntLiteralConstant = '5'28 29!UNPARSE: !DIR$ PREFETCH a, b(3:5)30 !dir$ prefetch a, b(3:5)31 res = a + b(4)32 33!TREE: | | ExecutionPartConstruct -> ExecutableConstruct -> CompilerDirective -> Prefetch -> Designator -> DataRef -> Name = 'res'34!TREE: | | Designator -> DataRef -> ArrayElement35!TREE: | | | DataRef -> Name = 'b'36!TREE: | | | SectionSubscript -> Integer -> Expr -> Add37!TREE: | | | | Expr -> Designator -> DataRef -> Name = 'i'38!TREE: | | | | Expr -> LiteralConstant -> IntLiteralConstant = '2'39 40!UNPARSE: !DIR$ PREFETCH res, b(i+2)41 !dir$ prefetch res, b(i+2)42 res = res + b(i+2)43end subroutine44 45subroutine test_prefetch_02(n, a)46 integer, intent(in) :: n47 integer, intent(in) :: a(n)48 type :: t49 real, allocatable :: x(:, :)50 end type t51 type(t) :: p52 53 do i = 1, n54!TREE: | | | | ExecutionPartConstruct -> ExecutableConstruct -> CompilerDirective -> Prefetch -> Designator -> DataRef -> ArrayElement55!TREE: | | | | | DataRef -> StructureComponent56!TREE: | | | | | | DataRef -> Name = 'p'57!TREE: | | | | | | Name = 'x'58!TREE: | | | | | SectionSubscript -> Integer -> Expr -> Designator -> DataRef -> Name = 'i'59!TREE: | | | | | SectionSubscript -> SubscriptTriplet60!TREE: | | | | Designator -> DataRef -> Name = 'a'61 62!UNPARSE: !DIR$ PREFETCH p%x(i,:), a63 !dir$ prefetch p%x(i, :), a64 do j = 1, n65!TREE: | | | | | | ExecutionPartConstruct -> ExecutableConstruct -> CompilerDirective -> Prefetch -> Designator -> DataRef -> ArrayElement66!TREE: | | | | | | | DataRef -> StructureComponent67!TREE: | | | | | | | | DataRef -> Name = 'p'68!TREE: | | | | | | | | Name = 'x'69!TREE: | | | | | | | SectionSubscript -> Integer -> Expr -> Designator -> DataRef -> Name = 'i'70!TREE: | | | | | | | SectionSubscript -> Integer -> Expr -> Designator -> DataRef -> Name = 'j'71!TREE: | | | | | | Designator -> DataRef -> ArrayElement72!TREE: | | | | | | | DataRef -> Name = 'a'73!TREE: | | | | | | | SectionSubscript -> Integer -> Expr -> Designator -> DataRef -> Name = 'i'74 75!UNPARSE: !DIR$ PREFETCH p%x(i,j), a(i)76 !dir$ prefetch p%x(i, j), a(i)77 p%x(i, j) = p%x(i, j) ** a(j)78 end do79 end do80end subroutine81