Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 507784 - 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
Summary: media-libs/mesa-10 - In file included from main/streaming-load-memcpy.c:31: /...
Status: RESOLVED DUPLICATE of bug 503828
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Library (show other bugs)
Hardware: x86 Linux
: Normal normal (vote)
Assignee: Gentoo X packagers
URL:
Whiteboard:
Keywords: PATCH
Depends on:
Blocks:
 
Reported: 2014-04-16 06:06 UTC by Andrew Savchenko
Modified: 2014-04-28 21:56 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
build.log (build.log,389.20 KB, text/plain)
2014-04-16 06:07 UTC, Andrew Savchenko
Details
environment (environment,170.31 KB, text/plain)
2014-04-16 06:07 UTC, Andrew Savchenko
Details
emerge --info (emerge.info,8.91 KB, text/plain)
2014-04-16 06:08 UTC, Andrew Savchenko
Details
10.0.4-build.log (10.0.4-build.log,436.96 KB, text/plain)
2014-04-16 06:48 UTC, Andrew Savchenko
Details
mesa-10.1.0-sse41.patch (mesa-10.1.0-sse41.patch,819 bytes, patch)
2014-04-16 16:18 UTC, Andrew Savchenko
Details | Diff
mesa-10.1.0.ebuild.patch (mesa-10.1.0.ebuild.patch,1.21 KB, patch)
2014-04-16 16:21 UTC, Andrew Savchenko
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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 ***