This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [i386, patch, RFC] HLE support in GCC
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Andi Kleen <andi at firstfloor dot org>
- Cc: Kirill Yukhin <kirill dot yukhin at gmail dot com>, Jakub Jelinek <jakub at redhat dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 10 Apr 2012 13:00:37 -0700
- Subject: Re: [i386, patch, RFC] HLE support in GCC
- References: <CAGs3Rfu6kiQhDPXy_QmEyKzs-FXPO9i74VUEUPoHX0WiEaz_iA@mail.gmail.com> <20120307111008.GK16117@tyan-ft48-01.lab.bos.redhat.com> <CAMe9rOqC1fckmVN9MOXWMhG-2jhHYtGCsrXCdT4ZDgp1J39Msw@mail.gmail.com> <CAGs3Rft_0Cs6v3AP_LH2tbbqrym5rf1A4MJ+6fn1T37=BEzrbw@mail.gmail.com> <CAMe9rOqKWyfumpjuLyNGwAxdfzU9XmMDcj0vq4t1CefKJZtg5w@mail.gmail.com> <20120308150912.GS16117@tyan-ft48-01.lab.bos.redhat.com> <CAGs3RftVUdWy=jqfonJFLsyuT6mWjm_0Bdc2Dqjgtd9qNGDRXA@mail.gmail.com> <CAMe9rOrw5mNk=0NX3C74x4v1yEFy7VMTex6QDTEvE1UX+E6P4w@mail.gmail.com> <m2d37f1r6g.fsf@firstfloor.org>
On Tue, Apr 10, 2012 at 9:34 AM, Andi Kleen <andi@firstfloor.org> wrote:
> "H.J. Lu" <hjl.tools@gmail.com> writes:
>
>>> So, to emit HLE prefix, it is possible to do:
>>> int
>>> foo2 (int *p, int oldv, int newv)
>>> {
>>> ?__atomic_compare_exchange_n (p, &oldv, newv, 0, __ATOMIC_ACQUIRE |
>>> __ATOMIC_USE_HLE, __ATOMIC_ACQUIRE);
>>> ?return oldv;
>>> }
>>
>> This is wrong since HLE ACQUIRE/RELEASE has nothing to do with
>> C++ atomic acquire/release. You can have HLE RELEASE with C++
>> atomic acquire.
>
> It makes sense to combine the two. On x86 C++ atomic acquire/release
> means the compiler cannot move references outside. For HLE
> we really want the same, otherwise some of the memory references
> inside the transaction may not be transactional.
>
> So I think HLE_ACQUIRE should imply C++ acquire
> and HLE_RELEASE imply C++ release.
>
If it is the case, can we generate HLE RELEASE/ACQUIRE
prefix automatically for C++ atomics via -mhle command line option.
Then you don't need to modify the source codes to enable HLE support.
--
H.J.