This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH], Add PowerPC ISA 3.0 Atomic Memory Operation functions
- From: Segher Boessenkool <segher at kernel dot crashing dot org>
- To: Michael Meissner <meissner at linux dot vnet dot ibm dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>, David Edelsohn <dje dot gcc at gmail dot com>, Bill Schmidt <wschmidt at linux dot vnet dot ibm dot com>
- Date: Fri, 6 Oct 2017 11:45:10 -0500
- Subject: Re: [PATCH], Add PowerPC ISA 3.0 Atomic Memory Operation functions
- Authentication-results: sourceware.org; auth=none
- References: <20171005221413.GA27169@ibm-tiger.the-meissners.org>
Hi Mike,
On Thu, Oct 05, 2017 at 06:14:14PM -0400, Michael Meissner wrote:
> This patch adds support for most of the PowerPC ISA 3.0 Atomic Memory Operation
> instructions, listed in section 4.5 of the manual. Currently these functions
> are done via extended asm. At some point in the future, I will probably move
> the inner part of the patch to use new built-in functions to replace the
> extended asm.
Just some asm comments for now, have to think about the rest a bit more.
> +#define _AMO_LD_SIMPLE(NAME, TYPE, OPCODE, FC) \
> +static __inline__ TYPE \
> +NAME (TYPE *_PTR, TYPE _VALUE) \
> +{ \
> + unsigned __int128 _TMP; \
> + TYPE _RET; \
> + __asm__ volatile ("mr %L1,%3\n" \
> + "\t" OPCODE " %1,%4,%5\t\t# %0\n" \
> + "\tmr %2,%1\n" \
> + : "+Q" (_PTR[0]), "=&r" (_TMP), "=r" (_RET) \
> + : "r" (_VALUE), "b" (&_PTR[0]), "n" (FC)); \
> + return _RET; \
> +}
You don't need arg 4: "%P0" is the same thing.
Do you really need the mr insns? Can't you express that in the
arguments? Perhaps using a union of __int128 with something that
is two long ints?
> +#define _AMO_ST_SIMPLE(NAME, TYPE, OPCODE, FC) \
> +static __inline__ void \
> +NAME (TYPE *_PTR, TYPE _VALUE) \
> +{ \
> + __asm__ volatile (OPCODE " %1,%2,%3\t\t# %0" \
> + : "+Q" (_PTR[0]) \
> + : "r" (_VALUE), "b" (&_PTR[0]), "n" (FC)); \
> + return; \
> +}
Same for "b" (arg 2) here.
Segher