Skip to content

Commit

Permalink
Fix build on PowerPC SPE systems
Browse files Browse the repository at this point in the history
SPE systems don't support AltiVec instructions.

Fixes libjpeg-turbo#172
  • Loading branch information
dcommander committed Sep 1, 2017
1 parent 3212005 commit 02fa8f2
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 9 deletions.
31 changes: 31 additions & 0 deletions acinclude.m4
Original file line number Diff line number Diff line change
Expand Up @@ -252,3 +252,34 @@ AC_DEFUN([AC_CHECK_COMPATIBLE_ARM64_ASSEMBLER_IFELSE],[
$2
fi
])

# AC_CHECK_ALTIVEC
# ----------------
# Test whether AltiVec intrinsics are supported
AC_DEFUN([AC_CHECK_ALTIVEC],[
ac_save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -maltivec"
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
#include <altivec.h>
int main(void) {
__vector int vi = { 0, 0, 0, 0 };
return vi[0];
}]])], ac_has_altivec=yes)
CFLAGS="$ac_save_CFLAGS"
if test "x$ac_has_altivec" = "xyes" ; then
$1
else
$2
fi
])

AC_DEFUN([AC_NO_SIMD],[
AC_MSG_RESULT([no ("$1")])
with_simd=no;
if test "x${require_simd}" = "xyes"; then
AC_MSG_ERROR([SIMD support not available for this CPU.])
else
AC_MSG_WARN([SIMD support not available for this CPU. Performance will\
suffer.])
fi
])
14 changes: 5 additions & 9 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -517,17 +517,13 @@ if test "x${with_simd}" != "xno"; then
fi
;;
powerpc*)
AC_MSG_RESULT([yes (powerpc)])
simd_arch=powerpc
AC_CHECK_ALTIVEC(
[AC_MSG_RESULT([yes (powerpc)])
simd_arch=powerpc],
[AC_NO_SIMD(PowerPC SPE)])
;;
*)
AC_MSG_RESULT([no ("$host_cpu")])
with_simd=no;
if test "x${require_simd}" = "xyes"; then
AC_MSG_ERROR([SIMD support not available for this CPU.])
else
AC_MSG_WARN([SIMD support not available for this CPU. Performance will suffer.])
fi
AC_NO_SIMD($host_cpu)
;;
esac

Expand Down

0 comments on commit 02fa8f2

Please sign in to comment.