[Mesa-dev] [PATCH 1/5] configure.ac: Detect if running on POWER8 arch

Roland Scheidegger sroland at vmware.com
Tue Dec 29 15:11:05 PST 2015


So, if I see that right, you will automatically generate binaries using
power8 instructions if compiled on power8 capable box, which then won't
run on boxes not supporting power8? Is that really what you want?
Maybe some runtime detection would be a good idea (though I don't know
if anyone cares about power7)? So far we didn't bother with that for SSE
but it has to be said SSE2 is a really low bar (and the manual assembly
stuff doesn't use anything more advanced, even though clearly things
like the emulated mm_mullo_epi32 are suboptimal if your cpu supports
sse41). And even then on non-x86 you actually might not get
PIPE_ARCH_SSE if you didn't set gcc's compile flags accordingly.

Roland


Am 29.12.2015 um 17:12 schrieb Oded Gabbay:
> 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.
> 
> Signed-off-by: Oded Gabbay <oded.gabbay at gmail.com>
> ---
>  configure.ac | 30 ++++++++++++++++++++++++++++++
>  1 file changed, 30 insertions(+)
> 
> diff --git a/configure.ac b/configure.ac
> index f8a70be..1acd47e 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -396,6 +396,36 @@ fi
>  AM_CONDITIONAL([SSE41_SUPPORTED], [test x$SSE41_SUPPORTED = x1])
>  AC_SUBST([SSE41_CFLAGS], $SSE41_CFLAGS)
>  
> +dnl Check for POWER8 Architecture
> +PWR8_CFLAGS="-mpower8-vector"
> +have_pwr8_intrinsics=no
> +AC_MSG_CHECKING(whether we are running on POWER8 Architecture)
> +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
> +
> +if test $have_pwr8_intrinsics = 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)
> +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.
> 



More information about the mesa-dev mailing list