Author: Robert Hyatt
Date: 06:53:33 12/09/02
Go up one level in this thread
On December 09, 2002 at 00:24:28, Dieter Buerssner wrote: >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. Right.. to let the compiler choose the register. I was simply giving an example. > >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 Thanks. Could not find the "1f" or "1b" stuff anywhere on the web or in the gcc docs/info pages. Bob
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.