
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