[libc-commits] [PATCH] D74397: [libc] Adding memcpy implementation for x86_64

Guillaume Chatelet via Phabricator via libc-commits libc-commits at lists.llvm.org
Tue Feb 11 04:58:13 PST 2020


gchatelet created this revision.
gchatelet added reviewers: sivachandra, abrachet.
Herald added subscribers: libc-commits, tschuett, MaskRay, mgorny.
Herald added a project: libc-project.

The patch is not ready yet and is here to discuss a few options:

- How do we customize the implementation? (i.e. how to define `kRepMovsBSize`),
- How do we specify custom compilation flags? (We'd need `-fno-builtin-memcpy` to be passed in),
- How do we build? We may want to test in debug but build the libc with `-march=native` for instance,
- Clang has a brand new builtin `__builtin_memcpy_inline` which makes the implementation easy and efficient, but:
  - If we compile with `gcc` or `msvc` we can't use it, resorting on less efficient code generation,
  - With gcc we can use `__builtin_memcpy` but then we'd need a postprocess step to check that the final assembly do not contain call to `memcpy` (unlikely but allowed),
  - For msvc we'd need to resort on the compiler optimization passes.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D74397

Files:
  libc/src/string/CMakeLists.txt
  libc/src/string/memcpy.h
  libc/src/string/memcpy_x86_64.cpp
  libc/src/string/memory_utils/CMakeLists.txt
  libc/src/string/memory_utils/memcpy_utils.h
  libc/src/string/memory_utils/utils.h
  libc/test/src/string/CMakeLists.txt
  libc/test/src/string/memcpy_test.cpp
  libc/test/src/string/memory_utils/CMakeLists.txt
  libc/test/src/string/memory_utils/memcpy_utils_test.cpp
  libc/test/src/string/memory_utils/utils_test.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D74397.243817.patch
Type: text/x-patch
Size: 16549 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20200211/d0831650/attachment.bin>


More information about the libc-commits mailing list