[flang-commits] [flang] [Flang] Add FIR and LLVM lowering support for prefetch directive (PR #167272)
Tom Eccles via flang-commits
flang-commits at lists.llvm.org
Tue Dec 9 06:27:21 PST 2025
================
@@ -353,6 +351,39 @@ def fir_StoreOp : fir_Op<"store", [FirAliasTagOpInterface,
}];
}
+def fir_PrefetchOp : fir_Op<"prefetch", []> {
+ let summary = "prefetch a memory reference";
+
+ let description = [{
+ The prefetch is a hint to the code generator that the memory reference will
+ be used in the near future. The prefetch is not guaranteed to be executed.
+
+ ```
+ %a = ... -> !fir.ref<i32>
+ fir.prefetch %a {read, data, localityHint = 3 : i32} : !fir.ref<i32>
+ // ...
+ fir.load %a : !fir.ref<i32> // use the prefetched value
+ ```
+ }];
+
+ /// `memref' is the address to be prefetched
+ /// `rw' : rw specifier >
+ /// read is 0 (default), write is 1
+ /// `localityHint': temporal locality specifier >
+ /// value ranging from 0 - no locality to 3 - extremely local
+ /// `cacheType' : cache type specifier >
+ /// instruction cache is 0, data cache is 1 (default)
----------------
tblah wrote:
This no longer reflects how it is parsed
https://github.com/llvm/llvm-project/pull/167272
More information about the flang-commits
mailing list