[llvm] 6b50a10 - [Support] Remove countLeadingZeros, countPopulation, etc

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Sat Jun 24 00:00:12 PDT 2023


Author: Kazu Hirata
Date: 2023-06-24T00:00:06-07:00
New Revision: 6b50a10d87ba00b0d77f258fd75d5b705c45663b

URL: https://github.com/llvm/llvm-project/commit/6b50a10d87ba00b0d77f258fd75d5b705c45663b
DIFF: https://github.com/llvm/llvm-project/commit/6b50a10d87ba00b0d77f258fd75d5b705c45663b.diff

LOG: [Support] Remove countLeadingZeros, countPopulation, etc

These functions have been deprecated since:

  commit ec116ea684b43aadfdda03cea2c2a86423e3fc27
  Author: Kazu Hirata <kazu at google.com>
  Date:   Sun Feb 12 12:11:51 2023 -0800

Differential Revision: https://reviews.llvm.org/D153686

Added: 
    

Modified: 
    llvm/include/llvm/Support/MathExtras.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Support/MathExtras.h b/llvm/include/llvm/Support/MathExtras.h
index 72fe36777d601..dc095941fdc8a 100644
--- a/llvm/include/llvm/Support/MathExtras.h
+++ b/llvm/include/llvm/Support/MathExtras.h
@@ -60,34 +60,6 @@ constexpr float ef          = 2.71828183F, // (0x1.5bf0a8P+1) https://oeis.org/A
                 phif        = 1.61803399F; // (0x1.9e377aP+0) https://oeis.org/A001622
 } // namespace numbers
 
-/// Count number of 0's from the least significant bit to the most
-///   stopping at the first 1.
-///
-/// Only unsigned integral types are allowed.
-///
-/// Returns std::numeric_limits<T>::digits on an input of 0.
-template <typename T>
-LLVM_DEPRECATED("Use llvm::countr_zero instead.", "llvm::countr_zero")
-unsigned countTrailingZeros(T Val) {
-  static_assert(std::is_unsigned_v<T>,
-                "Only unsigned integral types are allowed.");
-  return llvm::countr_zero(Val);
-}
-
-/// Count number of 0's from the most significant bit to the least
-///   stopping at the first 1.
-///
-/// Only unsigned integral types are allowed.
-///
-/// Returns std::numeric_limits<T>::digits on an input of 0.
-template <typename T>
-LLVM_DEPRECATED("Use llvm::countl_zero instead.", "llvm::countl_zero")
-unsigned countLeadingZeros(T Val) {
-  static_assert(std::is_unsigned_v<T>,
-                "Only unsigned integral types are allowed.");
-  return llvm::countl_zero(Val);
-}
-
 /// Create a bitmask with the N right-most bits set to 1, and all other
 /// bits set to 0.  Only unsigned types are allowed.
 template <typename T> T maskTrailingOnes(unsigned N) {
@@ -298,47 +270,6 @@ constexpr inline bool isPowerOf2_64(uint64_t Value) {
   return llvm::has_single_bit(Value);
 }
 
-/// Count the number of ones from the most significant bit to the first
-/// zero bit.
-///
-/// Ex. countLeadingOnes(0xFF0FFF00) == 8.
-/// Only unsigned integral types are allowed.
-///
-/// Returns std::numeric_limits<T>::digits on an input of all ones.
-template <typename T>
-LLVM_DEPRECATED("Use llvm::countl_one instead.", "llvm::countl_one")
-unsigned countLeadingOnes(T Value) {
-  static_assert(std::is_unsigned_v<T>,
-                "Only unsigned integral types are allowed.");
-  return llvm::countl_one<T>(Value);
-}
-
-/// Count the number of ones from the least significant bit to the first
-/// zero bit.
-///
-/// Ex. countTrailingOnes(0x00FF00FF) == 8.
-/// Only unsigned integral types are allowed.
-///
-/// Returns std::numeric_limits<T>::digits on an input of all ones.
-template <typename T>
-LLVM_DEPRECATED("Use llvm::countr_one instead.", "llvm::countr_one")
-unsigned countTrailingOnes(T Value) {
-  static_assert(std::is_unsigned_v<T>,
-                "Only unsigned integral types are allowed.");
-  return llvm::countr_one<T>(Value);
-}
-
-/// Count the number of set bits in a value.
-/// Ex. countPopulation(0xF000F000) = 8
-/// Returns 0 if the word is zero.
-template <typename T>
-LLVM_DEPRECATED("Use llvm::popcount instead.", "llvm::popcount")
-inline unsigned countPopulation(T Value) {
-  static_assert(std::is_unsigned_v<T>,
-                "Only unsigned integral types are allowed.");
-  return (unsigned)llvm::popcount(Value);
-}
-
 /// Return true if the argument contains a non-empty sequence of ones with the
 /// remainder zero (32 bit version.) Ex. isShiftedMask_32(0x0000FF00U) == true.
 /// If true, \p MaskIdx will specify the index of the lowest set bit and \p


        


More information about the llvm-commits mailing list