Skip to content

Commit

Permalink
Rename x86 crc_memcpy tests since they cover ARM as well
Browse files Browse the repository at this point in the history
This is a rename only with no other changes.

PiperOrigin-RevId: 563428969
Change-Id: Iefc184bf9a233cb72649bc20b8555f6b662cac6d
  • Loading branch information
Abseil Team authored and copybara-github committed Sep 7, 2023
1 parent 433289a commit 2c4ce9b
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions absl/crc/internal/crc_memcpy_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
namespace {

enum CrcEngine {
X86 = 0,
ACCELERATED = 0,
NONTEMPORAL = 1,
FALLBACK = 2,
};
Expand Down Expand Up @@ -66,10 +66,10 @@ typedef CrcMemcpyTest<4500> CrcSmallTest;
typedef CrcMemcpyTest<(1 << 24)> CrcLargeTest;
// Parametrize the small test so that it can be done with all configurations.
template <typename ParamsT>
class x86ParamTestTemplate : public CrcSmallTest,
public ::testing::WithParamInterface<ParamsT> {
class EngineParamTestTemplate : public CrcSmallTest,
public ::testing::WithParamInterface<ParamsT> {
protected:
x86ParamTestTemplate() {
EngineParamTestTemplate() {
if (GetParam().crc_engine_selector == FALLBACK) {
engine_ = std::make_unique<absl::crc_internal::FallbackCrcMemcpyEngine>();
} else if (GetParam().crc_engine_selector == NONTEMPORAL) {
Expand All @@ -89,14 +89,14 @@ class x86ParamTestTemplate : public CrcSmallTest,
std::unique_ptr<absl::crc_internal::CrcMemcpyEngine> engine_;
};
struct TestParams {
CrcEngine crc_engine_selector = X86;
CrcEngine crc_engine_selector = ACCELERATED;
int vector_lanes = 0;
int integer_lanes = 0;
};
using x86ParamTest = x86ParamTestTemplate<TestParams>;
using EngineParamTest = EngineParamTestTemplate<TestParams>;
// SmallCorrectness is designed to exercise every possible set of code paths
// in the memcpy code, not including the loop.
TEST_P(x86ParamTest, SmallCorrectnessCheckSourceAlignment) {
TEST_P(EngineParamTest, SmallCorrectnessCheckSourceAlignment) {
constexpr size_t kTestSizes[] = {0, 100, 255, 512, 1024, 4000, kMaxCopySize};

for (size_t source_alignment = 0; source_alignment < kAlignment;
Expand Down Expand Up @@ -130,7 +130,7 @@ TEST_P(x86ParamTest, SmallCorrectnessCheckSourceAlignment) {
}
}

TEST_P(x86ParamTest, SmallCorrectnessCheckDestAlignment) {
TEST_P(EngineParamTest, SmallCorrectnessCheckDestAlignment) {
constexpr size_t kTestSizes[] = {0, 100, 255, 512, 1024, 4000, kMaxCopySize};

for (size_t dest_alignment = 0; dest_alignment < kAlignment;
Expand Down Expand Up @@ -163,11 +163,12 @@ TEST_P(x86ParamTest, SmallCorrectnessCheckDestAlignment) {
}
}

INSTANTIATE_TEST_SUITE_P(x86ParamTest, x86ParamTest,
INSTANTIATE_TEST_SUITE_P(EngineParamTest, EngineParamTest,
::testing::Values(
// Tests for configurations that may occur in prod.
TestParams{X86, 3, 0}, TestParams{X86, 1, 2},
TestParams{X86, 1, 0},
TestParams{ACCELERATED, 3, 0},
TestParams{ACCELERATED, 1, 2},
TestParams{ACCELERATED, 1, 0},
// Fallback test.
TestParams{FALLBACK, 0, 0},
// Non Temporal
Expand Down

0 comments on commit 2c4ce9b

Please sign in to comment.