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

Stanislav Mekhanoshin via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 8 10:53:07 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());
----------------
rampitec wrote:

SDNode has SDNPMemOperand. SDag lowering also creates memory operand, like this:
```
  S_PREFETCH_DATA killed %2:sgpr_64, 0, $sgpr_null, 0 :: (load (s8) from %ir.ptr, addrspace 4)
```

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


More information about the llvm-commits mailing list