This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Add faster HTM fastpath for libitm TSX v2
- From: Andi Kleen <andi at firstfloor dot org>
- To: Uros Bizjak <ubizjak at gmail dot com>
- Cc: gcc-patches at gcc dot gnu dot org, Andi Kleen <andi at firstfloor dot org>, Torvald Riegel <triegel at redhat dot com>, Richard Henderson <rth at redhat dot com>
- Date: Fri, 25 Jan 2013 16:54:14 +0100
- Subject: Re: [PATCH] Add faster HTM fastpath for libitm TSX v2
- References: <CAFULd4Z+wvnf9wiL5OcvCTDBrXp4ReCLCgqyzzLnjMUnD-Ztjg@mail.gmail.com>
> Probably the attached (RFC) patch can be useful in this case. The
> patch allows to specify the label for xbegin, so it is possible to
> implement code like following (non-sensical) example:
It can be actually implemented using asm goto. I have some macros
for this. And the tree optimizers should even support it.
#define XBEGIN(label) \
asm volatile goto(".byte 0xc7,0xf8 ; .long %l0-1f\n1:" ::: "eax" :
label)
#define XEND() asm volatile(".byte 0x0f,0x01,0xd5")
#define XFAIL(label) label: asm volatile("" ::: "eax")
#define XFAIL_STATUS(label, status) label: asm volatile("" : "=a"
(status))
But the assembler code is still needed for this because the non TSX path needs
to save all registers (it's like a setjmp/longjmp), and that cannot
be implemented in C.
The goal of the assembler code was not to use the label, but to move
the initial transaction before the setjmp code.
-Andi