[libc-commits] [PATCH] D136693: [libc] deprecate LLVM_LIBC_MEMCPY_X86_USE_ONLY_REPMOVSB

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


This revision was not accepted when it landed; it landed in state "Needs Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rGfe8d211f1a06: [libc] deprecate LLVM_LIBC_MEMCPY_X86_USE_ONLY_REPMOVSB (authored by gchatelet).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D136693

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


Index: libc/src/string/memory_utils/memcpy_implementations.h
===================================================================
--- libc/src/string/memory_utils/memcpy_implementations.h
+++ libc/src/string/memory_utils/memcpy_implementations.h
@@ -65,18 +65,19 @@
                                            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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D136693.475743.patch
Type: text/x-patch
Size: 1408 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20221116/57d25a33/attachment.bin>


More information about the libc-commits mailing list