Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 507784

Summary: media-libs/mesa-10 - In file included from main/streaming-load-memcpy.c:31: /usr/lib/gcc/i686-pc-linux-gnu/4.8.2/include/mmintrin.h:310:3: error: can’t convert between vector values of different size
Product: Gentoo Linux Reporter: Andrew Savchenko <bircoph>
Component: [OLD] LibraryAssignee: Gentoo X packagers <x11>
Status: RESOLVED DUPLICATE    
Severity: normal CC: bircoph
Priority: Normal Keywords: PATCH
Version: unspecified   
Hardware: x86   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: build.log
environment
emerge --info
10.0.4-build.log
mesa-10.1.0-sse41.patch
mesa-10.1.0.ebuild.patch

Description Andrew Savchenko gentoo-dev 2014-04-16 06:06:30 UTC
Hello,

mesa-10.1.0 fails to build here on ~x86 without SSE2 support (Athlon-XP).
Looks like mesa tries to use SSE2 intrinsics for some reason:

 In file included from /usr/lib/gcc/i686-pc-linux-gnu/4.8.2/include/xmmintrin.h:35:0,
                 from /usr/lib/gcc/i686-pc-linux-gnu/4.8.2/include/emmintrin.h:35,
                 from /usr/lib/gcc/i686-pc-linux-gnu/4.8.2/include/pmmintrin.h:35,
                 from /usr/lib/gcc/i686-pc-linux-gnu/4.8.2/include/tmmintrin.h:35,
                 from /usr/lib/gcc/i686-pc-linux-gnu/4.8.2/include/smmintrin.h:36,
                 from main/streaming-load-memcpy.c:31:
/usr/lib/gcc/i686-pc-linux-gnu/4.8.2/include/mmintrin.h: In function ‘_mm_add_si64’:
/usr/lib/gcc/i686-pc-linux-gnu/4.8.2/include/mmintrin.h:310:3: error: can’t convert between vector values of different size
   return (__m64) __builtin_ia32_paddq ((__v1di)__m1, (__v1di)__m2);
   ^

From /usr/lib/gcc/i686-pc-linux-gnu/4.8.2/include/mmintrin.h:
/* Add the 64-bit values in M1 to the 64-bit values in M2.  */
#ifdef __SSE2__
extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
_mm_add_si64 (__m64 __m1, __m64 __m2)
{
  return (__m64) __builtin_ia32_paddq ((__v1di)__m1, (__v1di)__m2);
}
#endif
Comment 1 Andrew Savchenko gentoo-dev 2014-04-16 06:07:24 UTC
Created attachment 375052 [details]
build.log
Comment 2 Andrew Savchenko gentoo-dev 2014-04-16 06:07:51 UTC
Created attachment 375054 [details]
environment
Comment 3 Andrew Savchenko gentoo-dev 2014-04-16 06:08:54 UTC
Created attachment 375056 [details]
emerge --info

Please note that build is performed with CXXFLAGS=CFLAGS="-O2 -march=native -pipe" to rule out CFLAGS issue.
Comment 4 Andrew Savchenko gentoo-dev 2014-04-16 06:48:25 UTC
Created attachment 375060 [details]
10.0.4-build.log

Meanwhile 10.0.4 fails with the same problem.

Looks like mesa authors assume that if gcc supports -msse4.1 flag it is safe to add it to CFLAGS without actual CPU check, from configure.ac:

AX_CHECK_COMPILE_FLAG([-msse4.1], [SSE41_SUPPORTED=1], [SSE41_SUPPORTED=0])

Idiots.
Comment 5 Andrew Savchenko gentoo-dev 2014-04-16 16:18:20 UTC
Created attachment 375094 [details, diff]
mesa-10.1.0-sse41.patch

Looks like we have two issues here:

1) SSE4_1 code (src/mesa/main/streaming-load-memcpy.[ch]) is automagically enabled if compiler supports -msse41 flag.

2) SSE4_1 intrinsics are not x86 friendly. Though to my knowledge all SSE4_1 capable CPUs are 64-bit and in most cases users will just build 64-bit mesa versions, it is still possible that someone wants to build 32-bit code with sse41 support enabled.

Propesed patch fixes first problem and adds sse4_1 USE flag.
Comment 6 Andrew Savchenko gentoo-dev 2014-04-16 16:21:08 UTC
Created attachment 375096 [details, diff]
mesa-10.1.0.ebuild.patch

Ebuild patch required to add sse4_1 USE flag and the patch above.
Comment 7 Matt Turner gentoo-dev 2014-04-28 21:56:47 UTC

*** This bug has been marked as a duplicate of bug 503828 ***