================
@@ -158,6 +163,33 @@ computeFullLaneShuffleMask(CIRGenFunction &cgf, const 
mlir::Value vec,
 
   outIndices.resize(numElts);
 }
+
+static mlir::Value emitPrefetch(CIRGenFunction &cgf, unsigned builtinID,
+                                const CallExpr *e,
+                                const SmallVector<mlir::Value> &ops) {
+  CIRGenBuilderTy &builder = cgf.getBuilder();
+  mlir::Location location = cgf.getLoc(e->getExprLoc());
+  mlir::Type voidTy = builder.getVoidTy();
+  mlir::Value address = builder.createPtrBitcast(ops[0], voidTy);
+  bool isWrite{};
+  int locality{};
+
+  assert(builtinID == X86::BI_mm_prefetch || builtinID == X86::BI_m_prefetchw 
||
+         builtinID == X86::BI_m_prefetch && "Expected prefetch builtin");
+
+  if (builtinID == X86::BI_mm_prefetch) {
+    int hint = getIntValueFromConstOp(ops[1]);
----------------
andykaylor wrote:

We have `CIRGenFunction::getSExtIntValueFromConstOp()` which does this. On the 
other hand, this would be the only thing keeping us from just passing `builder` 
and `loc` to this function instead of `cgf` and `e`. Maybe we should move 
`getSExtIntValueFromConstOp` to the utility set proposed on 
https://github.com/llvm/llvm-project/pull/172735


https://github.com/llvm/llvm-project/pull/168051
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to