[libc-commits] [PATCH] D81621: [libc] Remove dead code from memcpy to make it machine independent.

Siva Chandra via Phabricator via libc-commits libc-commits at lists.llvm.org
Fri Jun 12 14:14:46 PDT 2020


sivachandra added a comment.

In D81621#2090722 <https://reviews.llvm.org/D81621#2090722>, @gchatelet wrote:

> In D81621#2086447 <https://reviews.llvm.org/D81621#2086447>, @sivachandra wrote:
>
> > I am trying to get the string functions work on aarch64. While `memset` and `bzero` work as is, `memcpy` does not because of the x86 specific arrangement we have currently. The x86 specific pieces are actually in dead code. So I went ahead and removed them in this patch. If required in future, we should add it back in a fashion which does not break the build for non-x86 architectures.
>
>
> `memset` and `bzero` are generic and can be used as-is for all architectures.
>  They may need to be tweaked for individual architecture later on but the current code is good enough.
>
> `memcpy`is a different story. The C++ implementation is quite tied to x86 so I would rather duplicate the code.
>  Keep the one we have with the reference to AVX and repmovsb for x86 (`libc/src/string/x86/memcpy.cpp`)
>  Duplicate it without AVX / Repmovsb for a generic implementation (`libc/src/string/memcpy.cpp`)
>  It also sets an example for anyone wanting to provide an architecture specific implementation.
>
> Thx for the `-O2` flag!


OK. I have updated as you suggest.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81621





More information about the libc-commits mailing list