Skip to content

Commit b66c349

Browse files
committed
core(stat): add required CV_AVX_GUARD
Added guard with 'vzeroupper' instruction
1 parent c45d356 commit b66c349

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

modules/core/include/opencv2/core/cv_cpu_dispatch.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,12 @@ struct VZeroUpperGuard {
111111
#define __CV_AVX_GUARD VZeroUpperGuard __vzeroupper_guard;
112112
#endif
113113

114+
#ifdef __CV_AVX_GUARD
115+
#define CV_AVX_GUARD __CV_AVX_GUARD
116+
#else
117+
#define CV_AVX_GUARD
118+
#endif
119+
114120
#endif // __OPENCV_BUILD
115121

116122

modules/core/src/stat.simd.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ static inline int _mm256_extract_epi32_(__m256i reg, const int i)
2828

2929
int normHamming(const uchar* a, int n)
3030
{
31+
CV_AVX_GUARD;
32+
3133
int i = 0;
3234
int result = 0;
3335
#if CV_AVX2
@@ -94,6 +96,8 @@ int normHamming(const uchar* a, int n)
9496

9597
int normHamming(const uchar* a, const uchar* b, int n)
9698
{
99+
CV_AVX_GUARD;
100+
97101
int i = 0;
98102
int result = 0;
99103
#if CV_AVX2

0 commit comments

Comments
 (0)