From fc059cac87d32b365e850ef2d6e8d6dc606a62cf Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Wed, 9 Oct 2019 17:52:58 +0300 Subject: [PATCH] Use AVX2 only if AVX is also present --- tz/hash.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tz/hash.go b/tz/hash.go index 863aa6c..25eb2fa 100644 --- a/tz/hash.go +++ b/tz/hash.go @@ -24,8 +24,10 @@ const ( ) var ( - hasAVX = cpuid.HasAVX() - hasAVX2 = cpuid.HasAVX2() + hasAVX = cpuid.HasAVX() + // Having AVX2 does not guarantee + // that AVX is also present. + hasAVX2 = cpuid.HasAVX2() && hasAVX ) func (impl Implementation) String() string {