Re: Allegro assembly code (was: Re: [AD] proposing a new official .lib name for VC static CRT version)

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]




2006/1/16, Andrei Ellman <ae-a-alleg@xxxxxxxxxxxxxxxxxxxx>:
Elias Pschernig wrote:
>
> Maybe it's time to remove the asm version in both branches?
> [...]
> - reduced performance on things like intel 386 and 486 (are they still
> in use though, and does Allegro still work on them?)

I can confirm that a game I compiled with DJGPP and Allegro 4.2.0 still
works on a '486 laptop.

About 2.5 years ago, I tried unsuccessfully to get one of the Allegro
4.0.3 examples (exdbuf) to work on a '386SX laptop (that's without the
FPU). The program crashed with an 'illegal instruction' error, meaning
that even though exdbuf does not use the FPU, I suspect that the GCC
runtime does try and do something with the FPU. However, I was not sure
which flags I needed to use to get GCC to produce a version that does
not require the FPU. After plenty of tweaking of the makefile, I did
manage to get the DEBUG version of exdbuf to work, but not the release
version. Just out of interest, does anyone know which flags are needed
to build executables with GCC that will work on a 386SX? Alas, I do not
have access to a 386DX, so can't tell you if it works on one of those or
not.

http://gcc.gnu.org/onlinedocs/gcc-3.4.4/gcc/i386-and-x86_002d64-Options.html#i386-and-x86_002d64-Options
I would assume that -march=i386 should do the trick. Also perhaps disabling MMX and other exotic things would be a good idea. I'm not sure about windows but I think *nix ./configure should take care of that.

Anyway, now that compilers have improved, is there still an advantage to
using ASM even on 386s and 486s, or are the compilers good enough at
creating C code just as fast or even faster than what we already have -
even on the 386s and 486s?

There certainly is a time and place for using hand coded ASM but I think Allegro is not the place nor do the developers have the time :)
Compilers can never be as smart as really smart humans that take compiler output and optimize it further but I doubt anyone has the time to do it with Allegro. The ASM code that was written back then was probably better than what compilers could come up with but it seems it is not like this any more.

Also, are the compilers smart enough to be
able to guess when they should make use of things like MMX, SSE etc
instructions and try to vectorise similar operations so they can be
speeded up on such proccessors?
Generally, no. ICC or Intel compiler is considered relatively good at this but as I found out GCC actually creates faster allegro that ICC. Probably because Allegro uses not-so SIMD friendly stuff.
 

I think that one of the advantages of getting rid of the Assembly code
is that we don't have to write some assembly code optimised for each
variant of the x86 - we should just leave it up to GCC's optimisation-flags.

AE.

I agree. Good old C  is good enough for most stuff. If someone really wants to  go down and dirty (s)he should use intrinsics. They are basically as good as ASM only that they are portable across different platforms, compilers and OS'es. Only thing is that I don't think any compiler generates alternative code when no machine instructions for the intrinsics are available. In theory this could be achieved with some preprocessor magic


On the subject, can anyone run Allegro test program (tests/test) on different platforms and CPU's? Suggested is to run it in 800x600 and test memory bitmaps(profile memory). I have done it on P4 and P1 MMX on Linux. I can do it on AMD64 and AthlonXP on win32 and Linux32, and P3 on Linux.

My results are on these two links:
http://www.allegro.cc/forums/thread/477775#target
http://www.allegro.cc/forums/thread/478181#target

All I did was to run the allegro test in most of the colour depths and put the results to a table to see how much have they changed. If you like you can just send those results with platform deceptions to me and I'll make the tables myself.
The purpose would be to find out if there are some combinations where C code is massively slower than ASM.

I know I have said it many times before that I want to do a better test program for Allegro but as most of us I just don't have the time for it. If anyone does, feel free to do it yourself :)
--
Kalle Last

Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/