[llvm] [GlobalISel] Add G_PREFETCH (PR #74863)

Jay Foad via llvm-commits llvm-commits at lists.llvm.org
Sat Dec 9 03:38:52 PST 2023


================
@@ -1209,6 +1209,15 @@ def G_FENCE : GenericInstruction {
   let hasSideEffects = true;
 }
 
+// Generic opcode equivalent to the llvm.prefetch intrinsic.
+def G_PREFETCH : GenericInstruction {
+  let OutOperandList = (outs);
+  let InOperandList = (ins ptype0:$address, i32imm:$rw, i32imm:$locality, i32imm:$cachetype);
+  let hasSideEffects = true;
+  let mayLoad = true;
+  let mayStore = true;
----------------
jayfoad wrote:

I have now copied the logic from SDAG that gives it an MMO marked either MOLoad or MOStore depending on the RW flag. I guess that explains why the opcode needs to be both mayLoad and mayStore - unless we split it into separate G_PREFETCH_LOAD/STORE opcodes.

https://github.com/llvm/llvm-project/pull/74863


More information about the llvm-commits mailing list