MMX array operations (was: Optimizations of DMD)

Daniel Keep daniel.keep.lists at gmail.com
Tue Mar 6 02:35:31 PST 2007


Benji Smith wrote:
> Daniel Keep wrote:
>> Some time ago, I wrote a simple library that extended arrays of basic
>> types with parallel operations (like add, mult, madd, etc.) that were
>> coded in MMX.  Never bothered to publish it since I wasn't sure if it
>> was actually useful or not...
> 
> Please do publish it. I'd like to teach myself some assembly
> programming, and it'd be nice to see someone else's code for inlining
> array operations with MMX instructions.
> 
> If you don't post it at dsource, at least send me an email with the code
> attached.
> 
> Thanks!!
> 
> --benji

Tracked it down, zipped it up, and attached it.  However, keep in mind
that this code is almost a year old, not extensively tested, and *very
likely* won't compile.  If you actually want to get it working, I
suggest looking for implicit conversions from arrays to pointers and
public/private import problems (default changed from public to private).

I actually liked how this library was put together, even if it *was*
fairly useless.  At compile time, it selected one of a set of backends
depending on version flags and what platform you were on.  If your
platform didn't have a fast parallel implementation available, it simply
fell back on the software implementation.  Code once, run anywhere, run
really fast where possible :P

Anyway, the assembler code should still work.  I don't think it's all
been very thoroughly tested, and there could be other errors or
problems.  But it might make a nice starting point.

Incidentally, all of the code is public domain, so if anyone wants to
take this and run with it, feel free.  If anyone on the Tango project is
interested, I'd still like to see something like this in Tango (or
Phobos!) at some stage (better designed, I would hope).

	-- Daniel

-- 
Unlike Knuth, I have neither proven or tried the above; it may not even
make sense.

v2sw5+8Yhw5ln4+5pr6OFPma8u6+7Lw4Tm6+7l6+7D
i28a2Xs3MSr2e4/6+7t4TNSMb6HTOp5en5g6RAHCP  http://hackerkey.com/



More information about the Digitalmars-d mailing list