[pulseaudio-discuss] detection of SSE3 support in configure.ac

Rémi Denis-Courmont remi at remlab.net
Tue Dec 6 12:59:16 PST 2011


Le mardi 6 décembre 2011 22:24:49 Pierre-Louis Bossart, vous avez écrit :
> > Writing an autoconf test is OK if you have a fixed target CPU at build-
> > time. But that rarely is the case for x86.
> 
> So would it be better to just detect x86, assume at compile time that the
> targets supports SSE,

Assuming the assembler supports SSE, which is presumably what the autoconf 
test ensures:

(1) If you do use a clobber list and SSE is enabled in CFLAGS, the compiler 
will generate code that can only run on SSE-capable processors.

(2) If you do use a clobber list and SSE is not enabled in CFLAGS, the 
compiler would fail with "unknown registers".

(3) If you do not use a clobber list and SSE is enabled, then weird bugs may 
appear as the compiler might use the SSE registers for other purposes.

(4) If you do not use a clobber list and SSE is not enabled, then it might 
work.

Clearly (2) and (3) are non-starters. (4) is a very bad practice as code 
breaks silently depending on compiler flags. (1) is hard if you need to retain 
run-time support for non-SSE.

> and then at run time disable the resampling if no
> SSE3 is detected when the daemon starts?

Yeah sure.

But you must somehow ensure that all code compiled with -msse3, NOT ONLY the 
inline assembly, is only ever run on SSE3-capable processors. Without the 
target function attribute from GCC 4.4, this becomes a tough requirement for 
the build system.

-- 
Rémi Denis-Courmont
http://www.remlab.net/
http://fi.linkedin.com/in/remidenis


More information about the pulseaudio-discuss mailing list