A simple way to do compile time loop unrolling

Marco Leise Marco.Leise at gmx.de
Fri May 31 09:59:32 PDT 2013


Am Fri, 31 May 2013 16:33:19 +0200
schrieb Piotr Szturmaj <bncrbme at jadamspam.pl>:

> It is also an opportunity to do loop vectorization. But I 
> doubt that either is available in DMD, not sure about GDC and LDC.

GDC once vectorized something for me, where I used a struct of
4 ubyte fields. I don't remember if it was a loop at all. I
think all I did was operate on 3 of the fields in sequence
applying the same operations and the compiler loaded the whole
struct into an SSE register and it really payed off speed wise!

But when you think about it, working with RGB or XYZW vectors
is a common task in programming, so I can see why they put so
much work into vectorization.
The caveat is just that you have to remember to add a fourth
dummy field to XYZ or RGB.

-- 
Marco



More information about the Digitalmars-d mailing list