This is the mail archive of the gcc-patches@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: [PATCH, i386] RTM support


On Mon, Feb 20, 2012 at 7:18 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> 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.

IIUC the documentation, the fallback label is a parameter to xbegin
insn, but the insn itself doesn't jump anywhere - it just records the
parameter as a fallback address. However, there is no guarantee that
the fallback code is exactly at (pc)+6, so we have to use asm labels
here.

As written in your example in this thread, the label is at the top of
the false branch. Instead of ".+6", we have to pass this label to
xbegin insn somehow.

Uros.


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