[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160423021658.GX3430@twins.programming.kicks-ass.net>
Date: Sat, 23 Apr 2016 04:16:58 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: torvalds@...ux-foundation.org, mingo@...nel.org,
tglx@...utronix.de, will.deacon@....com,
paulmck@...ux.vnet.ibm.com, boqun.feng@...il.com,
waiman.long@....com, fweisbec@...il.com
Cc: linux-kernel@...r.kernel.org, linux-arch@...r.kernel.org,
rth@...ddle.net, vgupta@...opsys.com, linux@....linux.org.uk,
egtvedt@...fundet.no, realmz6@...il.com,
ysato@...rs.sourceforge.jp, rkuo@...eaurora.org,
tony.luck@...el.com, geert@...ux-m68k.org, james.hogan@...tec.com,
ralf@...ux-mips.org, dhowells@...hat.com, jejb@...isc-linux.org,
mpe@...erman.id.au, schwidefsky@...ibm.com, dalias@...c.org,
davem@...emloft.net, cmetcalf@...lanox.com, jcmvbkbc@...il.com,
arnd@...db.de, dbueso@...e.de, fengguang.wu@...el.com
Subject: Re: [RFC][PATCH 10/31] locking,hexagon: Implement
atomic_fetch_{add,sub,and,or,xor}()
On Fri, Apr 22, 2016 at 11:04:23AM +0200, Peter Zijlstra wrote:
> +#define ATOMIC_FETCH_OP(op) \
> +static inline int atomic_fetch_##op(int i, atomic_t *v) \
> +{ \
> + int output, val; \
> + \
> + __asm__ __volatile__ ( \
> + "1: %0 = memw_locked(%2);\n" \
> + " %1 = "#op "(%0,%3);\n" \
> + " memw_locked(%2,P3)=%0;\n" \
I'm thinking that wants to be:
memw_locked(%2,P3)=%1;
> + " if !P3 jump 1b;\n" \
> + : "=&r" (output), "=&r" (val) \
> + : "r" (&v->counter), "r" (i) \
> + : "memory", "p3" \
> + ); \
> + return output; \
> +}
Powered by blists - more mailing lists