https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80527
Bug ID: 80527
Summary: SSE4 Compiling issue
Product: gcc
Version: 4.8.3
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: milo.zhang at spreadtrum dot com
Target Milestone: ---
Created attachment 41271
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41271&action=edit
workaround for this issue
We used SSE4 instruction _mm_cvtepi16_epi32.
But only with “#pragma GCC target (“sse4”)” and two includes (immintrin.h and
xmmintrin.h), the declaration of “_mm_cvtepi16_epi32” is not found.
#ifdef __linux__
#pragma GCC target("sse4")
#endif
#include
#include
if defined ( __linux__) && !defined (__clang__) && !defined (__SSE4_1)
extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__,
__artificial__)) _mm_cvtepi16_epi32 (__m128i __X)
{
return (__m128i) __builtin_ia32——pmovsxwd128 ((_v8hi)__X);
}
Thus, we implemented our own “_mm_cvtepi16_epi32” function below as the
workaround to avoid compiling error.
The reason is that in the “immintrin.h” file of gcc 4.8.3, without macros
__SSE_4_2__ or __SSE4_1__, “smmintrin.h” will not be included. And
“smmintrin.h” file declared “_mm_cvtepi16_epi32” function. You can see the
condition shown below.
Here is the implementation of "immintrin.h":
#if defined (__SSE4_2__) || defined (__SSE4_1__)
#include
#endif