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 Thu, Feb 16, 2012 at 5:47 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> On Thu, Feb 16, 2012 at 11:26:53AM -0500, Patrick Marlier wrote:
>> On 02/16/2012 11:06 AM, Kirill Yukhin wrote:
>> > +(define_insn "xbegin_1"
>> > + ?[(set (match_operand:SI 0 "register_operand" "=a")
>> > + ? ?(unspec_volatile:SI [(match_dup 0)] UNSPECV_XBEGIN))
>> > + ? (set (match_operand:BLK 1 "" "")
>> > + ? ?(unspec_volatile:BLK [(match_dup 1)] UNSPECV_XBEGIN))]
>> > + ?"TARGET_RTM"
>> > + ?"xbegin\t.+6"
>> > + ?[(set_attr "type" "other")
>> > + ? (set_attr "length" "3")])
>> > +
>>
>> Here you cannot specify your fallback instruction address. Since
>> those primitives provide high performance speculative code, I would
>> prefer to move my fallback code far away from the speculative code
>> path to improve the code locality.
>
> The intrinsic/builtin just returns a value, so I think you need to
> write
> if (_xbegin () == ~0)
> ?{
> ? ?transaction;
> ? ?_xend ();
> ?}
> else
> ?{
> ? ?fallback;
> ?}
> if you want to use different fallback code from the transaction code.
> 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.

Uros.


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