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

Jay Foad via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 8 08:52:24 PST 2023


================
@@ -2435,6 +2435,18 @@ bool IRTranslator::translateKnownIntrinsic(const CallInst &CI, Intrinsic::ID ID,
     MIRBuilder.buildInstr(TargetOpcode::G_RESET_FPMODE, {}, {});
     return true;
   }
+  case Intrinsic::prefetch: {
+    Value *Addr = CI.getOperand(0);
+    ConstantInt *RW = cast<ConstantInt>(CI.getOperand(1));
+    ConstantInt *Locality = cast<ConstantInt>(CI.getOperand(2));
+    ConstantInt *CacheType = cast<ConstantInt>(CI.getOperand(3));
+
+    MIRBuilder.buildPrefetch(getOrCreateVReg(*Addr), RW->getZExtValue(),
+                             Locality->getZExtValue(),
+                             CacheType->getZExtValue());
----------------
jayfoad wrote:

Should this also get a `MachineMemOperand`?

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


More information about the llvm-commits mailing list