[llvm] [NFC][IR] Add CreateCountTrailingZeroElems helper (PR #106711)

Kerry McLaughlin via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 2 02:21:31 PDT 2024


================
@@ -1079,6 +1079,14 @@ class IRBuilderBase {
                            nullptr, Name);
   }
 
+  /// Create a call to llvm.experimental_cttz_elts
+  Value *CreateCountTrailingZeroElems(Type *ResTy, Value *Mask,
+                                      const Twine &Name = "") {
+    return CreateIntrinsic(
+        Intrinsic::experimental_cttz_elts, {ResTy, Mask->getType()},
+        {Mask, getInt1(/*ZeroIsPoison=*/true)}, nullptr, Name);
----------------
kmclaughlin-arm wrote:

Although the helper will currently only ever be called when ZeroIsPoison is true, I think the helper should be able to set a different value. Maybe ZeroIsPoison could be passed in with a default value of true instead?

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


More information about the llvm-commits mailing list