[PATCH] D141798: Remove ZeroBehavior of countLeadingZeros and the like (NFC)

Craig Topper via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Jan 15 13:07:53 PST 2023


craig.topper added inline comments.


================
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)
----------------
Note, x86 does not have an efficient instruction for find first set with zero returning -1. It will require a cmov to handle zero.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141798



More information about the cfe-commits mailing list