title: C++ compilation issue with <emmintrin.h> on Linux GCC
body: <p>Tried google and searched here, but no luck.</p>
  
  <p>I am trying to port some windows codes that use  to Linux.</p>
  
  <p>Then I get a huge amount of compilation errors.</p>
  
  <p>All I did was </p>
  
  <pre><code>#include &lt;emmintrin.h&gt;
  </code></pre>
  
  <p>And then :</p>
  
  <pre><code>g++ -c -pipe -march=i686 -mtune=generic -O2 -pipe -D_REENTRANT -w -D__SSE__ -D__SSE2__ -D__MMX__ -I/usr/share/qt/mkspecs/linux-g++ -I. -o .obj/Test.o Test.cpp
  In file included from /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/xmmintrin.h:36:0,
                   from /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/emmintrin.h:36,
                   from Test.cpp:33:
  /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h: In function ‘void _mm_empty()’:
  /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h:49:24: error: ‘__builtin_ia32_emms’ was not declared in this scope
  /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h: In function ‘__vector(2) int _mm_cvtsi32_si64(int)’:
  /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h:62:54: error: ‘__builtin_ia32_vec_init_v2si’ was not declared in this scope
  /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h: In function ‘int _mm_cvtsi64_si32(__vector(2) int)’:
  /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h:105:53: error: ‘__builtin_ia32_vec_ext_v2si’ was not declared in this scope
  /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h: In function ‘__vector(2) int _mm_packs_pi16(__vector(2) int, __vector(2) int)’:
  /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h:144:69: error: ‘__builtin_ia32_packsswb’ was not declared in this scope
  /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h: In function ‘__vector(2) int _mm_packs_pi32(__vector(2) int, __vector(2) int)’:
  /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h:159:69: error: ‘__builtin_ia32_packssdw’ was not declared in this scope
  /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h: In function ‘__vector(2) int _mm_packs_pu16(__vector(2) int, __vector(2) int)’:
  /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h:174:69: error: ‘__builtin_ia32_packuswb’ was not declared in this scope
  /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h: In function ‘__vector(2) int _mm_unpackhi_pi8(__vector(2) int, __vector(2) int)’:
  /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h:188:70: error: ‘__builtin_ia32_punpckhbw’ was not declared in this scope
  /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h: In function ‘__vector(2) int _mm_unpackhi_pi16(__vector(2) int, __vector(2) int)’:
  /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h:202:70: error: ‘__builtin_ia32_punpckhwd’ was not declared in this scope
  /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h: In function ‘__vector(2) int _mm_unpackhi_pi32(__vector(2) int, __vector(2) int)’:
  /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h:216:70: error: ‘__builtin_ia32_punpckhdq’ was not declared in this scope
  /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h: In function ‘__vector(2) int _mm_unpacklo_pi8(__vector(2) int, __vector(2) int)’:
  /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h:230:70: error: ‘__builtin_ia32_punpcklbw’ was not declared in this scope
  /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h: In function ‘__vector(2) int _mm_unpacklo_pi16(__vector(2) int, __vector(2) int)’:
  /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h:244:70: error: ‘__builtin_ia32_punpcklwd’ was not declared in this scope
  /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h: In function ‘__vector(2) int _mm_unpacklo_pi32(__vector(2) int, __vector(2) int)’:
  /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h:258:70: error: ‘__builtin_ia32_punpckldq’ was not declared in this scope
  /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h: In function ‘__vector(2) int _mm_add_pi8(__vector(2) int, __vector(2) int)’:
  /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h:271:66: error: ‘__builtin_ia32_paddb’ was not declared in this scope
  /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h: In function ‘__vector(2) int _mm_add_pi16(__vector(2) int, __vector(2) int)’:
  /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h:284:66: error: ‘__builtin_ia32_paddw’ was not declared in this scope
  /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h: In function ‘__vector(2) int _mm_add_pi32(__vector(2) int, __vector(2) int)’:
  /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h:297:66: error: ‘__builtin_ia32_paddd’ was not declared in this scope
  /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h: In function ‘__vector(2) int _mm_add_si64(__vector(2) int, __vector(2) int)’:
  /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h:311:66: error: ‘__builtin_ia32_paddq’ was not declared in this scope
  /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h: In function ‘__vector(2) int _mm_adds_pi8(__vector(2) int, __vector(2) int)’:
  /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h:320:67: error: ‘__builtin_ia32_paddsb’ was not declared in this scope
  /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h: In function ‘__vector(2) int _mm_adds_pi16(__vector(2) int, __vector(2) int)’:
  /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h:334:67: error: ‘__builtin_ia32_paddsw’ was not declared in this scope
  /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h: In function ‘__vector(2) int _mm_adds_pu8(__vector(2) int, __vector(2) int)’:
  /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h:348:68: error: ‘__builtin_ia32_paddusb’ was not declared in this scope
  /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h: In function ‘__vector(2) int _mm_adds_pu16(__vector(2) int, __vector(2) int)’:
  /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h:362:68: error: ‘__builtin_ia32_paddusw’ was not declared in this scope
  /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h: In function ‘__vector(2) int _mm_sub_pi8(__vector(2) int, __vector(2) int)’:
  /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h:375:66: error: ‘__builtin_ia32_psubb’ was not declared in this scope
  /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h: In function ‘__vector(2) int _mm_sub_pi16(__vector(2) int, __vector(2) int)’:
  /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h:388:66: error: ‘__builtin_ia32_psubw’ was not declared in this scope
  /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h: In function ‘__vector(2) int _mm_sub_pi32(__vector(2) int, __vector(2) int)’:
  /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h:401:66: error: ‘__builtin_ia32_psubd’ was not declared in this scope
  /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h: In function ‘__vector(2) int _mm_sub_si64(__vector(2) int, __vector(2) int)’:
  /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h:415:66: error: ‘__builtin_ia32_psubq’ was not declared in this scope
  /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h: In function ‘__vector(2) int _mm_subs_pi8(__vector(2) int, __vector(2) int)’:
  /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h:424:67: error: ‘__builtin_ia32_psubsb’ was not declared in this scope
  /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h: In function ‘__vector(2) int _mm_subs_pi16(__vector(2) int, __vector(2) int)’:
  /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h:438:67: error: ‘__builtin_ia32_psubsw’ was not declared in this scope
  /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h: In function ‘__vector(2) int _mm_subs_pu8(__vector(2) int, __vector(2) int)’:
  /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h:452:68: error: ‘__builtin_ia32_psubusb’ was not declared in this scope
  /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h: In function ‘__vector(2) int _mm_subs_pu16(__vector(2) int, __vector(2) int)’:
  /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h:466:68: error: ‘__builtin_ia32_psubusw’ was not declared in this scope
  /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h: In function ‘__vector(2) int _mm_madd_pi16(__vector(2) int, __vector(2) int)’:
  /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h:481:68: error: ‘__builtin_ia32_pmaddwd’ was not declared in this scope
  /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h: In function ‘__vector(2) int _mm_mulhi_pi16(__vector(2) int, __vector(2) int)’:
  /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h:495:67: error: ‘__builtin_ia32_pmulhw’ was not declared in this scope
  /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h: In function ‘__vector(2) int _mm_mullo_pi16(__vector(2) int, __vector(2) int)’:
  /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h:509:67: error: ‘__builtin_ia32_pmullw’ was not declared in this scope
  /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h: In function ‘__vector(2) int _mm_sll_pi16(__vector(2) int, __vector(2) int)’:
  /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h:522:68: error: ‘__builtin_ia32_psllw’ was not declared in this scope
  /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h: In function ‘__vector(2) int _mm_slli_pi16(__vector(2) int, int)’:
  /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h:534:61: error: ‘__builtin_ia32_psllwi’ was not declared in this scope
  /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h: In function ‘__vector(2) int _mm_sll_pi32(__vector(2) int, __vector(2) int)’:
  /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h:547:68: error: ‘__builtin_ia32_pslld’ was not declared in this scope
  /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h: In function ‘__vector(2) int _mm_slli_pi32(__vector(2) int, int)’:
  /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h:559:61: error: ‘__builtin_ia32_pslldi’ was not declared in this scope
  /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h: In function ‘__vector(2) int _mm_sll_si64(__vector(2) int, __vector(2) int)’:
  /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h:572:68: error: ‘__builtin_ia32_psllq’ was not declared in this scope
  /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h: In function ‘__vector(2) int _mm_slli_si64(__vector(2) int, int)’:
  /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h:584:61: error: ‘__builtin_ia32_psllqi’ was not declared in this scope
  /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h: In function ‘__vector(2) int _mm_sra_pi16(__vector(2) int, __vector(2) int)’:
  /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h:597:68: error: ‘__builtin_ia32_psraw’ was not declared in this scope
  /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h: In function ‘__vector(2) int _mm_srai_pi16(__vector(2) int, int)’:
  /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h:609:61: error: ‘__builtin_ia32_psrawi’ was not declared in this scope
  /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h: In function ‘__vector(2) int _mm_sra_pi32(__vector(2) int, __vector(2) int)’:
  /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h:622:68: error: ‘__builtin_ia32_psrad’ was not declared in this scope
  /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h: In function ‘__vector(2) int _mm_srai_pi32(__vector(2) int, int)’:
  /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h:634:61: error: ‘__builtin_ia32_psradi’ was not declared in this scope
  /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h: In function ‘__vector(2) int _mm_srl_pi16(__vector(2) int, __vector(2) int)’:
  /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h:647:68: error: ‘__builtin_ia32_psrlw’ was not declared in this scope
  /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h: In function ‘__vector(2) int _mm_srli_pi16(__vector(2) int, int)’:
  /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/mmintrin.h:659:61: error: ‘__builtin_ia32_psrlwi’ was not declared in this scope
  </code></pre>
  
  <p>Am I missing some compiler option here ? Or I need to include some other headers ?</p>