[clang] [CIR] Upstream handling for __builtin_prefetch (PR #164387)
Sirui Mu via cfe-commits
cfe-commits at lists.llvm.org
Tue Oct 21 09:19:19 PDT 2025
================
@@ -4052,6 +4049,39 @@ def CIR_ExpectOp : CIR_Op<"expect", [
}];
}
+//===----------------------------------------------------------------------===//
+// PrefetchOp
+//===----------------------------------------------------------------------===//
+
+def CIR_PrefetchOp : CIR_Op<"prefetch"> {
+ let summary = "prefetch operation";
+ let description = [{
+ The `cir.prefetch` op prefetches data from the memmory address.
+
+ ```mlir
+ cir.prefetch(%0 : !cir.ptr<!void>) locality(1) write
+ ```
+
+ This opcode has the three attributes:
+ 1. The $locality is a temporal locality specifier
+ ranging from (0) - no locality, to (3) - extremely local keep in cache.
+ 2. The $isWrite is the specifier determining if the prefetch is prepaired
+ for a 'read' or 'write'.
+ If $isWrite doesn't specified it means that prefetch is prepared for 'read'.
+ }];
+
+ let arguments = (ins CIR_VoidPtrType:$addr,
+ ConfinedAttr<I32Attr, [IntMinValue<0>, IntMaxValue<3>]>:$locality,
+ UnitAttr:$isWrite);
----------------
Lancern wrote:
```suggestion
let arguments = (ins
CIR_VoidPtrType:$addr,
ConfinedAttr<I32Attr, [IntMinValue<0>, IntMaxValue<3>]>:$locality,
UnitAttr:$isWrite
);
```
https://github.com/llvm/llvm-project/pull/164387
More information about the cfe-commits
mailing list