Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1385559

Re: [RFC][PATCH 10/31] locking,hexagon: Implement atomic_fetch_{add,sub,and,or,xor}()

From Peter Zijlstra <peterz@infradead.org>
Newsgroups linux.kernel
Subject Re: [RFC][PATCH 10/31] locking,hexagon: Implement atomic_fetch_{add,sub,and,or,xor}()
Date 2016-04-23 04:20 +0200
Message-ID <rqVkS-3KW-3@gated-at.bofh.it> (permalink)
References <rqFSN-8hs-3@gated-at.bofh.it> <rqGcc-hy-41@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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;							\
> +}

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[RFC][PATCH 00/31] implement atomic_fetch_$op Peter Zijlstra <peterz@infradead.org> - 2016-04-22 12:10 +0200
  [RFC][PATCH 10/31] locking,hexagon: Implement atomic_fetch_{add,sub,and,or,xor}() Peter Zijlstra <peterz@infradead.org> - 2016-04-22 12:10 +0200
    Re: [RFC][PATCH 10/31] locking,hexagon: Implement  atomic_fetch_{add,sub,and,or,xor}() Peter Zijlstra <peterz@infradead.org> - 2016-04-23 04:20 +0200
      Re: [RFC][PATCH 10/31] locking,hexagon: Implement  atomic_fetch_{add,sub,and,or,xor}() Richard Kuo <rkuo@codeaurora.org> - 2016-04-26 02:40 +0200
  [RFC][PATCH 22/31] locking,tile: Implement atomic{,64}_fetch_{add,sub,and,or,xor}() Peter Zijlstra <peterz@infradead.org> - 2016-04-22 12:10 +0200
    Re: [RFC][PATCH 22/31] locking,tile: Implement  atomic{,64}_fetch_{add,sub,and,or,xor}() Peter Zijlstra <peterz@infradead.org> - 2016-04-26 17:30 +0200
  [RFC][PATCH 31/31] locking,qrwlock: Employ atomic_fetch_add_acquire() Peter Zijlstra <peterz@infradead.org> - 2016-04-22 12:10 +0200

csiph-web