aboutsummaryrefslogtreecommitdiff
path: root/libc/benchmarks
diff options
context:
space:
mode:
authorMichael Jones <michaelrj@google.com>2021-11-19 13:56:16 -0800
committerMichael Jones <michaelrj@google.com>2021-12-07 10:49:47 -0800
commit1c92911e9e1d503c0dfc4367da7f15d0dff50587 (patch)
tree56c5d73df9965c46cc730cfe462f533536c90d96 /libc/benchmarks
parent43e2f7cd248acf799bf97af2388940c9c39151e0 (diff)
downloadllvm-1c92911e9e1d503c0dfc4367da7f15d0dff50587.zip
llvm-1c92911e9e1d503c0dfc4367da7f15d0dff50587.tar.gz
llvm-1c92911e9e1d503c0dfc4367da7f15d0dff50587.tar.bz2
[libc] apply new lint rules
This patch applies the lint rules described in the previous patch. There was also a significant amount of effort put into manually fixing things, since all of the templated functions, or structs defined in /spec, were not updated and had to be handled manually. Reviewed By: sivachandra, lntue Differential Revision: https://reviews.llvm.org/D114302
Diffstat (limited to 'libc/benchmarks')
-rw-r--r--libc/benchmarks/automemcpy/lib/CodeGen.cpp22
-rw-r--r--libc/benchmarks/automemcpy/unittests/CodeGenTest.cpp90
2 files changed, 56 insertions, 56 deletions
diff --git a/libc/benchmarks/automemcpy/lib/CodeGen.cpp b/libc/benchmarks/automemcpy/lib/CodeGen.cpp
index f294a58..c150ab5 100644
--- a/libc/benchmarks/automemcpy/lib/CodeGen.cpp
+++ b/libc/benchmarks/automemcpy/lib/CodeGen.cpp
@@ -64,12 +64,12 @@ namespace functions {
// size_t size) {
// using namespace __llvm_libc::x86;
// if(size == 0) return;
-// if(size == 1) return Copy<_1>(dst, src);
-// if(size < 4) return Copy<HeadTail<_2>>(dst, src, size);
-// if(size < 8) return Copy<HeadTail<_4>>(dst, src, size);
-// if(size < 16) return Copy<HeadTail<_8>>(dst, src, size);
-// if(size < 32) return Copy<HeadTail<_16>>(dst, src, size);
-// return Copy<Accelerator>(dst, src, size);
+// if(size == 1) return copy<_1>(dst, src);
+// if(size < 4) return copy<HeadTail<_2>>(dst, src, size);
+// if(size < 8) return copy<HeadTail<_4>>(dst, src, size);
+// if(size < 16) return copy<HeadTail<_8>>(dst, src, size);
+// if(size < 32) return copy<HeadTail<_16>>(dst, src, size);
+// return copy<Accelerator>(dst, src, size);
// }
// The `Serialize` method turns a `NamedFunctionDescriptor` into a
@@ -114,7 +114,7 @@ struct Accelerator {
struct Context {
StringRef FunctionReturnType; // e.g. void* or int
StringRef FunctionArgs;
- StringRef ElementOp; // Copy, ThreeWayCompare, SplatSet, ...
+ StringRef ElementOp; // copy, three_way_compare, splat_set, ...
StringRef FixedSizeArgs;
StringRef RuntimeSizeArgs;
StringRef AlignArg1;
@@ -140,7 +140,7 @@ static Context getCtx(FunctionType FT) {
case FunctionType::MEMCPY:
return {"void",
"(char *__restrict dst, const char *__restrict src, size_t size)",
- "Copy",
+ "copy",
"(dst, src)",
"(dst, src, size)",
"Arg::Dst",
@@ -149,7 +149,7 @@ static Context getCtx(FunctionType FT) {
case FunctionType::MEMCMP:
return {"int",
"(const char * lhs, const char * rhs, size_t size)",
- "ThreeWayCompare",
+ "three_way_compare",
"(lhs, rhs)",
"(lhs, rhs, size)",
"Arg::Lhs",
@@ -158,7 +158,7 @@ static Context getCtx(FunctionType FT) {
case FunctionType::MEMSET:
return {"void",
"(char * dst, int value, size_t size)",
- "SplatSet",
+ "splat_set",
"(dst, value)",
"(dst, value, size)",
"Arg::Dst",
@@ -166,7 +166,7 @@ static Context getCtx(FunctionType FT) {
""};
case FunctionType::BZERO:
return {"void", "(char * dst, size_t size)",
- "SplatSet", "(dst, 0)",
+ "splat_set", "(dst, 0)",
"(dst, 0, size)", "Arg::Dst",
"Arg::Src", ""};
default:
diff --git a/libc/benchmarks/automemcpy/unittests/CodeGenTest.cpp b/libc/benchmarks/automemcpy/unittests/CodeGenTest.cpp
index 6849682..d87b27b 100644
--- a/libc/benchmarks/automemcpy/unittests/CodeGenTest.cpp
+++ b/libc/benchmarks/automemcpy/unittests/CodeGenTest.cpp
@@ -65,71 +65,71 @@ namespace __llvm_libc {
static void memcpy_0xE00E29EE73994E2B(char *__restrict dst, const char *__restrict src, size_t size) {
using namespace __llvm_libc::x86;
- return Copy<Accelerator>(dst, src, size);
+ return copy<Accelerator>(dst, src, size);
}
static void memcpy_0x7381B60C7BE75EF9(char *__restrict dst, const char *__restrict src, size_t size) {
using namespace __llvm_libc::x86;
if(size == 0) return;
- if(size == 1) return Copy<_1>(dst, src);
- if(size == 2) return Copy<_2>(dst, src);
- if(size == 3) return Copy<_3>(dst, src);
- if(size < 8) return Copy<HeadTail<_4>>(dst, src, size);
- if(size < 16) return Copy<HeadTail<_8>>(dst, src, size);
- if(size < 32) return Copy<HeadTail<_16>>(dst, src, size);
- if(size < 64) return Copy<HeadTail<_32>>(dst, src, size);
- if(size < 128) return Copy<HeadTail<_64>>(dst, src, size);
- if(size < 256) return Copy<HeadTail<_128>>(dst, src, size);
- return Copy<Loop<_64>>(dst, src, size);
+ if(size == 1) return copy<_1>(dst, src);
+ if(size == 2) return copy<_2>(dst, src);
+ if(size == 3) return copy<_3>(dst, src);
+ if(size < 8) return copy<HeadTail<_4>>(dst, src, size);
+ if(size < 16) return copy<HeadTail<_8>>(dst, src, size);
+ if(size < 32) return copy<HeadTail<_16>>(dst, src, size);
+ if(size < 64) return copy<HeadTail<_32>>(dst, src, size);
+ if(size < 128) return copy<HeadTail<_64>>(dst, src, size);
+ if(size < 256) return copy<HeadTail<_128>>(dst, src, size);
+ return copy<Loop<_64>>(dst, src, size);
}
static int memcmp_0x348D7BA6DB0EE033(const char * lhs, const char * rhs, size_t size) {
using namespace __llvm_libc::x86;
if(size == 0) return 0;
- if(size == 1) return ThreeWayCompare<_1>(lhs, rhs);
- if(size < 4) return ThreeWayCompare<HeadTail<_2>>(lhs, rhs, size);
- if(size < 8) return ThreeWayCompare<HeadTail<_4>>(lhs, rhs, size);
- if(size < 16) return ThreeWayCompare<HeadTail<_8>>(lhs, rhs, size);
- if(size < 32) return ThreeWayCompare<HeadTail<_16>>(lhs, rhs, size);
- if(size < 64) return ThreeWayCompare<HeadTail<_32>>(lhs, rhs, size);
- return ThreeWayCompare<Align<_16,Arg::Lhs>::Then<Loop<_16>>>(lhs, rhs, size);
+ if(size == 1) return three_way_compare<_1>(lhs, rhs);
+ if(size < 4) return three_way_compare<HeadTail<_2>>(lhs, rhs, size);
+ if(size < 8) return three_way_compare<HeadTail<_4>>(lhs, rhs, size);
+ if(size < 16) return three_way_compare<HeadTail<_8>>(lhs, rhs, size);
+ if(size < 32) return three_way_compare<HeadTail<_16>>(lhs, rhs, size);
+ if(size < 64) return three_way_compare<HeadTail<_32>>(lhs, rhs, size);
+ return three_way_compare<Align<_16,Arg::Lhs>::Then<Loop<_16>>>(lhs, rhs, size);
}
static void memset_0x71E761699B999863(char * dst, int value, size_t size) {
using namespace __llvm_libc::x86;
if(size == 0) return;
- if(size == 1) return SplatSet<_1>(dst, value);
- if(size < 4) return SplatSet<HeadTail<_2>>(dst, value, size);
- if(size < 8) return SplatSet<HeadTail<_4>>(dst, value, size);
- if(size < 16) return SplatSet<HeadTail<_8>>(dst, value, size);
- if(size < 32) return SplatSet<HeadTail<_16>>(dst, value, size);
- if(size < 64) return SplatSet<HeadTail<_32>>(dst, value, size);
- if(size < 128) return SplatSet<HeadTail<_64>>(dst, value, size);
- if(size < 256) return SplatSet<HeadTail<_128>>(dst, value, size);
- return SplatSet<Align<_16,Arg::Dst>::Then<Loop<_32>>>(dst, value, size);
+ if(size == 1) return splat_set<_1>(dst, value);
+ if(size < 4) return splat_set<HeadTail<_2>>(dst, value, size);
+ if(size < 8) return splat_set<HeadTail<_4>>(dst, value, size);
+ if(size < 16) return splat_set<HeadTail<_8>>(dst, value, size);
+ if(size < 32) return splat_set<HeadTail<_16>>(dst, value, size);
+ if(size < 64) return splat_set<HeadTail<_32>>(dst, value, size);
+ if(size < 128) return splat_set<HeadTail<_64>>(dst, value, size);
+ if(size < 256) return splat_set<HeadTail<_128>>(dst, value, size);
+ return splat_set<Align<_16,Arg::Dst>::Then<Loop<_32>>>(dst, value, size);
}
static void memset_0x3DF0F44E2ED6A50F(char * dst, int value, size_t size) {
using namespace __llvm_libc::x86;
if(size == 0) return;
- if(size == 1) return SplatSet<_1>(dst, value);
- if(size < 4) return SplatSet<HeadTail<_2>>(dst, value, size);
- if(size < 8) return SplatSet<HeadTail<_4>>(dst, value, size);
- if(size < 16) return SplatSet<HeadTail<_8>>(dst, value, size);
- if(size < 32) return SplatSet<HeadTail<_16>>(dst, value, size);
- if(size < 64) return SplatSet<HeadTail<_32>>(dst, value, size);
- if(size < 128) return SplatSet<HeadTail<_64>>(dst, value, size);
- if(size < 256) return SplatSet<HeadTail<_128>>(dst, value, size);
- return SplatSet<Align<_32,Arg::Dst>::Then<Loop<_32>>>(dst, value, size);
+ if(size == 1) return splat_set<_1>(dst, value);
+ if(size < 4) return splat_set<HeadTail<_2>>(dst, value, size);
+ if(size < 8) return splat_set<HeadTail<_4>>(dst, value, size);
+ if(size < 16) return splat_set<HeadTail<_8>>(dst, value, size);
+ if(size < 32) return splat_set<HeadTail<_16>>(dst, value, size);
+ if(size < 64) return splat_set<HeadTail<_32>>(dst, value, size);
+ if(size < 128) return splat_set<HeadTail<_64>>(dst, value, size);
+ if(size < 256) return splat_set<HeadTail<_128>>(dst, value, size);
+ return splat_set<Align<_32,Arg::Dst>::Then<Loop<_32>>>(dst, value, size);
}
static void bzero_0x475977492C218AD4(char * dst, size_t size) {
using namespace __llvm_libc::x86;
if(size == 0) return;
- if(size == 1) return SplatSet<_1>(dst, 0);
- if(size == 2) return SplatSet<_2>(dst, 0);
- if(size == 3) return SplatSet<_3>(dst, 0);
- if(size < 8) return SplatSet<HeadTail<_4>>(dst, 0, size);
- if(size < 16) return SplatSet<HeadTail<_8>>(dst, 0, size);
- if(size < 32) return SplatSet<HeadTail<_16>>(dst, 0, size);
- if(size < 64) return SplatSet<HeadTail<_32>>(dst, 0, size);
- if(size < 128) return SplatSet<HeadTail<_64>>(dst, 0, size);
- return SplatSet<Align<_32,Arg::Dst>::Then<Loop<_32>>>(dst, 0, size);
+ if(size == 1) return splat_set<_1>(dst, 0);
+ if(size == 2) return splat_set<_2>(dst, 0);
+ if(size == 3) return splat_set<_3>(dst, 0);
+ if(size < 8) return splat_set<HeadTail<_4>>(dst, 0, size);
+ if(size < 16) return splat_set<HeadTail<_8>>(dst, 0, size);
+ if(size < 32) return splat_set<HeadTail<_16>>(dst, 0, size);
+ if(size < 64) return splat_set<HeadTail<_32>>(dst, 0, size);
+ if(size < 128) return splat_set<HeadTail<_64>>(dst, 0, size);
+ return splat_set<Align<_32,Arg::Dst>::Then<Loop<_32>>>(dst, 0, size);
}
} // namespace __llvm_libc