By default these assembly optimizations are left out, though amd64's support all the same MMX, SSE etc. instructions as their 32-bit progenitors. Some minor modification was needed in some places, and a few bits require a NASM binary which of course isn't going to work, and one is blocked by an apparent gcc bug, but I have been able to enable most optimizations. It appears to work with gcc 3.3 and 3.4. Sadly this means 3.3. and 3.4 share the same /flaws/ that prevent one optimization. The resulting binaries work very well. To use these optimizations, patch to SDL-1.2.8 with the attached diff, and add -DUSE_ASMBLIT in the CFLAGS. Reproducible: Always Steps to Reproduce: 1. patch -p1 < sdl-1.2.8-opteron-mmx.diff 2. CFLAGS="-DUSE_ASMBLIT -O2" export CFLAGS ; ./configure 3. make, etc Actual Results: SDL compiled with assembly optimizations under amd64. Portage 2.0.51-r15 (default-linux/amd64/2004.3, gcc-3.4.3, glibc-2.3.4.20041102-r0, 2.6.5 x86_64) ================================================================= System uname: 2.6.5 x86_64 AMD Opteron(tm) Processor 242 Gentoo Base System version 1.6.8 Python: dev-lang/python-2.2.3-r5,dev-lang/python-2.3.4 [2.3.4 (#1,Jun 29 2004, 09:40:45)] dev-lang/python: 2.2.3-r5, 2.3.4 sys-devel/autoconf: 2.59-r6, 2.13 sys-devel/automake: 1.7.9-r1, 1.8.5-r3, 1.5, 1.4_p6, 1.6.3, 1.9.4 sys-devel/binutils: 2.15.92.0.2-r2 sys-devel/libtool: 1.5.10-r4 virtual/os-headers: 2.6.8.1-r3 ACCEPT_KEYWORDS="amd64 ~amd64" AUTOCLEAN="yes" CFLAGS="-march=x86-64 -O2 -pipe" CHOST="x86_64-pc-linux-gnu" CONFIG_PROTECT="/etc /usr/X11R6/lib/X11/xkb /usr/kde/2/share/config /usr/kde/3.1/share/config /usr/kde/3.3/env /usr/kde/3.3/share/config /usr/kde/3.3/shutdown /usr/kde/3/share/config /usr/share/config /var/qmail/control" CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d" CXXFLAGS="" DISTDIR="/usr/portage/distfiles" FEATURES="autoaddcvs autoconfig ccache distlocks sandbox" GENTOO_MIRRORS="http://mirrors.tds.net/gentoo ftp://mirrors.tds.net/gentoo ftp://ftp.ndlug.nd.edu/pub/gentoo/" MAKEOPTS="-j3" PKGDIR="/usr/portage/packages" PORTAGE_TMPDIR="/var/tmp" PORTDIR="/usr/portage" PORTDIR_OVERLAY="/usr/local/portage" SYNC="rsync://rsync.gentoo.org/gentoo-portage" USE="amd64 X aalib acpi alsa arts berkdb bitmap-fonts cdr crypt cups dvd esd f77 fam flac font-server foomaticdb fortran gdbm ggi gif gpm gtk guile imagemagickimlib innodb ipv6 ithreads java jp2 jpeg kde libwww lzw lzw-tiff mad mikmod motif multilib mysql ncurses nls nptl oggvorbis opengl oss pam pdflib perl png postgres ppds python qt readline scanner slang speex ssl tcltk tcpd tiff truetype truetype-fonts type1-fonts usb userlocales xml xml2 xmms xpm xrandr xv zlib" Unset: ASFLAGS, CBUILD, CTARGET, LANG, LC_ALL, LDFLAGS
Created attachment 50192 [details, diff] Patch to enable assembly optimizations for AMD64
Created attachment 54479 [details] patch log thanks for this great work, but i'm sorry, applying this patch fails for me. i attached the patch output
You need to fiddle with -p<n> to get things to patch sometimes because of the way recursive diff's work. Here's the way I get this patch to apply: # tar -zxf SDL-1.2.8.tar.gz # cd SDL-1.2.8 # patch -p1 < amd64mmx.patch
this patch really should be cleaned up and e-mailed to the libsdl mailing list
could somebody from the games herd please review the patch?
sorry, but as i said already, i dont think this is appropriate for inclusion it should be taken to the libsdl mailing list
Comment on attachment 50192 [details, diff] Patch to enable assembly optimizations for AMD64 marking obsolete due to comment 6
so do it !
I *have* posted it to the list, though I think they missed it... Now that they've released 1.2.9 I'll need to make a new patch.