bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Very "slow" assembler


From: Eli Zaretskii
Subject: Re: Very "slow" assembler
Date: Tue, 13 Mar 2001 12:12:19 +0200 (IST)

On Tue, 13 Mar 2001, Andrej Hanin wrote:

> asm(  "
>                 movw $1000 , %bx
>         1:      movl $1000000 , %ecx
>         0:      addb %al , %ah  // just any instruction
>                 loop 0b
>                 decw %bx
>                 jnz 1b
>        "
>    );
> }
> 
> CAN YOU IMAGINE the execution time of this code?????????
>     just   25 seconds !!!!!!!!!!!!!!

One problem here is that you mix 16-bit and 32-bit instructions (movw
and decw use a 16-bit mode).  This slows down the code tremendously.
Try to use 32-bit instructions instead.

Also, alignment of the labels might be an issue: 32-bit code will run
faster if labels are aligned on 16-byte boundaries.

And please try not to use the !, ? and UPPER CASE as much as you did:
it's really annoying to read such messages.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]