core(stat): add required CV_AVX_GUARD

Added guard with 'vzeroupper' instruction
This commit is contained in:
Alexander Alekhin 2017-07-02 15:33:05 +00:00
parent c45d3568ae
commit b66c349bba
2 changed files with 10 additions and 0 deletions

View File

@ -111,6 +111,12 @@ struct VZeroUpperGuard {
#define __CV_AVX_GUARD VZeroUpperGuard __vzeroupper_guard; #define __CV_AVX_GUARD VZeroUpperGuard __vzeroupper_guard;
#endif #endif
#ifdef __CV_AVX_GUARD
#define CV_AVX_GUARD __CV_AVX_GUARD
#else
#define CV_AVX_GUARD
#endif
#endif // __OPENCV_BUILD #endif // __OPENCV_BUILD

View File

@ -28,6 +28,8 @@ static inline int _mm256_extract_epi32_(__m256i reg, const int i)
int normHamming(const uchar* a, int n) int normHamming(const uchar* a, int n)
{ {
CV_AVX_GUARD;
int i = 0; int i = 0;
int result = 0; int result = 0;
#if CV_AVX2 #if CV_AVX2
@ -94,6 +96,8 @@ int normHamming(const uchar* a, int n)
int normHamming(const uchar* a, const uchar* b, int n) int normHamming(const uchar* a, const uchar* b, int n)
{ {
CV_AVX_GUARD;
int i = 0; int i = 0;
int result = 0; int result = 0;
#if CV_AVX2 #if CV_AVX2