[libc-commits] [libc] c3fd2a5 - [libc] Remove special case for 8 and 16 bytes

Guillaume Chatelet via libc-commits libc-commits at lists.llvm.org
Tue Sep 15 13:48:42 PDT 2020


Author: Guillaume Chatelet
Date: 2020-09-15T20:48:27Z
New Revision: c3fd2a50ba1395b6c2240f6a688c6a1aa975a1fe

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

LOG: [libc] Remove special case for 8 and 16 bytes

They don't seem to gain much in real apps and its better to favor less branches and smaller code.

Added: 
    

Modified: 
    libc/src/string/memcpy.cpp
    libc/src/string/x86/memcpy.cpp

Removed: 
    


################################################################################
diff  --git a/libc/src/string/memcpy.cpp b/libc/src/string/memcpy.cpp
index a8056714a225..00d66ea677d2 100644
--- a/libc/src/string/memcpy.cpp
+++ b/libc/src/string/memcpy.cpp
@@ -44,12 +44,8 @@ static void memcpy_impl(char *__restrict dst, const char *__restrict src,
     return CopyBlock<4>(dst, src);
   if (count < 8)
     return CopyBlockOverlap<4>(dst, src, count);
-  if (count == 8)
-    return CopyBlock<8>(dst, src);
   if (count < 16)
     return CopyBlockOverlap<8>(dst, src, count);
-  if (count == 16)
-    return CopyBlock<16>(dst, src);
   if (count < 32)
     return CopyBlockOverlap<16>(dst, src, count);
   if (count < 64)

diff  --git a/libc/src/string/x86/memcpy.cpp b/libc/src/string/x86/memcpy.cpp
index 811ce5183fe4..2e2148eb7289 100644
--- a/libc/src/string/x86/memcpy.cpp
+++ b/libc/src/string/x86/memcpy.cpp
@@ -59,12 +59,8 @@ static void memcpy_x86(char *__restrict dst, const char *__restrict src,
     return CopyBlock<4>(dst, src);
   if (count < 8)
     return CopyBlockOverlap<4>(dst, src, count);
-  if (count == 8)
-    return CopyBlock<8>(dst, src);
   if (count < 16)
     return CopyBlockOverlap<8>(dst, src, count);
-  if (count == 16)
-    return CopyBlock<16>(dst, src);
   if (count < 32)
     return CopyBlockOverlap<16>(dst, src, count);
   if (count < 64)


        


More information about the libc-commits mailing list