[libc-commits] [libc] fe8d211 - [libc] deprecate LLVM_LIBC_MEMCPY_X86_USE_ONLY_REPMOVSB

Guillaume Chatelet via libc-commits libc-commits at lists.llvm.org
Wed Nov 16 02:34:06 PST 2022


Author: Guillaume Chatelet
Date: 2022-11-16T10:33:20Z
New Revision: fe8d211f1a06f7316391ae33896a2bfe13854b35

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

LOG: [libc] deprecate LLVM_LIBC_MEMCPY_X86_USE_ONLY_REPMOVSB

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

Added: 
    

Modified: 
    libc/src/string/memory_utils/memcpy_implementations.h

Removed: 
    


################################################################################
diff  --git a/libc/src/string/memory_utils/memcpy_implementations.h b/libc/src/string/memory_utils/memcpy_implementations.h
index cb9a82856f45..2fa32e3b6110 100644
--- a/libc/src/string/memory_utils/memcpy_implementations.h
+++ b/libc/src/string/memory_utils/memcpy_implementations.h
@@ -65,18 +65,19 @@ inline_memcpy_x86_maybe_interpose_repmovsb(Ptr __restrict dst,
                                            CPtr __restrict src, size_t count) {
   // Whether to use rep;movsb exclusively, not at all, or only above a certain
   // threshold.
-  // TODO: Use only a single preprocessor definition to simplify the code.
 #ifndef LLVM_LIBC_MEMCPY_X86_USE_REPMOVSB_FROM_SIZE
 #define LLVM_LIBC_MEMCPY_X86_USE_REPMOVSB_FROM_SIZE -1
 #endif
 
-  static constexpr bool kUseOnlyRepMovsb =
-      LLVM_LIBC_IS_DEFINED(LLVM_LIBC_MEMCPY_X86_USE_ONLY_REPMOVSB);
+#ifdef LLVM_LIBC_MEMCPY_X86_USE_ONLY_REPMOVSB
+#error LLVM_LIBC_MEMCPY_X86_USE_ONLY_REPMOVSB is deprecated use LLVM_LIBC_MEMCPY_X86_USE_REPMOVSB_FROM_SIZE=0 instead.
+#endif // LLVM_LIBC_MEMCPY_X86_USE_ONLY_REPMOVSB
+
   static constexpr size_t kRepMovsbThreshold =
       LLVM_LIBC_MEMCPY_X86_USE_REPMOVSB_FROM_SIZE;
-  if constexpr (kUseOnlyRepMovsb)
+  if constexpr (kRepMovsbThreshold == 0)
     return x86::Memcpy::repmovsb(dst, src, count);
-  else if constexpr (kRepMovsbThreshold >= 0) {
+  else if constexpr (kRepMovsbThreshold > 0) {
     if (unlikely(count >= kRepMovsbThreshold))
       return x86::Memcpy::repmovsb(dst, src, count);
     else


        


More information about the libc-commits mailing list