[libc-commits] [libc] 8981f20 - [libc] refactor logic around embedded memcpy

Guillaume Chatelet via libc-commits libc-commits at lists.llvm.org
Tue Feb 14 07:58:18 PST 2023


Author: Guillaume Chatelet
Date: 2023-02-14T15:58:08Z
New Revision: 8981f20ae9c3f5db953ea7bad77702599ca65477

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

LOG: [libc] refactor logic around embedded memcpy

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 9ff71ab1a54c5..850e0256c7b1d 100644
--- a/libc/src/string/memory_utils/memcpy_implementations.h
+++ b/libc/src/string/memory_utils/memcpy_implementations.h
@@ -125,14 +125,13 @@ inline_memcpy_aarch64(Ptr __restrict dst, CPtr __restrict src, size_t count) {
 LIBC_INLINE void inline_memcpy(Ptr __restrict dst, CPtr __restrict src,
                                size_t count) {
   using namespace __llvm_libc::builtin;
-#if defined(LIBC_TARGET_ARCH_IS_X86)
+#if defined(LIBC_COPT_MEMCPY_USE_EMBEDDED_TINY) ||                             \
+    defined(LIBC_TARGET_ARCH_IS_ARM) || defined(LIBC_TARGET_ARCH_IS_GPU)
+  return inline_memcpy_embedded_tiny(dst, src, count);
+#elif defined(LIBC_TARGET_ARCH_IS_X86)
   return inline_memcpy_x86_maybe_interpose_repmovsb(dst, src, count);
 #elif defined(LIBC_TARGET_ARCH_IS_AARCH64)
   return inline_memcpy_aarch64(dst, src, count);
-#elif defined(LIBC_TARGET_ARCH_IS_ARM)
-  return inline_memcpy_embedded_tiny(dst, src, count);
-#elif defined(LIBC_TARGET_ARCH_IS_GPU)
-  return inline_memcpy_embedded_tiny(dst, src, count);
 #else
 #error "Unsupported platform"
 #endif


        


More information about the libc-commits mailing list