PREFETCH - PREFETCH - 57222

AOCC User Guide

Document_ID
57222
Release_Date
2026-05-12
Revision
5.2 English

This directive is used to insert a hint in the code generator to prefetch instruction for memory references, wherever supported. This allows a better performance in the characteristics of the code. For more information, refer to LLVM Prefetch Intrinsic Documentation.

!$MEM PREFETCH

Constraints

To enable this directive, compiler optimization level should be in -O0 to -O3.

Example

subroutine prefetch_dir(a1, a2)
 integer :: a1(4096)
 integer :: a2(4096)

 do i = 128, (4096 - 128)
   !$mem prefetch a1, a2(i + 256)
   a1(i) = a2(i - 127) + a2(i + 127)
 end do
end subroutine prefetch_dir