[PATCH] D141798: Drop the ZeroBehavior parameter from countLeadingZeros and the like (NFC)
Sergei Barannikov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 18 18:46:21 PST 2023
barannikov88 accepted this revision.
barannikov88 added a comment.
This revision is now accepted and ready to land.
LGTM
================
Comment at: llvm/include/llvm/Support/MathExtras.h:212
/// Only unsigned integral types are allowed.
-///
-/// \param ZB the behavior on an input of 0. Only ZB_Max and ZB_Undefined are
-/// valid arguments.
-template <typename T> T findFirstSet(T Val, ZeroBehavior ZB = ZB_Max) {
- if (ZB == ZB_Max && Val == 0)
+template <typename T> T findFirstSet(T Val) {
+ if (Val == 0)
----------------
kazu wrote:
> craig.topper wrote:
> > Note, x86 does not have an efficient instruction for find first set with zero returning -1. It will require a cmov to handle zero.
> The new iteration of the patch leaves findFirstSet and findLastSet untouched.
(optional) ZB could be made a template argument and constexpr-ifed.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D141798/new/
https://reviews.llvm.org/D141798
More information about the llvm-commits
mailing list