flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
bitRAKE 24 Oct 2007, 21:40
Here is a good link...
http://www.azillionmonkeys.com/qed/amultl2.html On newer processors MUL is fast enough to not need special treatment. DIV, though - just forget it exists and use another method. |
|||
![]() |
|
edfed 24 Oct 2007, 21:51
it is for the code on older X86 processors
|
|||
![]() |
|
bitRAKE 24 Oct 2007, 22:25
Quote: Please note that the optimization model is for pre-MMX based Pentiums. The MMX style pentiums offer more pairing potential, that I have as yet not investigated. Code: mul ebp add ebx, eax mov eax, [esi][j] mov [esi][j][-4], ebx mov ebx, esp adc ebx, edx |
|||
![]() |
|
shoorick 25 Oct 2007, 04:53
macro eaxx3
{ lea eax,[eax + eax*2] } (32-bit mode only) |
|||
![]() |
|
edfed 25 Oct 2007, 21:58
macro eaxx3 {lea eax,[eax*3]}
|
|||
![]() |
|
vid 25 Oct 2007, 22:11
shoorick: why 32bit mode only?
edfed: why did you repost same macro again? |
|||
![]() |
|
edfed 25 Oct 2007, 22:16
sorry
i didn't know that it wasn't the same ![]() ![]() Last edited by edfed on 25 Oct 2007, 22:30; edited 1 time in total |
|||
![]() |
|
vid 25 Oct 2007, 22:28
wow... it really doesn't compile for some reason.
but the macro is still same shoorick's, since there is no "+esi" nor any chance to put it there somehow |
|||
![]() |
|
edfed 25 Oct 2007, 22:32
i've made a mistake
lea eax,[eax+3+esi] and not lea eax,[eax*3+esi] really sorry |
|||
![]() |
|
edfed 26 Oct 2007, 14:19
but one thing is sure VID
macromul will demonstrate the many ways to multiply without any imul instruction after i think about a macrodiv and with FP numbers, it is possible to make the square root with dividing the exponent by two cause square root is the half of power x^1/2 it will help for your floating point thread ![]() |
|||
![]() |
|
vid 26 Oct 2007, 15:37
and does this have to do with macros? why should this kind of thing be done with macro?
|
|||
![]() |
|
edfed 26 Oct 2007, 15:53
not should be
could be called function is too slow macro is like instruction in this case it's an other way to work it surelly have an application and if not, it is only to demonstrate it is possible probably there is an algorythmic way to calculate the instructions to execute is there a posibility of overload the internal register that hold the current opcode? without changing the eip reg and if not, is there a µP that can do it??? like: mov opcodereg,shr eax,2 |
|||
![]() |
|
edfed 26 Oct 2007, 15:54
or override the internal caches with temporary code?
|
|||
![]() |
|
vid 26 Oct 2007, 16:15
i don't think using macro in this case is good. It makes your code LESS readable than for example this:
Code: lea eax, [eax + 2*eax] ;eax = eax*3 or Code: ;eax = min(eax, ebx) cmp eax, ebx cmova eax, ebx Everyone who is going to read assembly code knows instructions, but he doesn't know your custom macros. He has to find macro declaration, and then understand what macro does - this is not easy, easpecially with complex macros. If there are many such custom macros, it becomes And another thing, for minor part of application which really needs optimization, i don't see reason to use any macros at all. Pure assembly gives better results. |
|||
![]() |
|
edfed 26 Oct 2007, 16:21
ok!
|
|||
![]() |
|
shoorick 29 Oct 2007, 06:48
shoorick: why 32bit mode only? >
seems i was wrong - i thought if you may use only bx,di,si and bp in 16-bit mode as indexing registers, so you may use only them with lea reg,[reg + reg*2], but i see now it is possible for eax also |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2023, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.