This is the mail archive of the gcc-help@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: jmp in asm


ranjith kumar writes:

 >     Assembly code can be included in a C program by
 > "asm" feature.
 > 
 > My question is to how to include assembly instructions
 >  like jmp ,jc ,loop....which require an address(indeed
 > a label) as an argument.

You can't jump out of (or into) an inline asm.  You put labels into
inline asms in the same way as usual asms, by prefixing assembler
statements.  There's even an example in the gcc manual:

-----------------------
 If you want to test the condition code produced by an assembler
instruction, you must include a branch and a label in the `asm'
construct, as follows:

     asm ("clr %0\n\tfrob %1\n\tbeq 0f\n\tmov #1,%0\n0:"
          : "g" (result)
          : "g" (input));
-----------------------

Andrew.


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