[libc-commits] [libc] 4a9bcb6 - [libc] Memory function benchmarks: rename MemcmpConfiguration in MemcmpOrBcmpConfiguration

Guillaume Chatelet via libc-commits libc-commits at lists.llvm.org
Fri Oct 15 06:42:37 PDT 2021


Author: Guillaume Chatelet
Date: 2021-10-15T13:42:29Z
New Revision: 4a9bcb605b32e9bde2ddc9fe5b9bfefa11f49831

URL: https://github.com/llvm/llvm-project/commit/4a9bcb605b32e9bde2ddc9fe5b9bfefa11f49831
DIFF: https://github.com/llvm/llvm-project/commit/4a9bcb605b32e9bde2ddc9fe5b9bfefa11f49831.diff

LOG: [libc] Memory function benchmarks: rename MemcmpConfiguration in MemcmpOrBcmpConfiguration

This will help make sense of the double use of the same type in https://reviews.llvm.org/D111622#inline-1065560.

Differential Revision: https://reviews.llvm.org/D111868

Added: 
    

Modified: 
    libc/benchmarks/LibcDefaultImplementations.cpp
    libc/benchmarks/LibcFunctionPrototypes.h
    libc/benchmarks/LibcMemoryBenchmark.h
    libc/benchmarks/LibcMemoryGoogleBenchmarkMain.cpp

Removed: 
    


################################################################################
diff  --git a/libc/benchmarks/LibcDefaultImplementations.cpp b/libc/benchmarks/LibcDefaultImplementations.cpp
index bf362f2b7c4f1..75ee6cf7a31bc 100644
--- a/libc/benchmarks/LibcDefaultImplementations.cpp
+++ b/libc/benchmarks/LibcDefaultImplementations.cpp
@@ -15,7 +15,7 @@ extern int bcmp(const void *, const void *, size_t);
 // List of implementations to test.
 
 using llvm::libc_benchmarks::BzeroConfiguration;
-using llvm::libc_benchmarks::MemcmpConfiguration;
+using llvm::libc_benchmarks::MemcmpOrBcmpConfiguration;
 using llvm::libc_benchmarks::MemcpyConfiguration;
 using llvm::libc_benchmarks::MemsetConfiguration;
 
@@ -24,13 +24,13 @@ llvm::ArrayRef<MemcpyConfiguration> getMemcpyConfigurations() {
       {__llvm_libc::memcpy, "__llvm_libc::memcpy"}};
   return llvm::makeArrayRef(kMemcpyConfigurations);
 }
