Commit 2c4ce9b2 by Abseil Team Committed by Copybara-Service

Rename x86 crc_memcpy tests since they cover ARM as well

This is a rename only with no other changes.

PiperOrigin-RevId: 563428969
Change-Id: Iefc184bf9a233cb72649bc20b8555f6b662cac6d
parent 433289a2
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
namespace { namespace {
enum CrcEngine { enum CrcEngine {
X86 = 0, ACCELERATED = 0,
NONTEMPORAL = 1, NONTEMPORAL = 1,
FALLBACK = 2, FALLBACK = 2,
}; };
...@@ -66,10 +66,10 @@ typedef CrcMemcpyTest<4500> CrcSmallTest; ...@@ -66,10 +66,10 @@ typedef CrcMemcpyTest<4500> CrcSmallTest;
typedef CrcMemcpyTest<(1 << 24)> CrcLargeTest; typedef CrcMemcpyTest<(1 << 24)> CrcLargeTest;
// Parametrize the small test so that it can be done with all configurations. // Parametrize the small test so that it can be done with all configurations.
template <typename ParamsT> template <typename ParamsT>
class x86ParamTestTemplate : public CrcSmallTest, class EngineParamTestTemplate : public CrcSmallTest,
public ::testing::WithParamInterface<ParamsT> { public ::testing::WithParamInterface<ParamsT> {
protected: protected:
x86ParamTestTemplate() { EngineParamTestTemplate() {
if (GetParam().crc_engine_selector == FALLBACK) { if (GetParam().crc_engine_selector == FALLBACK) {
engine_ = std::make_unique<absl::crc_internal::FallbackCrcMemcpyEngine>(); engine_ = std::make_unique<absl::crc_internal::FallbackCrcMemcpyEngine>();
} else if (GetParam().crc_engine_selector == NONTEMPORAL) { } else if (GetParam().crc_engine_selector == NONTEMPORAL) {
...@@ -89,14 +89,14 @@ class x86ParamTestTemplate : public CrcSmallTest, ...@@ -89,14 +89,14 @@ class x86ParamTestTemplate : public CrcSmallTest,
std::unique_ptr<absl::crc_internal::CrcMemcpyEngine> engine_; std::unique_ptr<absl::crc_internal::CrcMemcpyEngine> engine_;
}; };
struct TestParams { struct TestParams {
CrcEngine crc_engine_selector = X86; CrcEngine crc_engine_selector = ACCELERATED;
int vector_lanes = 0; int vector_lanes = 0;
int integer_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 // SmallCorrectness is designed to exercise every possible set of code paths
// in the memcpy code, not including the loop. // 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}; constexpr size_t kTestSizes[] = {0, 100, 255, 512, 1024, 4000, kMaxCopySize};
for (size_t source_alignment = 0; source_alignment < kAlignment; for (size_t source_alignment = 0; source_alignment < kAlignment;
...@@ -130,7 +130,7 @@ TEST_P(x86ParamTest, SmallCorrectnessCheckSourceAlignment) { ...@@ -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}; constexpr size_t kTestSizes[] = {0, 100, 255, 512, 1024, 4000, kMaxCopySize};
for (size_t dest_alignment = 0; dest_alignment < kAlignment; for (size_t dest_alignment = 0; dest_alignment < kAlignment;
...@@ -163,11 +163,12 @@ TEST_P(x86ParamTest, SmallCorrectnessCheckDestAlignment) { ...@@ -163,11 +163,12 @@ TEST_P(x86ParamTest, SmallCorrectnessCheckDestAlignment) {
} }
} }
INSTANTIATE_TEST_SUITE_P(x86ParamTest, x86ParamTest, INSTANTIATE_TEST_SUITE_P(EngineParamTest, EngineParamTest,
::testing::Values( ::testing::Values(
// Tests for configurations that may occur in prod. // Tests for configurations that may occur in prod.
TestParams{X86, 3, 0}, TestParams{X86, 1, 2}, TestParams{ACCELERATED, 3, 0},
TestParams{X86, 1, 0}, TestParams{ACCELERATED, 1, 2},
TestParams{ACCELERATED, 1, 0},
// Fallback test. // Fallback test.
TestParams{FALLBACK, 0, 0}, TestParams{FALLBACK, 0, 0},
// Non Temporal // Non Temporal
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment