This is an archive of the discontinued LLVM Phabricator instance.

[libc] Allow customization of memcpy via flags.
ClosedPublic

Authored by gchatelet on Jan 14 2021, 7:53 AM.

Details

Summary
  • Adds LLVM_LIBC_IS_DEFINED macro to libc/src/__support/common.h
  • Adds a few knobs to memcpy to help with experimentations:
    • LLVM_LIBC_MEMCPY_X86_USE_ONLY_REPMOVSB replaces the implementation with a single call to rep;movsb
    • LLVM_LIBC_MEMCPY_X86_USE_REPMOVSB_FROM_SIZE customizes where the usage of rep;movsb

Diff Detail

Event Timeline

gchatelet created this revision.Jan 14 2021, 7:53 AM
gchatelet requested review of this revision.Jan 14 2021, 7:53 AM
sivachandra accepted this revision.Jan 14 2021, 9:10 AM

Few inline nits.

libc/src/__support/common.h
42

In other places, we have named such namespaces as internal.

45

Just pointing out, we cannot use the C++ standard library. So, this comment should either be removed or updated suitably.

libc/src/string/x86/memcpy.cpp
91

Can we use the early return pattern for this as well without the else?

if (kUseOnlyRepMovSb)
  return CopyRepMovsb(...);
This revision is now accepted and ready to land.Jan 14 2021, 9:10 AM

There is -nostdinc++.

gchatelet updated this revision to Diff 316869.Jan 15 2021, 1:24 AM
gchatelet marked 3 inline comments as done.
  • Address comments
This revision was landed with ongoing or failed builds.Jan 15 2021, 1:27 AM
This revision was automatically updated to reflect the committed changes.