This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: i386 and asm jumping



On 2002.05.07 15:40 Andreas Schwab wrote:
: dewar@gnat.com (Robert Dewar) writes:
: 
: |> > It is not possible.  ASM statements may not jump.
: |> > You may want to use computed goto GCC extension istead.
: |> 
: |> Seems a pity, this is quite a serious restriction in capability
: |> compared with Asm inserts in other compilers.
: 
: What's wrong with computed goto in this situation?

What I would like to do is to replace the following code
with inline assembler:

	if (--cnt == 0)
	  goto HANDLER;
        goto NEXT;

The code above will generate; load cnt into register,
decrement register, store register and jump to HANDLER
if zero flag is set.  I would like to replace this with
the following assembler code:

	decl	cnt
	jz	HANDLER
	jmp	NEXT

Speed is everything :)

regards
johan


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]