This is the mail archive of the gcc-bugs@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: -fno-crossjumping not working + weird asm behavior


Zdenek Dvorak writes:

 > Gcc does not actually understand semantics of the inline assembly code
 > (its contents is just copied verbatim to the output assembler file,
 > except for a straightforward replacement of register parameters).
 > Specially, it does not know that the JMP macro jumps.
 
 > In fact, the manual explicitly statest that asm() operations must not
 > alter control flow.

Thanks for the clarification. I have solved the problem since then by
giving gcc jump information it needs like so:

#define JMP \
{ ++pc; asm volatile("jmp *%0" : : "g" (*pc)); goto **pc; } 

gcc now happily generates jmp *(%ebx) on the spot and does not
coalesce the code for all cases. The code runs significantly faster,
but I am not sure whether this is a water-tight solution. I'd prefer
gcc to generate better code for this case (avoiding jumps to jumps
when using -fno-crossjumping) - which shouldn't be that hard.

Cheers.

/Michael


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