[Mesa-dev] [PATCH 2/4] meson: Add support for ppc assembly/optimizations

Eric Anholt eric at anholt.net
Thu Jun 7 21:26:39 UTC 2018


Dylan Baker <dylan at pnwbakers.com> writes:

> ---
>  meson.build       | 30 ++++++++++++++++++++++++++----
>  meson_options.txt |  7 +++++++
>  2 files changed, 33 insertions(+), 4 deletions(-)
>
> diff --git a/meson.build b/meson.build
> index 0171328bcd7..f6fe141056a 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -601,13 +601,33 @@ if with_gallium_st_nine
>    endif
>  endif
>  
> +if get_option('altivec') != 'false'
> +  if host_machine.cpu_family() == 'ppc64le'
> +    if cc.get_id() == 'gcc' and cc.version().version_compare('< 4.8')
> +      error('Altivec is not supported with gcc version < 4.8.')
> +    endif
> +    if cc.compiles('''
> +        #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;
> +        }''',
> +        name : 'POWER8 intrinsics')
> +      pre_args += ['-D_ARCH_PWR8', '-mpower8-vector']
> +    elif get_option('altivec') == 'true'
> +      error('Altivec support required but not found.')
> +    endif
> +  endif
> +endif
> +

The autotools build seems to do this test with -mpower8-vector in the
cflags, and that seems like it would probably be necessary.

> diff --git a/meson_options.txt b/meson_options.txt
> index 2c1f514debe..5976e14fc71 100644
> --- a/meson_options.txt
> +++ b/meson_options.txt
> @@ -298,3 +298,10 @@ option(
>    choices : ['freedreno', 'glsl', 'intel', 'nir', 'nouveau', 'all'],
>    description : 'List of tools to build.',
>  )
> +option(
> +  'altivec',
> +  type : 'combo',
> +  value : 'auto',
> +  choices : ['auto', 'true', 'false'],
> +  description : 'Enable altivec optimizations if supported by host machine.',
> +)
> -- 

This should probably be power8 rather than altivec, since altivec
predates power8 by a long time.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20180607/664c2c61/attachment-0001.sig>


More information about the mesa-dev mailing list