Message board for the users of flat assembler.
> Main > Optimization, MUL & DIV help needed
I need the algorithm or program that tells how much to shift and what to add after the shift when dividing or multiplying by a certain number.
mov eax, dword[SomeNumber]
mov ecx, ????
shr eax, ????
add eax, ????
Thanks for the help in advance
|27 Dec 2004, 04:53||
Search for AMD's optimization manual.
UPDATE: The file I have is named 22007.pdf, but I guess there's a newer version of it with a different name. Title: "AMD Athlonâ„¢ Processor - x86 Code Optimization Guide". I could post the (small) code here, but you'll appreciate read the manual.
Last edited by beppe85 on 27 Dec 2004, 20:37; edited 1 time in total
|27 Dec 2004, 07:53||
its a problem , because you cannot always replace a mul by shl and add in the way you wanna.
you can use this optimization only if you are multiplying by the same number, ex.: 10, or 320
|27 Dec 2004, 11:50||
The Svin's magic divider will convert div to mul and shifts. Source code included.
|27 Dec 2004, 12:28||
You should check that site I have as a signature.
It is NOT in vain my idol
direct link to MUL:
P.S. you might have interest in SQRT too:
My updated idol http://www.agner.org/optimize/
|28 Dec 2004, 10:12||
< Last Thread | Next Thread >
Copyright © 1999-2020, Tomasz Grysztar. Also on YouTube, Twitter.
Website powered by rwasa.