Basecase assembly optimisation project

Niels Möller nisse at
Wed Oct 2 20:19:29 CEST 2013

Torbjorn Granlund <tg at> 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


  add	%r8, %rax
  add	%r9, %rax
This is possible if nothing else depends on the intermediate results
(including no dependencies on status flags).

Probably more useful for cryptographic loops than for arithmetic.


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