[llvm] [Vectorize] Vectorization for __builtin_prefetch (PR #66160)

Renato Golin via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 30 04:00:25 PST 2023


================
@@ -539,6 +539,27 @@ CallInst *IRBuilderBase::CreateMaskedStore(Value *Val, Value *Ptr,
   return CreateMaskedIntrinsic(Intrinsic::masked_store, Ops, OverloadedTypes);
 }
 
+/// Create a call to a Masked Prefetch intrinsic.
+/// \p Ptr      - base pointer for the load
+/// \p ElemSize - element size for memory address generation
+/// \p Mask     - vector of booleans which indicates what vector lanes should
+///               be accessed in memory
+/// \p RW       - Read or Write
+/// \p Locality - Cache Level
+/// \p Name     - name of the result variable
+CallInst *IRBuilderBase::CreateMaskedPrefetch(Value *Ptr,
+                                              Value *ElemSize,
+                                              Value *Mask, Value *RW,
+                                              Value *Locality,
+                                              const Twine &Name) {
+  auto *PtrTy = cast<PointerType>(Ptr->getType());
+  assert(Mask && "Mask should not be all-ones (null)");
----------------
rengolin wrote:

I don't get this message. I assumed `all ones` would be all lanes, and a `null` value would be `all zeroes` which would be no lanes (which is still a valid mask, just not useful for pre-fetching).

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


More information about the llvm-commits mailing list