flat assembler
Message board for the users of flat assembler.

Index > Main > algoritm optimization: bitstreams

Goto page Previous  1, 2
Author
Thread Post new topic Reply to topic
S.T.A.S.



Joined: 09 Jan 2004
Posts: 173
Location: Ru#27
S.T.A.S.
Hi, Matrix.
Well, I belive, on K7 core (athlon) and P6 core (P2 & PIII) mov ebx,imm32 instruction has execute latency of 1.
The same as or mreg32,imm8 (sign extended).
On NetBurst core (PIV) both of them have the latency of 0.5.
The last opcode is 2 bytes shorter, so is preferable in general:
AMD Athlon Processor optimization guide (22007.pdf) wrote:
Use shorter forms of instructions to increase the effective
number of instructions that can be examined for decoding at
any one time.


About and [mem],reg and or [mem],reg, I can't say I dont like them Smile
I just try to avoid unnecessary memory access, if calculations can be done via CPU registers - such instructions are usually smaller and faster.
Code:
and [edi],edx   ; mask out first dword
or  [edi],eax   ; set bits in first dword     
I suppose this might be substituted with
Code:
and eax,edx
or  [edi],eax    
just chose the right way to calculate the mask.
Btw, write_bitstream routine seems very long, compare it to my code. (however, mine relys on BitStream structure and does related modifications of its fields in addition to yours. This BitStream is what I call HLL style). Though I'm not sure mine is Ok - I can't compile lzss library for some weird reason Sad
Post 31 Oct 2004, 10:32
View user's profile Send private message Reply with quote
Matrix



Joined: 04 Sep 2004
Posts: 1171
Location: Overflow
Matrix
don't say this:
Code:
Code:
and [edi],edx   ; mask out first dword 
or  [edi],eax   ; set bits in first dword 
    

I suppose this might be substituted with
Code:
Code:
and eax,edx 
or  [edi],eax
    


i was assigning those bits not just setting zeroes,
if bit was 1 that was not supposed to, will be 0
[edi] was a part of a bit string
Post 31 Oct 2004, 13:15
View user's profile Send private message Visit poster's website Reply with quote
S.T.A.S.



Joined: 09 Jan 2004
Posts: 173
Location: Ru#27
S.T.A.S.
S.T.A.S. wrote:
chose the right way to calculate the mask.

PS
take into account the fact, we're appending bits, not replacing.
Post 01 Nov 2004, 03:34
View user's profile Send private message Reply with quote
Matrix



Joined: 04 Sep 2004
Posts: 1171
Location: Overflow
Matrix
now my shrd shld less function should be all right too, its updated

did you read the first post of Decard?
his code does similar to my.
not just setting bits, but also re-setting them.
Post 01 Nov 2004, 04:09
View user's profile Send private message Visit poster's website Reply with quote
S.T.A.S.



Joined: 09 Jan 2004
Posts: 173
Location: Ru#27
S.T.A.S.
Do you mean we're not able to move 0 to whole DWORD at the end of stream, and set some bits to 1 then ?
As I understand 'bitstream', this has serial access, not random.

Matrix wrote:
his code does similar to my
I don't see the use of BitStream structure in yours.
Post 01 Nov 2004, 06:21
View user's profile Send private message Reply with quote
Matrix



Joined: 04 Sep 2004
Posts: 1171
Location: Overflow
Matrix
And while there are free registers i whouldn't use memory for such in a core function. ECX hi part, ebp, esp, esi, es, fs, gs, fs, ss are still freeee
Post 01 Nov 2004, 09:08
View user's profile Send private message Visit poster's website Reply with quote
S.T.A.S.



Joined: 09 Jan 2004
Posts: 173
Location: Ru#27
S.T.A.S.
Nope! es, fs, gs, fs, ss are reserved by windows.
Post 01 Nov 2004, 13:28
View user's profile Send private message Reply with quote
decard



Joined: 11 Sep 2003
Posts: 1092
Location: Poland
decard
thanks for your codes Smile. Now I will implement your solutions in the library and see how they work.
Post 01 Nov 2004, 13:37
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page Previous  1, 2

< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar.

Powered by rwasa.