[Mesa-dev] [PATCH 1/4] meson: Enable SSE4.1 optimizations

Dylan Baker dylan at pnwbakers.com
Fri Nov 17 20:34:12 UTC 2017


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 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: signature
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20171117/49ba2f9e/attachment.sig>


More information about the mesa-dev mailing list