Author: Dieter Buerssner
Date: 21:24:28 12/08/02
Go up one level in this thread
On December 08, 2002 at 23:55:36, Robert Hyatt wrote:
>Here is a question I can not find an answer to:
>
>How can I define a local lable in a gcc inline assembly block of code?
>
>IE I want to do this:
>
> test %eax,%eax
> jz skip
jz 1f
> do something
>skip:
1:
"f" in 1f for forward jumping. For backward jumps, "b". Labels are just
numerical values 1-9.
Typically, one would need to use %%eax instead of %eax, or in more generally
coded inline assembly %n.
For example (rather inefficent) code for
int i, res;
if (i != 0)
res = 1;
else
res = 0;
asm (
"testl %1, %1
jz 1f
movl $1, %0
jmp 2f
1: movl $0, %0
2:"
: "=g" (res)
: "r" (i)
: "cc" /* condition code (flags register) changed */)
Regards,
Dieter
This page took 0.01 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.