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

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


================
@@ -645,6 +666,34 @@ CallInst *IRBuilderBase::CreateMaskedCompressStore(Value *Val, Value *Ptr,
                                OverloadedTypes);
 }
 
+/// Create a call to a Masked Gather Prefetch intrinsic.
+/// \p Ptrs     - vector of pointers for loading
+/// \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::CreateMaskedGatherPrefetch(Value *Ptrs, Value *ElemSize,
+                                                    Value *Mask, Value *RW,
+                                                    Value *Locality,
+                                                    const Twine &Name) {
+  auto *PtrsTy = cast<VectorType>(Ptrs->getType());
+  ElementCount NumElts = PtrsTy->getElementCount();
+
+  if (!Mask)
----------------
rengolin wrote:

Now I see where that comes from. I think this is a misleading tactic. I'd force the mask to have at least one value in it (f that's what you want) here and not and the next call.

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


More information about the llvm-commits mailing list