flat assembler
Message board for the users of flat assembler.
![]() Goto page 1, 2 Next |
Author |
|
revolution
This can jump up to +-2GB.
Code: test ecx,ecx
jz Somewhere ![]() |
|||
![]() |
|
sinsi
If you need to optimize, using jecxz (and loop) are much slower than a test/jump (or a dec/jnz).
|
|||
![]() |
|
LocoDelAssembly
On AMD, JECXZ has a two cycles latency and it is a DirectPath instruction. Maybe JECXZ is not always as fast as TEST/J(N)Z is, but still, there may be situations in which you don't want to destroy the flags to find out ECX's current status.
|
|||
![]() |
|
Tyler
Tomasz uses loop in "convert_line" in preproce.inc
Code: ... mov ebx,characters xor ecx,ecx convert_symbol: lods byte [esi] stos byte [edi] xlat byte [ebx] or al,al loopnzd convert_symbol neg ecx cmp ecx,255 ... |
|||
![]() |
|
sinsi
>Tomasz uses loop in "convert_line" in preproce.inc
Also uses xlat... Just an observation, not a hard-and-fast rule, since it depends on the cpu. P4 is good with dec and bad with loop and jcxz. P3 is slower with dec. |
|||
![]() |
|
ouadji
revolution wrote: This can jump up to +-2GB. thank you revolution ... I didn't know that ! sorry, but i'm a beginner in asm. ![]() ![]() Quote: there may be situations in which you don't want to destroy the flags ![]() Last edited by ouadji on 03 Apr 2010, 06:43; edited 1 time in total |
|||
![]() |
|
rugxulo
sinsi wrote: >Tomasz uses loop in "convert_line" in preproce.inc Also the slow string instructions (lodsb, stosb). Wasn't he writing on a real 386 at one time back in the day?? I'm sure it's smarter to target slow processors that need the extra speed than fast processors that already have it. ![]() |
|||
![]() |
|
sinsi
rugxulo, no argument here, although I haven't programmed recently on less then a P3.
I just latched onto the 'optimize' in the OP. Go to the MASM32 forum and look at all the optimization that goes on there... ![]() |
|||
![]() |
|
revolution
The word "optimise" is so ambiguous. It can mean many things. Optimising for what? Speed? Size? Ease of coding? Ease of reading? Which platform? Which CPU? Under what usage conditions? Hehe, optimise is a dirty word!
|
|||
![]() |
|
ouadji
no, "optimise" isn't a dirty word. No matter why we search a optimization, speed, size, ease of coding, ease of reading ... it depends on the coding spirit of each developper everyone has his own choice but "car" is a dirty word .. bus, truck, van ? ![]() |
|||
![]() |
|
revolution
Please help me to optimise my code:
Code: ;pretend there is some code here |
|||
![]() |
|
bitshifter
I help you optimize it for size and readability and speed and everything else...
Code: Hehe ![]() |
|||
![]() |
|
revolution
Wow, it compiled nicely. Thanks bitshifter.
Quote: flat assembler version 1.69.12 (152449 kilobytes memory) |
|||
![]() |
|
LocoDelAssembly
sinsi wrote: P4 is good with dec P4 is bad in pretty much everything including DEC, you must use "SUB reg/mem, 1" instead. Agner Fog wrote: 16.2 INC and DEC (all Intel processors) |
|||
![]() |
|
ouadji
LocoDelAssembly, I don't quite understand, tell you about this? Code: mov eax,7 mov ebx,5 x_: sub eax,1 dec ebx jc somewhere jmp x_ |
|||
![]() |
|
zhak
yes, in this case jump will be taken if CF was set by SUB EAX, 1
|
|||
![]() |
|
SeproMan
I find the original suggestion by Ouadji a very useful one.
In fact I've incorporated it just a few days ago into my own assembler language project by showing an error message like "Target out of reach by 2 bytes" Thanks Ouadji In FASM "jz Somewhere" has a range of +-2GB. This is not intuitive. I advocate a more WYSIWYG approach jz Somewhere ;[-128,127] jzw Somewhere ;[-32768,32767] jzd Somewhere ;[-2GB,2GB-1] _________________ Real Address Mode. |
|||
![]() |
|
revolution
in fasm syntax:
jz byte Somewhere ;[-128,127] [edit] byte doesn't compile. What is the byte override? jz word Somewhere ;[-32768,32767] jz dword Somewhere ;[-2GB,2GB-1] The size override forces it to a particular length. |
|||
![]() |
|
Tomasz Grysztar
Actually, this is not the fasm syntax. The fasm syntax is:
Code: jz short word Somewhere ; [-128;127], EIP masked with 0FFFFh jz short dword Somewhere ; [-128;127] jz near word Somewhere ; [-32768,32767], EIP masked with 0FFFFh jz near dword Somewhere ; [-2GB,2GB-1] |
|||
![]() |
|
Goto page 1, 2 Next < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.
Website powered by rwasa.