问题
The compiler fails 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);
^
At 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);
...
Considering _MM_SHUFFLE
is a macro, the masks should be compile-time calculable:
#define _MM_SHUFFLE(fp3,fp2,fp1,fp0) \
(((fp3) << 6) | ((fp2) << 4) | ((fp1) << 2) | (fp0))
So I tried to replace const int ...
with constexpr int ...
, but it gave no effect.
The only workaround I found is here, but it does not answer why the masks are not immediates, and why threads can affect this.
Any way to fix this more or less decently except for hardcoding 0x88
and 0xDD
like _mm_shuffle_ps(v_r0, v_r1, 0x88)
?
It does work, but obviously is not a good solution. Moreover, this file is not the only one having this issue.
Also, why is not even constexpr int mask_lo = 0x88
considered an immediate?
来源:https://stackoverflow.com/questions/41913252/building-opencv-3-2-0-with-mingw-w64-6-1-0-compile-time-argument-evaluation-fai