Rocksolid Light

Welcome to Rocksolid Light

mail  files  register  newsreader  groups  login

Message-ID:  

Frankly, Scarlett, I don't have a fix. -- Rhett Buggler


devel / comp.lang.asm.x86 / Re: Optimize speed 8086 instruction "rep movsb" and "rep stosb"

SubjectAuthor
* Optimize speed 8086 instruction "rep movsb" and "rep stosb"Phu Tran Hoang
`- Optimize speed 8086 instruction "rep movsb" and "rep stosb"wolfgang kern

1
Optimize speed 8086 instruction "rep movsb" and "rep stosb"

<d60a7938-4b3c-4b10-91b2-1dc33fe6abf8n@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=797&group=comp.lang.asm.x86#797

  copy link   Newsgroups: comp.lang.asm.x86
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: phutranhoang@nospicedham.gmail.com (Phu Tran Hoang)
Newsgroups: comp.lang.asm.x86
Subject: Optimize speed 8086 instruction "rep movsb" and "rep stosb"
Date: Thu, 21 Jul 2022 22:19:55 -0700 (PDT)
Organization: A noiseless patient Spider
Lines: 25
Approved: fbkotler@myfairpoint.net - comp.lang.asm.x86 moderation team.
Message-ID: <d60a7938-4b3c-4b10-91b2-1dc33fe6abf8n@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Injection-Date: Fri, 22 Jul 2022 05:19:55 +0000
Injection-Info: reader01.eternal-september.org; posting-host="72eccefa569787c9acac825e7950fa24";
logging-data="3108788"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/489Y5ocb14QF3aJ02ATVXUz8acnuF33w="
User-Agent: G2/1.0
Cancel-Lock: sha1:W4p12OtreHcVOoZxmtcBuIJ1urU=
 by: Phu Tran Hoang - Fri, 22 Jul 2022 05:19 UTC

;Replace "rep movsb" by the following code
test di,1 ; alaign by word
jz $+4
movsb
dec cx

shr cx,1
rep movsw
jnc $+3
movsb

;Replace "rep stosb" by the following code
mov ah, al
test di,1 ; alaign by word
jz $+4
stosb
dec cx

shr cx,1
rep stosw
jnc $+3
stosb

Re: Optimize speed 8086 instruction "rep movsb" and "rep stosb"

<tbe96u$uv3$1@gioia.aioe.org>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=799&group=comp.lang.asm.x86#799

  copy link   Newsgroups: comp.lang.asm.x86
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: nowhere@nospicedham.nevernet.at (wolfgang kern)
Newsgroups: comp.lang.asm.x86
Subject: Re: Optimize speed 8086 instruction "rep movsb" and "rep stosb"
Date: Fri, 22 Jul 2022 15:37:33 +0200
Organization: Aioe.org NNTP Server
Lines: 51
Approved: fbkotler@myfairpoint.net - comp.lang.asm.x86 moderation team.
Message-ID: <tbe96u$uv3$1@gioia.aioe.org>
References: <d60a7938-4b3c-4b10-91b2-1dc33fe6abf8n@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: reader01.eternal-september.org; posting-host="72eccefa569787c9acac825e7950fa24";
logging-data="3322882"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+NF61RDmFjLdpy7aBcxSRnWYsSqO6y50Y="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.11.0
Cancel-Lock: sha1:OERh0yyILySMAAxCgTBFlJg0Hhg=
 by: wolfgang kern - Fri, 22 Jul 2022 13:37 UTC

On 22/07/2022 07:19, Phu Tran Hoang wrote:
> ;Replace "rep movsb" by the following code
> test di,1 ; alaign by word
> jz $+4
> movsb
> dec cx
>
> shr cx,1
> rep movsw
> jnc $+3
> movsb
>
>
>
> ;Replace "rep stosb" by the following code
> mov ah, al
> test di,1 ; alaign by word
> jz $+4
> stosb
> dec cx
>
> shr cx,1
> rep stosw
> jnc $+3
> stosb

[jnc+1 ? stosb/stosw are only one byte code "AA/AB"]

Yes, pre- and post-aligning string operations are
the main speed-gain in my OS. It works with 32-bit
reduction/extension for any odd start and size.

But I also align source or destination to quad bounds.

TEST esi,3
JZ isAligned
.... ;adjust for an aligned loop start here
isAligned:
SHR ecx,1 ;no action at all if ecx=0
JNC +1
LODSB
SHR ecx,1
JNC +2 ; +2 for use32
LODSW ; because prefix required here
REP LODSD ;falls through if ECX=Zero

and with similar dummy reads up front and at end it
can part-read disk sectors at any offset and size.
__
wolfgang

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor