Page MenuHomePhabricator

[libc] Allow customization of memcpy via flags.
ClosedPublic

Authored by gchatelet on Thu, Jan 14, 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.Thu, Jan 14, 7:53 AM
gchatelet requested review of this revision.Thu, Jan 14, 7:53 AM
sivachandra accepted this revision.Thu, Jan 14, 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.Thu, Jan 14, 9:10 AM

There is -nostdinc++.

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