Loop unrolling + fusion ?

Tyson Whitehead twhitehead at gmail.com
Mon Mar 2 14:42:33 EST 2009


On March 1, 2009 17:31:13 Max Bolingbroke wrote:
> I am no assembly guru and haven't seen that last form of leaq either,
> but I'm going to guess that:
>
>      leaq        (%rsi,%rsi,4), %rax
>
> Says that rax is rsi * ((1 + 1) * 2 ^ 4) = rsi * 32
>
>      leaq        0(,%rax,8), %rsi

If I recall correctly, leaq is load effective address (i.e., write the address 
into the destination register instead of the data at the address).

The address form is i(b,o,s) = i+b+o*s.  You have (%rsi,%rsi,4) = %rsi+%rsi*4 
into %rax followed by 0(,%rax,8) = rax*8 into %rsi, ultimately giving %rsi*40 
into %rsi (which is the multiplication you have in the ghc generated loop).

(the restrictions on the address form is that s must be one of 1, 2, 4, or 8)

Interesting discussion by the way.  : )

Cheers!  -Tyson

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://www.haskell.org/pipermail/glasgow-haskell-users/attachments/20090302/82fd7cbf/attachment.bin


More information about the Glasgow-haskell-users mailing list