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

via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 13 18:44:03 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)");
----------------
m-saito-fj wrote:

Thanks for your comment.

I had just done the same with masked load/masked store.
I think that if `mask` is `null`, then mask can be considered unnecessary. So I think there is no problem with `all ones`.

But, I think it would be confusing with that message as it was, so I fixed it.

[assert message](https://github.com/llvm/llvm-project/pull/66160/files#diff-7b9ae5c1774880299e98d0bd713f6d0b881a6f70ad31ce5603ea6275fecf8a42R556).
The comment is outdated because I force pushed it. Please see link above.

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


More information about the llvm-commits mailing list