mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-04-23 13:50:44 +02:00
configure.ac: Detect if running on POWER8 arch
To determine if we could use special POWER8 assembly directives, we first need to detect whether we are running on POWER8 architecture. This patch adds this detection to configure.ac and adds the necessary compilation flags accordingly. v2: - Add option to disable POWER8 instructions generation - Detect whether building on BE or LE machine and build with -mpower8-vector only on LE machine - Make the printed messages more standard Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com> Reviewed-by: Roland Scheidegger <sroland@vmware.com>
This commit is contained in:
parent
7295f4fcc2
commit
afe88f66a8
1 changed files with 55 additions and 0 deletions
55
configure.ac
55
configure.ac
|
|
@ -396,6 +396,61 @@ fi
|
|||
AM_CONDITIONAL([SSE41_SUPPORTED], [test x$SSE41_SUPPORTED = x1])
|
||||
AC_SUBST([SSE41_CFLAGS], $SSE41_CFLAGS)
|
||||
|
||||
dnl Check for Endianness
|
||||
AC_C_BIGENDIAN(
|
||||
little_endian=no,
|
||||
little_endian=yes,
|
||||
little_endian=no,
|
||||
little_endian=no
|
||||
)
|
||||
|
||||
dnl Check for POWER8 Architecture
|
||||
PWR8_CFLAGS="-mpower8-vector"
|
||||
have_pwr8_intrinsics=no
|
||||
AC_MSG_CHECKING(whether gcc supports -mpower8-vector)
|
||||
save_CFLAGS=$CFLAGS
|
||||
CFLAGS="$PWR8_CFLAGS $CFLAGS"
|
||||
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
|
||||
#if defined(__GNUC__) && (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 8))
|
||||
#error "Need GCC >= 4.8 for sane POWER8 support"
|
||||
#endif
|
||||
#include <altivec.h>
|
||||
int main () {
|
||||
vector unsigned char r;
|
||||
vector unsigned int v = vec_splat_u32 (1);
|
||||
r = __builtin_vec_vgbbd ((vector unsigned char) v);
|
||||
return 0;
|
||||
}]])], have_pwr8_intrinsics=yes)
|
||||
CFLAGS=$save_CFLAGS
|
||||
|
||||
AC_ARG_ENABLE(pwr8,
|
||||
[AC_HELP_STRING([--disable-pwr8-inst],
|
||||
[disable POWER8-specific instructions])],
|
||||
[enable_pwr8=$enableval], [enable_pwr8=auto])
|
||||
|
||||
if test "x$enable_pwr8" = xno ; then
|
||||
have_pwr8_intrinsics=disabled
|
||||
fi
|
||||
|
||||
if test $have_pwr8_intrinsics = yes && test $little_endian = yes ; then
|
||||
DEFINES="$DEFINES -D_ARCH_PWR8"
|
||||
CXXFLAGS="$CXXFLAGS $PWR8_CFLAGS"
|
||||
CFLAGS="$CFLAGS $PWR8_CFLAGS"
|
||||
else
|
||||
PWR8_CFLAGS=
|
||||
fi
|
||||
|
||||
AC_MSG_RESULT($have_pwr8_intrinsics)
|
||||
if test "x$enable_pwr8" = xyes && test $have_pwr8_intrinsics = no ; then
|
||||
AC_MSG_ERROR([POWER8 compiler support not detected])
|
||||
fi
|
||||
|
||||
if test $have_pwr8_intrinsics = yes && test $little_endian = no ; then
|
||||
AC_MSG_WARN([POWER8 optimization is enabled only on POWER8 Little-Endian])
|
||||
fi
|
||||
|
||||
AC_SUBST([PWR8_CFLAGS], $PWR8_CFLAGS)
|
||||
|
||||
dnl Can't have static and shared libraries, default to static if user
|
||||
dnl explicitly requested. If both disabled, set to static since shared
|
||||
dnl was explicitly requested.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue