The command line: gcc -O2 -msse2 -S 2.c
The code:
#include <emmintrin.h>
int f(__m128i x, __m128i y)
{
  __m128i m[1];
  m[0] = _mm_add_epi16(x, y);
  return *(int*)(&m[0]);
}
int g(__m128i x, __m128i y)
{
  __m128i m[2];
  m[0] = _mm_add_epi16(x, y);
  return *(int*)(&m[0]);
}

The compiler generates correct code for f(),
but for g() the add operation (paddw) disappears.
Happens on GCC 3.3.4 and 3.4.2

-- 
           Summary: SSE2 intrinsics generates wrong code
           Product: gcc
           Version: 3.4.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: inline-asm
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jochang at gmail dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18074

Reply via email to