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