configure.ac: Fix false GCC vector extensions detection for Clang 4

Submitted by Siarhei Siamashka on Sept. 18, 2017, 4:11 p.m.

Details

Message ID 1505751102-10627-1-git-send-email-siarhei.siamashka@gmail.com
State New
Series "configure.ac: Fix false GCC vector extensions detection for Clang 4"
Headers show

Commit Message

Siarhei Siamashka Sept. 18, 2017, 4:11 p.m.
From: Rob Tsuk <robtsuk@google.com>

Pixman uses __builtin_shuffle builtin function in the code, which
relies on GCC vector extensions. So we also need to have it in the
configure.ac test snippet code.

GCC and Clang have different incompatible builtin functions for
this functionality. Clang 4 now supports "shift vector by scalar"
operation in its vector extension too and could pass the old
incomplete variant of the configure check, but failed to compile
pixman.

Reviewed-by: Siarhei Siamashka <siarhei.siamashka@gmail.com>
[Siarhei: update commit message, use result of __builtin_shuffle]
---
 configure.ac | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/configure.ac b/configure.ac
index a592cba..caac10e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1102,7 +1102,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) { e = __builtin_shuffle(a, b) - ((b << 27) + (b >> 5)) + 1; return e[0]; }
 ]])], support_for_gcc_vector_extensions=yes)
 
 if test x$support_for_gcc_vector_extensions = xyes; then