[speex-dev] libspeex/SSE Intrinsics with GCC 3.3.x
Ralph Giles
giles at xiph.org
Fri Apr 2 10:26:19 PST 2004
On Fri, Apr 02, 2004 at 12:33:13AM -0500, Jean-Marc Valin wrote:
> Do you have any sample code for that? Also, how do you tell autoconf to
> append '-msse' without running into problems when CFLAGS is not set (and
> usually defaults to -g -O2, but not always).
Example patch attached. It only tries if the use passes --enable-sse;
testing by target arch as Aron suggested is another reasonable approach.
However, the -msse cflag test fails on powerpc-unknown-linux-gnu so it
might be safe just to switch the default value of the --enable-sse arg.
AC_PROG_CC tries to find a compiler and then checks whether it's
actually gcc. If so it automatically adds '-g -O2' to the CFLAGS.
That's the origin of those two flags.
The patch includes an explicit call to AC_PROG_CC since it uses its
cache results; however AM_PROG_LIBTOOL and possibly other macros will
call it if it's not been called explicitly when they're invoked.)
There are some options here; the -msse check could be conditional on gcc
being detected, the way -O3 is. These flags are pretty much never
portable, but it probably doesn't hurt to try.
The patch as written results in CFLAGS="-g -O2 -O3 -msee" if it
succeeds. You can avoid the duplicate optimization levels by saying
something like:
if test $ac_cv_prog_gcc = yes; then
dnl remove any existing gcc -On flag
oldcflags=`echo $old_cflags | sed -e 's/-O.//'`
OPT_CFLAGS="$OPT_CFLAGS -O3"
fi
OPT_CFLAGS="$OPT_CFLAGS -msse"
instead.
So perhaps not so simple, but writing expert systems in sh never is.
-r
<p><p>
-------------- next part --------------
SW5kZXg6IGNvbmZpZ3VyZS5pbgo9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Ci0tLSBjb25maWd1cmUuaW4JKHJldmlzaW9u
IDY0ODYpCisrKyBjb25maWd1cmUuaW4JKHdvcmtpbmcgY29weSkKQEAgLTIzLDYgKzIzLDcgQEAK
IEFNX01BSU5UQUlORVJfTU9ERQogCiBBQ19DQU5PTklDQUxfSE9TVAorQUNfUFJPR19DQwogQU1f
UFJPR19MSUJUT09MCiAKIEFDX0NfQklHRU5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bm9dKQorICAgIF0pCisgICAgQ0ZMQUdTPSRvbGRf
Y2ZsYWdzCisgIGZpCiBdKQogCiBBQ19BUkdfRU5BQkxFKGZpeGVkLXBvaW50LCBbICAtLWVuYWJs
ZS1maXhlZC1wb2ludCAgICBjb21waWxlIGFzIGZpeGVkLXBvaW50XSwgW2lmIHRlc3QgIiRlbmFi
bGV2YWwiID0geWVzOyB0aGVuIEFDX0RFRklORShGSVhFRF9QT0lOVCkgZmldKQpAQCAtODIsNiAr
OTYsOCBAQAogCiBBQ19BUkdfRU5BQkxFKGVwaWMtNDhrLCBbICAtLWVuYWJsZS1lcGljLTQ4ayAg
ICAgICBlbmFibGUgc3VwcG9ydCBmb3IgRXBpYyA0Ljgga2JwcyBtb2RlXSwgW2lmIHRlc3QgIiRl
bmFibGV2YWwiID0geWVzOyB0aGVuIEFDX0RFRklORShFUElDXzQ4SykgZmldKQogCitDRkxBR1M9
IiRDRkxBR1MgJE9QVF9DRkxBR1MiCisKIGRubCBPdXRwdXQgdGhlIG1ha2VmaWxlcyBhbmQgdmVy
c2lvbi5oLgogCiBBQ19PVVRQVVQoW01ha2VmaWxlIGxpYnNwZWV4L01ha2VmaWxlIHNyYy9NYWtl
ZmlsZSBkb2MvTWFrZWZpbGUgU3BlZXguc3BlYwoK
--- >8 ----
List archives: http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'speex-dev-request at xiph.org'
containing only the word 'unsubscribe' in the body. No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.
More information about the Speex-dev
mailing list