1) Improve the lookup table data to require less instructions to extract the necessary data. We now store len - offset in a signed int16, this happens to remove masking offset in the calculations and the calculations that need to be done precisely give the flags that we need for testing correctness.

2) Replace offset extraction with a lookup mask. This is less uops and is needed because we need to special case type 3 to always return 0 as to properly trigger the fallback.
3) Unroll the loop twice, this removes some loop-condition checks AND it improves the generated assembly. The loop variables tend to end up in a different register requiring mov's having two consecutive copies allows the elision of the mov's.

PiperOrigin-RevId: 346663328
This commit is contained in:
Snappy Team
2020-12-10 00:30:54 +00:00
committed by Victor Costan
parent a9730ed505
commit 3b571656fa
2 changed files with 190 additions and 128 deletions

View File

@@ -1368,7 +1368,7 @@ struct SourceFiles {
size_t max_size = 0;
};
static void BM_UFlatMedley(int iters, int) {
static void BM_UFlatMedley(int iters) {
static const SourceFiles* const source = new SourceFiles();
std::vector<char> dst(source->max_size);
@@ -1408,7 +1408,7 @@ static void BM_UValidate(int iters, int arg) {
}
BENCHMARK(BM_UValidate)->DenseRange(0, ARRAYSIZE(files) - 1);
static void BM_UValidateMedley(int iters, int) {
static void BM_UValidateMedley(int iters) {
static const SourceFiles* const source = new SourceFiles();
size_t processed = 0;