util/bufferiszero: assign length_to_accel value for each accelerator case

Because in unit test, init_accel() will be called several times, each with
different accelerator type.

Signed-off-by: Robert Hoo <robert.hu@linux.intel.com>
Message-Id: <1585119021-46593-1-git-send-email-robert.hu@linux.intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Robert Hoo 2020-03-25 14:50:20 +08:00 committed by Paolo Bonzini
parent 674fc21ff6
commit b87c99d073
1 changed files with 3 additions and 0 deletions

View File

@ -254,13 +254,16 @@ static void init_accel(unsigned cache)
bool (*fn)(const void *, size_t) = buffer_zero_int;
if (cache & CACHE_SSE2) {
fn = buffer_zero_sse2;
length_to_accel = 64;
}
#ifdef CONFIG_AVX2_OPT
if (cache & CACHE_SSE4) {
fn = buffer_zero_sse4;
length_to_accel = 64;
}
if (cache & CACHE_AVX2) {
fn = buffer_zero_avx2;
length_to_accel = 64;
}
#endif
#ifdef CONFIG_AVX512F_OPT