-llvm::ArrayRef<MemcmpConfiguration> getMemcmpConfigurations() {
-  static constexpr MemcmpConfiguration kMemcmpConfigurations[] = {
+llvm::ArrayRef<MemcmpOrBcmpConfiguration> getMemcmpConfigurations() {
+  static constexpr MemcmpOrBcmpConfiguration kMemcmpConfiguration[] = {
       {__llvm_libc::memcmp, "__llvm_libc::memcmp"}};
-  return llvm::makeArrayRef(kMemcmpConfigurations);
+  return llvm::makeArrayRef(kMemcmpConfiguration);
 }
-llvm::ArrayRef<MemcmpConfiguration> getBcmpConfigurations() {
-  static constexpr MemcmpConfiguration kBcmpConfigurations[] = {
+llvm::ArrayRef<MemcmpOrBcmpConfiguration> getBcmpConfigurations() {
+  static constexpr MemcmpOrBcmpConfiguration kBcmpConfigurations[] = {
       {__llvm_libc::bcmp, "__llvm_libc::bcmp"}};
   return llvm::makeArrayRef(kBcmpConfigurations);
 }
@@ -43,4 +43,4 @@ llvm::ArrayRef<BzeroConfiguration> getBzeroConfigurations() {
   static constexpr BzeroConfiguration kBzeroConfigurations[] = {
       {__llvm_libc::bzero, "__llvm_libc::bzero"}};
   return llvm::makeArrayRef(kBzeroConfigurations);
-}
\ No newline at end of file
+}

diff  --git a/libc/benchmarks/LibcFunctionPrototypes.h b/libc/benchmarks/LibcFunctionPrototypes.h
index e856c9138157e..561795a379db9 100644
--- a/libc/benchmarks/LibcFunctionPrototypes.h
+++ b/libc/benchmarks/LibcFunctionPrototypes.h
@@ -26,9 +26,9 @@ struct BzeroConfiguration {
   llvm::StringRef Name;
 };
 
-using MemcmpFunction = int (*)(const void *, const void *, size_t);
-struct MemcmpConfiguration {
-  MemcmpFunction Function;
+using MemcmpOrBcmpFunction = int (*)(const void *, const void *, size_t);
+struct MemcmpOrBcmpConfiguration {
+  MemcmpOrBcmpFunction Function;
   llvm::StringRef Name;
 };
 

diff  --git a/libc/benchmarks/LibcMemoryBenchmark.h b/libc/benchmarks/LibcMemoryBenchmark.h
index eaba899544e25..0c4b49f5dc878 100644
--- a/libc/benchmarks/LibcMemoryBenchmark.h
+++ b/libc/benchmarks/LibcMemoryBenchmark.h
@@ -238,9 +238,9 @@ struct ComparisonSetup : public ParameterBatch {
     return getMemcmpSizeDistributions();
   }
 
-  inline int Call(ParameterType Parameter, MemcmpFunction Memcmp) {
-    return Memcmp(LhsBuffer + Parameter.OffsetBytes,
-                  RhsBuffer + Parameter.OffsetBytes, Parameter.SizeBytes);
+  inline int Call(ParameterType Parameter, MemcmpOrBcmpFunction MemcmpOrBcmp) {
+    return MemcmpOrBcmp(LhsBuffer + Parameter.OffsetBytes,
+                        RhsBuffer + Parameter.OffsetBytes, Parameter.SizeBytes);
   }
 
 private:

diff  --git a/libc/benchmarks/LibcMemoryGoogleBenchmarkMain.cpp b/libc/benchmarks/LibcMemoryGoogleBenchmarkMain.cpp
index 0941c739bc6fb..1d7ab328965a7 100644
--- a/libc/benchmarks/LibcMemoryGoogleBenchmarkMain.cpp
+++ b/libc/benchmarks/LibcMemoryGoogleBenchmarkMain.cpp
@@ -15,7 +15,7 @@ using llvm::Twine;
 using llvm::libc_benchmarks::BzeroConfiguration;
 using llvm::libc_benchmarks::ComparisonSetup;
 using llvm::libc_benchmarks::CopySetup;
-using llvm::libc_benchmarks::MemcmpConfiguration;
+using llvm::libc_benchmarks::MemcmpOrBcmpConfiguration;
 using llvm::libc_benchmarks::MemcpyConfiguration;
 using llvm::libc_benchmarks::MemorySizeDistribution;
 using llvm::libc_benchmarks::MemsetConfiguration;
@@ -94,12 +94,12 @@ extern llvm::ArrayRef<MemcpyConfiguration> getMemcpyConfigurations();
 BENCHMARK_MEMORY_FUNCTION(BM_Memcpy, CopySetup, MemcpyConfiguration,
                           getMemcpyConfigurations());
 
-extern llvm::ArrayRef<MemcmpConfiguration> getMemcmpConfigurations();
-BENCHMARK_MEMORY_FUNCTION(BM_Memcmp, ComparisonSetup, MemcmpConfiguration,
+extern llvm::ArrayRef<MemcmpOrBcmpConfiguration> getMemcmpConfigurations();
+BENCHMARK_MEMORY_FUNCTION(BM_Memcmp, ComparisonSetup, MemcmpOrBcmpConfiguration,
                           getMemcmpConfigurations());
 
-extern llvm::ArrayRef<MemcmpConfiguration> getBcmpConfigurations();
-BENCHMARK_MEMORY_FUNCTION(BM_Bcmp, ComparisonSetup, MemcmpConfiguration,
+extern llvm::ArrayRef<MemcmpOrBcmpConfiguration> getBcmpConfigurations();
+BENCHMARK_MEMORY_FUNCTION(BM_Bcmp, ComparisonSetup, MemcmpOrBcmpConfiguration,
                           getBcmpConfigurations());
 
 extern llvm::ArrayRef<MemsetConfiguration> getMemsetConfigurations();


        


More information about the libc-commits mailing list