1. A program can use SSE instructions only if both CPU and OS support SSE. Currently libFLAC tests both CPU and OS for this support, but is it really necessary? Maybe CPU check is enough? Operating systems that don't support SSE (Win95, WinNT 4.0, Linux kernel 2.2 (iirc), ...) are really outdated now. Removing OS check will greatly simplify src/libFLAC/cpu.c. 2. "configure" build system adds -msse2 option by default. It means that x86 (32-bit) library won't work on older, non-SSE2 processors. So if somebody wants to build a universal x86 binary then it's necessary to add --disable-sse (for Linux) or even --disable-asm-optimizations (for other OSes). Debian adds "--disable-asm-optimizations --disable-sse --disable-altivec" to OPTFLAGS (see /debian/rules file inside <http://http.debian.net/debian/pool/main/f/flac/flac_1.3.1-4.debian.tar.xz> ) FreeBSD just comments out this option: <https://svnweb.freebsd.org/ports/head/audio/flac/files/patch-configure?view=markup#l28> Maybe it makes sense to remove this option? 3. What's the intended meaning of --enable-sse / --disable-sse options? What should they do/enable/disable?
> 2. > "configure" build system adds -msse2 option by default. It means that > x86 (32-bit) library won't work on older, non-SSE2 processors.P.S. Also, it doesn't really make sense to test CPU/OS for SSE support when -msse2 option allows compiler to insert SSE/SSE2 instructions anywhere.
Erik de Castro Lopo
2016-Dec-03 00:38 UTC
[flac-dev] Questions about libFLAC and SSE/SSE2/...
lvqcl.mail wrote:> 1. > A program can use SSE instructions only if both CPU and OS support SSE. > Currently libFLAC tests both CPU and OS for this support, but is it really > necessary? Maybe CPU check is enough? Operating systems that don't support > SSE (Win95, WinNT 4.0, Linux kernel 2.2 (iirc), ...) are really outdated > now. Removing OS check will greatly simplify src/libFLAC/cpu.c.That makes sense.> 2. > "configure" build system adds -msse2 option by default. It means that > x86 (32-bit) library won't work on older, non-SSE2 processors. So if > somebody wants to build a universal x86 binary then it's necessary to > add --disable-sse (for Linux) or even --disable-asm-optimizations (for > other OSes). > Debian adds "--disable-asm-optimizations --disable-sse --disable-altivec" > to OPTFLAGS (see /debian/rules file inside > <http://http.debian.net/debian/pool/main/f/flac/flac_1.3.1-4.debian.tar.xz> > )It does that depending on the architecture. Since Debian won't be supporting i386 for the next release, I wonder how important that is.> FreeBSD just comments out this option: > <https://svnweb.freebsd.org/ports/head/audio/flac/files/patch-configure?view=markup#l28> > > Maybe it makes sense to remove this option?Without knowing why FreeBSD disabled it, I'd prefer not to change it.> 3. > What's the intended meaning of --enable-sse / --disable-sse options? > What should they do/enable/disable?I really could not tell you without reading configure.ac and the code. Erik -- ---------------------------------------------------------------------- Erik de Castro Lopo http://www.mega-nerd.com/
Erik de Castro Lopo wrote:> lvqcl.mail wrote: >> now. Removing OS check will greatly simplify src/libFLAC/cpu.c. > > That makes sense.Should I post a patch that removes OS check and keeps only CPU check?>> 2. >> "configure" build system adds -msse2 option by default. It means that >> x86 (32-bit) library won't work on older, non-SSE2 processors. So if> It does that depending on the architecture. Since Debian won't be > supporting > i386 for the next release, I wonder how important that is.As far as I understand, Debian 9.0 Stretch will support i386/x86 _architecture_, it just won't support 386/486/586 _processors_. It will work on i686+ CPUs, and some of them (Pentium Pro, II, III, Athlon, Athlon XP) don't support SSE2.>> FreeBSD just comments out this option: >> <https://svnweb.freebsd.org/ports/head/audio/flac/files/patch-configure?view=markup#l28> >> >> Maybe it makes sense to remove this option? > > Without knowing why FreeBSD disabled it, I'd prefer not to change it.Probably because they want to build libFLAC so that it supports older processors?>> 3. >> What's the intended meaning of --enable-sse / --disable-sse options? >> What should they do/enable/disable? > > I really could not tell you without reading configure.ac and the code.Actually I don't want to know its current meaning, I can figure it out myself. I want to know what it _should_ do, ideally...
Christian Weisgerber
2016-Dec-15 15:15 UTC
[flac-dev] Questions about libFLAC and SSE/SSE2/...
On 2016-12-03, Erik de Castro Lopo <mle+la at mega-nerd.com> wrote:>> FreeBSD just comments out this option: >> <https://svnweb.freebsd.org/ports/head/audio/flac/files/patch-configure?view=markup#l28> >> >> Maybe it makes sense to remove this option? > > Without knowing why FreeBSD disabled it, I'd prefer not to change it.I disabled this for the FreeBSD and OpenBSD ports because a package built for an architecture needs to be able to run on all CPUs supported by that architecture. For the "i386" (IA-32) architecture, that includes CPUs that do not support SSE2. Adding -msse2 to the compiler flags allows the compiler to issue SSE2 instructions throughout the code, producing binaries that are incompatible with older CPUs. -- Christian "naddy" Weisgerber naddy at mips.inka.de
Maybe Matching Threads
- Questions about libFLAC and SSE/SSE2/...
- Questions about libFLAC and SSE/SSE2/...
- [PATCH] remove check for OS SSE support from src/libFLAC/cpu.c
- [PATCH 1/1] ensure that stack is aligned for SSE functions if using mingw32
- ensure that stack is aligned for SSE functions if using mingw32