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

Dylan Baker dylan at pnwbakers.com
Fri Jun 8 16:29:53 UTC 2018


Quoting Eric Anholt (2018-06-07 14:26:39)
> 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.

You are correct, I've fixed that locally.

> 
> > 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.

Also fixed locally.

Dylan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: signature
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20180608/dcf0d8fb/attachment.sig>


More information about the mesa-dev mailing list