2021-09-30 21:10:45 +08:00
|
|
|
#include "LibcFunctionPrototypes.h"
|
|
|
|
#include "llvm/ADT/ArrayRef.h"
|
|
|
|
#include <cstddef>
|
|
|
|
|
|
|
|
namespace __llvm_libc {
|
|
|
|
|
|
|
|
extern void *memcpy(void *__restrict, const void *__restrict, size_t);
|
2021-11-30 18:46:16 +08:00
|
|
|
extern void *memmove(void *, const void *, size_t);
|
2021-09-30 21:10:45 +08:00
|
|
|
extern void *memset(void *, int, size_t);
|
|
|
|
extern void bzero(void *, size_t);
|
|
|
|
extern int memcmp(const void *, const void *, size_t);
|
|
|
|
extern int bcmp(const void *, const void *, size_t);
|
|
|
|
|
|
|
|
} // namespace __llvm_libc
|
|
|
|
|
|
|
|
// List of implementations to test.
|
|
|
|
|
|
|
|
using llvm::libc_benchmarks::BzeroConfiguration;
|
2021-10-15 17:26:12 +08:00
|
|
|
using llvm::libc_benchmarks::MemcmpOrBcmpConfiguration;
|
2021-09-30 21:10:45 +08:00
|
|
|
using llvm::libc_benchmarks::MemcpyConfiguration;
|
2021-11-30 18:46:16 +08:00
|
|
|
using llvm::libc_benchmarks::MemmoveConfiguration;
|
2021-09-30 21:10:45 +08:00
|
|
|
using llvm::libc_benchmarks::MemsetConfiguration;
|
|
|
|
|
|
|
|
llvm::ArrayRef<MemcpyConfiguration> getMemcpyConfigurations() {
|
|
|
|
static constexpr MemcpyConfiguration kMemcpyConfigurations[] = {
|
|
|
|
{__llvm_libc::memcpy, "__llvm_libc::memcpy"}};
|
|
|
|
return llvm::makeArrayRef(kMemcpyConfigurations);
|
|
|
|
}
|
2021-11-30 18:46:16 +08:00
|
|
|
llvm::ArrayRef<MemmoveConfiguration> getMemmoveConfigurations() {
|
|
|
|
static constexpr MemmoveConfiguration kMemmoveConfigurations[] = {
|
|
|
|
{__llvm_libc::memmove, "__llvm_libc::memmove"}};
|
|
|
|
return llvm::makeArrayRef(kMemmoveConfigurations);
|
|
|
|
}
|
2021-10-15 17:26:12 +08:00
|
|
|
llvm::ArrayRef<MemcmpOrBcmpConfiguration> getMemcmpConfigurations() {
|
|
|
|
static constexpr MemcmpOrBcmpConfiguration kMemcmpConfiguration[] = {
|
2021-09-30 21:10:45 +08:00
|
|
|
{__llvm_libc::memcmp, "__llvm_libc::memcmp"}};
|
2021-10-15 17:26:12 +08:00
|
|
|
return llvm::makeArrayRef(kMemcmpConfiguration);
|
2021-09-30 21:10:45 +08:00
|
|
|
}
|
2021-10-15 17:26:12 +08:00
|
|
|
llvm::ArrayRef<MemcmpOrBcmpConfiguration> getBcmpConfigurations() {
|
|
|
|
static constexpr MemcmpOrBcmpConfiguration kBcmpConfigurations[] = {
|
2021-09-30 21:10:45 +08:00
|
|
|
{__llvm_libc::bcmp, "__llvm_libc::bcmp"}};
|
|
|
|
return llvm::makeArrayRef(kBcmpConfigurations);
|
|
|
|
}
|
|
|
|
llvm::ArrayRef<MemsetConfiguration> getMemsetConfigurations() {
|
|
|
|
static constexpr MemsetConfiguration kMemsetConfigurations[] = {
|
|
|
|
{__llvm_libc::memset, "__llvm_libc::memset"}};
|
|
|
|
return llvm::makeArrayRef(kMemsetConfigurations);
|
|
|
|
}
|
|
|
|
llvm::ArrayRef<BzeroConfiguration> getBzeroConfigurations() {
|
|
|
|
static constexpr BzeroConfiguration kBzeroConfigurations[] = {
|
|
|
|
{__llvm_libc::bzero, "__llvm_libc::bzero"}};
|
|
|
|
return llvm::makeArrayRef(kBzeroConfigurations);
|
2021-10-15 17:26:12 +08:00
|
|
|
}
|