[PATCH] D143858: [llvm] Deprecate PowerOf2Floor and ByteSwap_{16,32,64}

Kazu Hirata via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Feb 12 21:42:20 PST 2023


This revision was automatically updated to reflect the committed changes.
Closed by commit rGb49b429fde3a: [llvm] Deprecate PowerOf2Floor and ByteSwap_{16,32,64} (authored by kazu).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D143858

Files:
  llvm/include/llvm/Support/MathExtras.h
  llvm/include/llvm/Support/SwapByteOrder.h
  llvm/unittests/Support/MathExtrasTest.cpp
  llvm/unittests/Support/SwapByteOrderTest.cpp


Index: llvm/unittests/Support/SwapByteOrderTest.cpp
===================================================================
--- llvm/unittests/Support/SwapByteOrderTest.cpp
+++ llvm/unittests/Support/SwapByteOrderTest.cpp
@@ -16,16 +16,6 @@
 
 namespace {
 
-TEST(ByteSwap, Swap_32) {
-  EXPECT_EQ(0x44332211u, ByteSwap_32(0x11223344));
-  EXPECT_EQ(0xDDCCBBAAu, ByteSwap_32(0xAABBCCDD));
-}
-
-TEST(ByteSwap, Swap_64) {
-  EXPECT_EQ(0x8877665544332211ULL, ByteSwap_64(0x1122334455667788LL));
-  EXPECT_EQ(0x1100FFEEDDCCBBAAULL, ByteSwap_64(0xAABBCCDDEEFF0011LL));
-}
-
 // In these first two tests all of the original_uintx values are truncated
 // except for 64. We could avoid this, but there's really no point.
 
Index: llvm/unittests/Support/MathExtrasTest.cpp
===================================================================
--- llvm/unittests/Support/MathExtrasTest.cpp
+++ llvm/unittests/Support/MathExtrasTest.cpp
@@ -143,12 +143,6 @@
   EXPECT_EQ(8U, PowerOf2Ceil(7U));
 }
 
-TEST(MathExtras, PowerOf2Floor) {
-  EXPECT_EQ(0U, PowerOf2Floor(0U));
-  EXPECT_EQ(8U, PowerOf2Floor(8U));
-  EXPECT_EQ(4U, PowerOf2Floor(7U));
-}
-
 TEST(MathExtras, CTLog2) {
   EXPECT_EQ(CTLog2<1ULL << 0>(), 0U);
   EXPECT_EQ(CTLog2<1ULL << 1>(), 1U);
Index: llvm/include/llvm/Support/SwapByteOrder.h
===================================================================
--- llvm/include/llvm/Support/SwapByteOrder.h
+++ llvm/include/llvm/Support/SwapByteOrder.h
@@ -48,12 +48,15 @@
 
 /// ByteSwap_16 - This function returns a byte-swapped representation of
 /// the 16-bit argument.
+LLVM_DEPRECATED("use llvm::byteswap instead", "llvm::byteswap")
 inline uint16_t ByteSwap_16(uint16_t value) { return llvm::byteswap(value); }
 
 /// This function returns a byte-swapped representation of the 32-bit argument.
+LLVM_DEPRECATED("use llvm::byteswap instead", "llvm::byteswap")
 inline uint32_t ByteSwap_32(uint32_t value) { return llvm::byteswap(value); }
 
 /// This function returns a byte-swapped representation of the 64-bit argument.
+LLVM_DEPRECATED("use llvm::byteswap instead", "llvm::byteswap")
 inline uint64_t ByteSwap_64(uint64_t value) { return llvm::byteswap(value); }
 
 namespace sys {
Index: llvm/include/llvm/Support/MathExtras.h
===================================================================
--- llvm/include/llvm/Support/MathExtras.h
+++ llvm/include/llvm/Support/MathExtras.h
@@ -455,6 +455,7 @@
 
 /// Returns the power of two which is less than or equal to the given value.
 /// Essentially, it is a floor operation across the domain of powers of two.
+LLVM_DEPRECATED("use llvm::bit_floor instead", "llvm::bit_floor")
 inline uint64_t PowerOf2Floor(uint64_t A) {
   return llvm::bit_floor(A);
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D143858.496839.patch
Type: text/x-patch
Size: 2712 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230213/b1b3872c/attachment.bin>


More information about the llvm-commits mailing list