Building OpenCV 3.2.0 with MinGW-w64 6.1.0: evaluating arguments at compile time faiIure

The compiler does not work with this output:

In file included from C:/mingw-w64/x86_64-6.1.0-win32-seh-rt_v5-rev0/mingw64/lib/gcc/x86_64-w64-mingw32/6.1.0/include/emmintrin.h:31:0,
                 from C:/lib/opencv/sources/modules/core/include/opencv2/core/cvdef.h:168,
                 from C:/lib/opencv/sources/modules/core/include/opencv2/core.hpp:52,
                 from C:/lib/opencv/sources/modules/core/include/opencv2/core/utility.hpp:56,
                 from C:/lib/opencv/sources/cmake-build-debug/modules/core/precomp.hpp:49:

C:/lib/opencv/sources/modules/core/include/opencv2/core/sse_utils.hpp: 
    In function 'void _mm_interleave_ps(__m128&, __m128&, __m128&, __m128&)':
C:/lib/opencv/sources/modules/core/include/opencv2/core/sse_utils.hpp:572:28: 
    error: the last argument must be an 8-bit immediate
    __m128 layer2_chunk0 = _mm_shuffle_ps(v_r0, v_r1, mask_lo);
                           ^

With this function:

inline void _mm_interleave_ps(__m128 & v_r0, __m128 & v_r1, __m128 & v_g0, __m128 & v_g1)
{
    const int mask_lo = _MM_SHUFFLE(2, 0, 2, 0), mask_hi = _MM_SHUFFLE(3, 1, 3, 1);
    __m128 layer2_chunk0 = _mm_shuffle_ps(v_r0, v_r1, mask_lo);
...

Given that _MM_SHUFFLEthis is a macro, masks should be calculated at compile time:

#define _MM_SHUFFLE(fp3,fp2,fp1,fp0) \
    (((fp3) << 6) | ((fp2) << 4) | ((fp1) << 2) | (fp0))

Therefore, I tried to replace const int ...with constexpr int ..., but it did not give effect.

The only workaround I found is here , but it doesn’t answer why the masks aren’t right away and why threads can affect this.

Any way to fix this more or less decently, with the exception of hard coding 0x88and 0xDDhow _mm_shuffle_ps(v_r0, v_r1, 0x88)?
It works, but obviously is not a good solution. Moreover, this file is not the only one that has this problem.

, constexpr int mask_lo = 0x88 ?

+1

Source: https://habr.com/ru/post/1668239/


All Articles