On Mon, Feb 20, 2012 at 07:10:26PM +0100, Uros Bizjak wrote: > > So the above is right and needed, though perhaps we might want > > a combine pattern or peephole to turn the > > movl $-1, %eax > > xbegin .+6 > > cmpl %eax, $-1 > > jne 1f > > The compiler can reverse the condition and exchange arms of if > expression. This will void the assumption that false arm (and abort > sequence) is at pc+6.
The xbegin .+6 instruction doesn't (from the compiler's POV) as any JUMP_INSN, it just returns either -1 or some other value in %eax (when coupled with setting %eax to -1 before it). That is the semantics of the _xbegin () intrinsic. We can (and at least in the combiner should) model it as a JUMP_INSN with UNSPEC_VOLATILE in it, which will work similarly to asm goto. The question is how happy cfgrtl.c etc. will be on a conditional JUMP_INSN with UNSPEC_VOLATILE in it. Jakub