[Pixman] [Mesa-stable] [PATCH] configure.ac: fix test for SSE4.1 assembler support

Jonathan Gray jsg at jsg.id.au
Wed Dec 9 04:34:17 PST 2015

On Wed, Dec 09, 2015 at 01:39:30PM +0200, Oded Gabbay wrote:
> On Wed, Dec 9, 2015 at 1:09 PM, Emil Velikov <emil.l.velikov at gmail.com> wrote:
> > On 9 December 2015 at 05:37, Jonathan Gray <jsg at jsg.id.au> wrote:
> >> Change the __m128i variables to be volatile so gcc 4.9 won't optimise
> >> all of them out with -O1 or greater.  The _mm_set1_epi32/pinsrd calls
> >> still get optimised out but now there is at least one SSE4.1 instruction
> >> generated via _mm_max_epu32/pmaxud.  When all of the sse4.1 instructions
> >> got optimised out the configure test would incorrectly pass when the
> >> compiler supported the intrinsics and the assembler didn't support the
> >> instructions.
> >>
> > Must admit that I was not expecting that one. Looks like pixman (the
> > inspiration for this check) is missing volatile as well. Does that one
> > build/run fine on OpenBSD ?
> >
> >> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91806
> >> Signed-off-by: Jonathan Gray <jsg at jsg.id.au>
> >> Cc: "11.0 11.1" <mesa-stable at lists.freedesktop.org>
> > Reviewed-by: Emil Velikov <emil.velikov at collabora.com>
> >
> > I'll pick this in a couple of days (barring any objections).
> >
> > Thanks
> > Emil
> Adding pixman ML.
> I must admit ignorance on this one.
> I looked at configure.ac of pixman and I don't see any SSE4.1
> reference, and AFAIK, we don't use those instructions (only SSE2 and
> SSSE3).
> Is the above patch relevant for those as well ? because the tests in
> configure.ac does *not* contain volatile.
>     Oded

It looks like this is indeed a problem in pixman as well with at least
gcc 4.2 and 4.9.  Running the pixman sse2 test on amd64 I only
see xmm register use and movdqa in the generated assembly with -O0.

The pixman configure tests passes on OpenBSD but the toolchain
recognises sse2 instructions just not sse 4.1.

Introducing volatile to the pixman test stops the xmm/movdqa
use from being optimised out.

More information about the Pixman mailing list