[Bug c++/80527] New: SSE4 Compiling issue

2017-04-26 Thread milo.zhang at spreadtrum dot com
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

[Bug c++/80527] SSE4 Compiling issue

2017-04-26 Thread milo.zhang at spreadtrum dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80527

--- Comment #1 from Milo  ---
Created attachment 41272
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41272&action=edit
declearation of the function

[Bug c++/80527] SSE4 Compiling issue

2017-04-26 Thread milo.zhang at spreadtrum dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80527

--- Comment #3 from Milo  ---
(In reply to Marc Glisse from comment #2)
> 4.8 is not maintained anymore, and I think this is already fixed in 4.9. Can
> you check with a newer compiler?

Thank you for your rapid reply.

We are using Ubuntu 12.04. It used gcc 4.8.5 and also has the same issue.
Furthermore, some tools from an EDA company are using gcc 4.8.3 as the only
compiler.

We believed that would help if it could be fixed.

By the way, you mentioned about 4.9 version. Is that means 4.9 is still be
maintaining?