[Mesa-dev] [PATCH 1/4] meson: Enable SSE4.1 optimizations
Eric Engestrom
eric.engestrom at imgtec.com
Mon Nov 20 11:28:08 UTC 2017
On Friday, 2017-11-17 12:34:12 -0800, Dylan Baker wrote:
> Quoting Emil Velikov (2017-11-17 03:11:50)
> > On 16 November 2017 at 22:21, Dylan Baker <dylan at pnwbakers.com> wrote:
> > > Quoting Emil Velikov (2017-11-16 03:35:17)
> > >> Hi Dylan,
> > >>
> > >> On 16 November 2017 at 01:10, Dylan Baker <dylan at pnwbakers.com> wrote:
> > >> > This patch checks for an and then enables sse4.1 optimizations if the
> > >> > host machine will be x86/x86_64.
> > >> >
> > >> Hell yeah, SSE is coming to town :-)
> > >>
> > >> Will this work if the user disables SSE4.1, say via CFLAGS=-mno-sse4.1
> > >> meson ...?
> > >> My meson is still bit rough, so I could not quite grok ^^ by reading
> > >> through the patch.
> > >>
> > >> Thanks
> > >> Emil
> > >
> > > It'll explode horribly. Id didn't see any special handling of that in autotools
> > > build though either, did I miss something?
> > >
> > In autotools it's handled before the normal ld invocation.
> >
> > Namely: configure.ac does:
> > - construct a program using sse4.1 intrinsicts
> > Note: return _mm_...() is required otherwise the whole program will be
> > optimised away
> > - the -msse is passed first and then the user flags (-mno-sse and/or
> > anything else)
> > - the user -mno-sse takes precedence, hence the test program fails to build
> > - set see_supported=false and don't build the SSE optimised static library
> >
> > HTH
> > Emil
>
> That's an interesting question. So arguments passed via CFLAGS and friends will
> be passed to tests, but the arguments passed explicitly to those tests are
> appended, so -msse4.1 will take precedence. I'm also pretty sure there isn't a
> way to check the arguments passed via -Dc_args or CFLAGS (they're treated as
> default arguments, like the c_std in the project() argument). I asked on
> #mesonbuild, but I haven't gotten an answer yet (Fridays are pretty slow
> everywhere).
I asked that already a little while ago, about if there was a way to get
any -O passed in in any of the cflags inputs, and the answer was that
no, you can't and you shouldn't have behaviour based on cflags set at
any time, so I don't expect they will ever add this functionality.
One thing they might do though, is parse all the cflags and print
a warning if both `-foo` and `-nofoo` are present, so that might be
something to suggest.
>
> I think currently the only way to control this would be to have a meson option
> to turn off optimizations, and I really don't like that.
>
> Dylan
More information about the mesa-dev
mailing list