[llvm] [AArch64] Expand llvm.histogram intrinsic to support umax, umin, and uadd.sat operations (PR #138447)

Graham Hunter via llvm-commits llvm-commits at lists.llvm.org
Thu May 8 06:04:09 PDT 2025


================
@@ -997,8 +997,26 @@ static void scalarizeMaskedVectorHistogram(const DataLayout &DL, CallInst *CI,
     Builder.SetInsertPoint(CondBlock->getTerminator());
     Value *Ptr = Builder.CreateExtractElement(Ptrs, Idx, "Ptr" + Twine(Idx));
     LoadInst *Load = Builder.CreateLoad(EltTy, Ptr, "Load" + Twine(Idx));
-    Value *Add = Builder.CreateAdd(Load, Inc);
-    Builder.CreateStore(Add, Ptr);
+    Value *UpdateOp;
+    switch (cast<IntrinsicInst>(CI)->getIntrinsicID()) {
----------------
huntergr-arm wrote:

The code above (starting with the comment `// Shorten the way if the mask is a vector of constants`) needs this same logic; the constant mask tests are still just using add.

Perhaps the load -> update -> store code could be generated by a lambda to avoid duplication?

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


More information about the llvm-commits mailing list