Basecase assembly optimisation project

Ondřej Bílka neleai at seznam.cz
Wed Oct 2 23:14:02 CEST 2013


On Wed, Oct 02, 2013 at 08:19:29PM +0200, Niels Möller wrote:
> Torbjorn Granlund <tg at gmplib.org> writes:
> 
> > We don't handle alternatives currently, except with a loop around the
> > loopmixer.  One could think of several classes, some known to the tool,
> > others not-always-valid only by source file annotation.  Examples of the
> > former would be "xor rax,rax" vs "xor eax,eax" and "mov reg,reg" vs lea
> > (reg),reg.
> 
> Another feature, which I looked into while ago without getting very far
> with the loopmixer, is to make it understand associativity. I.e, try
> reordering certain instructions with the same destination register, like
> 
>   xor	%r8, %rax
>   xor	%r9, %rax
> 
> or
> 
>   add	%r8, %rax
>   add	%r9, %rax
>   
> This is possible if nothing else depends on the intermediate results
> (including no dependencies on status flags).
>
This is relatively easy to add, my basic block is swap two adjacent
instructions and I have list of pairs that are possible like
addq addq
addq subq
pminub pminub
...

There is one feature that I plan to add which is recalculating addresses
like transforming between

addq $64, %rdi
movdqa (%rdi), %xmm0
and
movdqa 64(%rdi), %xmm0
addq $64, %rdi

In mine program is programmer responsibility to annotate parts 
without control flow.

 
> Probably more useful for cryptographic loops than for arithmetic.
>
With vector loops this is also usefull.
 
> Regards,
> /Niels
> 
> -- 
> Niels Möller. PGP-encrypted email is preferred. Keyid C0B98E26.
> Internet email is subject to wholesale government surveillance.



More information about the gmp-devel mailing list