[PATCH] D159283: Add intrinsic to count trailing zero elements in a vector

Kerry McLaughlin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 31 11:53:25 PDT 2023


kmclaughlin marked an inline comment as done.
kmclaughlin added a comment.

In D159283#4631473 <https://reviews.llvm.org/D159283#4631473>, @craig.topper wrote:

> What's the use case for the poison behavior? If it wasn't for X86's weird bsr/bsf instruction behaviour would we have this on the regular llvm.cttz/ctlz intrinsics?

Hi @craig.topper, it seemed sensible to add the poison behaviour to be consistent with the cttz intrinsic. Some targets seemed to require it, so I thought it made sense to return undef at least in the generic lowering if the result is 0.



================
Comment at: llvm/lib/Target/AArch64/AArch64ISelLowering.cpp:5337
+
+    return DAG.getAnyExtOrTrunc(NewCttzElts, dl, Ty);
+  }
----------------
craig.topper wrote:
> Why AnyExt?
This should be getZExtOrTrunc


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D159283/new/

https://reviews.llvm.org/D159283



More information about the llvm-commits mailing list