This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
How reuse inline assembler conditionals?
- From: "Benjamin K." <bkausbk at web dot de>
- To: <gcc at gcc dot gnu dot org>
- Date: Mon, 30 Jun 2003 21:57:15 +0200
- Subject: How reuse inline assembler conditionals?
Example (need x86 compatible system):
int Increment(int a){
int tmp;
asm volatile(
"inc %0\n"
: "=r" (tmp)
: "0" (a)
);
return tmp;
}
x86 cpu will set conditional flags after using INC
instruction, but this conditional will no be used by
gcc, why?
Gcc will produce something like:
if (Increment(10)==0) {
}
mov eax,10
inc eax
test eax,eax
jnz Lxx
But "test eax,eax" isn't needed here.
How can the function be declared to reuse asm conditional flags?
Benjamin Kalytta