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

Emil Velikov emil.l.velikov at gmail.com
Sat Dec 12 10:41:56 PST 2015


On 10 December 2015 at 08:42, Oded Gabbay <oded.gabbay at gmail.com> wrote:
> On Wed, Dec 9, 2015 at 8:30 PM, Matt Turner <mattst88 at gmail.com> wrote:
>> On Tue, Dec 8, 2015 at 9:37 PM, 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.
>>>
>>> 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>
>>> ---
>>>  configure.ac | 2 +-
>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/configure.ac b/configure.ac
>>> index 260934d..1d82e47 100644
>>> --- a/configure.ac
>>> +++ b/configure.ac
>>> @@ -384,7 +384,7 @@ CFLAGS="$SSE41_CFLAGS $CFLAGS"
>>>  AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
>>>  #include <smmintrin.h>
>>>  int main () {
>>> -    __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
>>> +    volatile __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
>>>      c = _mm_max_epu32(a, b);
>>>      return 0;
>>
>> I would have extracted an int from the result of _mm_max_epu32 and
>> returned that instead of 0.
>
> Instead of the volatile I assume ?
>
Precisely. If anyone wants to follow on Matt's suggestion we can pick
that one as well. I'd like to get a patch for the next stable releases
(next Friday for 11.0.x and just after new year for 11.1.1) so I'll
take whatever's around :-)

-Emil


More information about the mesa-stable mailing list