| 1 | #include "LibcFunctionPrototypes.h" |
| 2 | #include "src/__support/macros/config.h" |
| 3 | #include "llvm/ADT/ArrayRef.h" |
| 4 | #include <cstddef> |
| 5 | |
| 6 | namespace LIBC_NAMESPACE_DECL { |
| 7 | |
| 8 | extern void *memcpy(void *__restrict, const void *__restrict, size_t); |
| 9 | extern void *memmove(void *, const void *, size_t); |
| 10 | extern void *memset(void *, int, size_t); |
| 11 | extern void bzero(void *, size_t); |
| 12 | extern int memcmp(const void *, const void *, size_t); |
| 13 | extern int bcmp(const void *, const void *, size_t); |
| 14 | |
| 15 | } // namespace LIBC_NAMESPACE_DECL |
| 16 | |
| 17 | // List of implementations to test. |
| 18 | |
| 19 | using llvm::libc_benchmarks::BzeroConfiguration; |
| 20 | using llvm::libc_benchmarks::MemcmpOrBcmpConfiguration; |
| 21 | using llvm::libc_benchmarks::MemcpyConfiguration; |
| 22 | using llvm::libc_benchmarks::MemmoveConfiguration; |
| 23 | using llvm::libc_benchmarks::MemsetConfiguration; |
| 24 | |
| 25 | llvm::ArrayRef<MemcpyConfiguration> getMemcpyConfigurations() { |
| 26 | static constexpr MemcpyConfiguration kMemcpyConfigurations[] = { |
| 27 | {LIBC_NAMESPACE::memcpy, "LIBC_NAMESPACE::memcpy" }}; |
| 28 | return llvm::ArrayRef(kMemcpyConfigurations); |
| 29 | } |
| 30 | llvm::ArrayRef<MemmoveConfiguration> getMemmoveConfigurations() { |
| 31 | static constexpr MemmoveConfiguration kMemmoveConfigurations[] = { |
| 32 | {LIBC_NAMESPACE::memmove, "LIBC_NAMESPACE::memmove" }}; |
| 33 | return llvm::ArrayRef(kMemmoveConfigurations); |
| 34 | } |
| 35 | llvm::ArrayRef<MemcmpOrBcmpConfiguration> getMemcmpConfigurations() { |
| 36 | static constexpr MemcmpOrBcmpConfiguration kMemcmpConfiguration[] = { |
| 37 | {LIBC_NAMESPACE::memcmp, "LIBC_NAMESPACE::memcmp" }}; |
| 38 | return llvm::ArrayRef(kMemcmpConfiguration); |
| 39 | } |
| 40 | llvm::ArrayRef<MemcmpOrBcmpConfiguration> getBcmpConfigurations() { |
| 41 | static constexpr MemcmpOrBcmpConfiguration kBcmpConfigurations[] = { |
| 42 | {LIBC_NAMESPACE::bcmp, "LIBC_NAMESPACE::bcmp" }}; |
| 43 | return llvm::ArrayRef(kBcmpConfigurations); |
| 44 | } |
| 45 | llvm::ArrayRef<MemsetConfiguration> getMemsetConfigurations() { |
| 46 | static constexpr MemsetConfiguration kMemsetConfigurations[] = { |
| 47 | {LIBC_NAMESPACE::memset, "LIBC_NAMESPACE::memset" }}; |
| 48 | return llvm::ArrayRef(kMemsetConfigurations); |
| 49 | } |
| 50 | llvm::ArrayRef<BzeroConfiguration> getBzeroConfigurations() { |
| 51 | static constexpr BzeroConfiguration kBzeroConfigurations[] = { |
| 52 | {LIBC_NAMESPACE::bzero, "LIBC_NAMESPACE::bzero" }}; |
| 53 | return llvm::ArrayRef(kBzeroConfigurations); |
| 54 | } |
| 55 | |