[Pixman] Patch to fix test for GCC vector extensions

Siarhei Siamashka siarhei.siamashka at gmail.com
Sun Sep 17 13:40:33 UTC 2017


On Mon, 7 Aug 2017 07:52:29 -0700
Rob Tsuk <rob at tsuk.com> wrote:

> From 662b17d0d691b567a3343af3439f5fbefe989584 Mon Sep 17 00:00:00 2001
> From: Rob Tsuk <robtsuk at google.com>
> Date: Mon, 7 Aug 2017 07:11:10 -0700
> Subject: [PATCH 1/1] Fix test for GCC vector extensions
> 
> The previous test was getting a false positive for
> clang version 4.
> ---
>  configure.ac | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/configure.ac b/configure.ac
> index e833e45..cbebc82 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -1101,7 +1101,7 @@ support_for_gcc_vector_extensions=no
>  AC_MSG_CHECKING(for GCC vector extensions)
>  AC_LINK_IFELSE([AC_LANG_SOURCE([[
>  unsigned int __attribute__ ((vector_size(16))) e, a, b;
> -int main (void) { e = a - ((b << 27) + (b >> (32 - 27))) + 1; return e[0]; }
> +int main (void) { __builtin_shuffle(a,b);e = a - ((b << 27) + (b >> (32 - 27))) + 1; return e[0]; }
>  ]])], support_for_gcc_vector_extensions=yes)
>  
>  if test x$support_for_gcc_vector_extensions = xyes; then

Thanks, the patch looks mostly good. We indeed have to add
the use of __builtin_shuffle() to the configure check code
snippet because it is used by pixman and Clang implements
this functionality in a different and incompatible way.

We did not see this problem with older versions of Clang
because it did not support the shift vector by scalar operation
in its vector extensions.

Too bad that GCC and Clang parted their ways and we can't have
a single unified implementation. The whole reason to use GCC
vector extension was that we could avoid platform-dependent
intrinsics in this code.

About the patch. It would be great to use the result of
__builtin_shuffle() in the intermediate calculations just in
case. See
   https://cgit.freedesktop.org/pixman/commit/?id=a566f627dbd6ea8f2cba70a446e62caaa2ecbd26

-- 
Best regards,
Siarhei Siamashka


More information about the Pixman mailing list