Re: [PATCH 11/23] make atomic_read() and atomic_set() behavior consistent on m32r

2007-08-23 Thread Valdis . Kletnieks
On Thu, 23 Aug 2007 21:29:41 +0200, Segher Boessenkool said: > int f(atomic_t *x) > { > return atomic_read(x) + atomic_read(x); > } > ld r0,@r0 > slli r0,#1 > jmp lr Looks like peephole optimization at work. pgpB5VxTDd0mQ.pgp Description: PGP signature

RE: [PATCH 11/23] make atomic_read() and atomic_set() behavior consistent on m32r

2007-08-23 Thread David Schwartz
> On Thu, 23 Aug 2007, Segher Boessenkool wrote: > The combining, which I've mentioned *multiple*times* is > > if (atomic_read(&x) <= 1) > > and dammit, if that doesn't result in a *single* instruction, the code > generation is pure and utter crap. > > It should result in > > cmpl $1,

Re: [PATCH 11/23] make atomic_read() and atomic_set() behavior consistent on m32r

2007-08-23 Thread Linus Torvalds
On Thu, 23 Aug 2007, Segher Boessenkool wrote: > > This simply isn't true. The compiler *can* combine asm stuff: Please Segher, just shut up. The combining, which I've mentioned *multiple*times* is if (atomic_read(&x) <= 1) and dammit, if that doesn't result in a *single* instructio

Re: [PATCH 11/23] make atomic_read() and atomic_set() behavior consistent on m32r

2007-08-23 Thread David Howells
Segher Boessenkool <[EMAIL PROTECTED]> wrote: > This simply isn't true. The compiler *can* combine asm stuff: > > > typedef struct { int counter; } atomic_t; > > static inline __attribute__((pure)) int atomic_read(const atomic_t *v) > { > int x; > asm("ld %0,@%1" : "=r"(x) : "r

Re: [PATCH 11/23] make atomic_read() and atomic_set() behavior consistent on m32r

2007-08-23 Thread Segher Boessenkool
The inline asm version has the EXACT SAME PROBLEM as the "volatile" version has: it means that the compiler is unable to combine trivial instructions. This simply isn't true. The compiler *can* combine asm stuff: typedef struct { int counter; } atomic_t; static inline __attribute__((pure)) i

Re: [PATCH 11/23] make atomic_read() and atomic_set() behavior consistent on m32r

2007-08-22 Thread Linus Torvalds
On Wed, 22 Aug 2007, Segher Boessenkool wrote: > > > I also tried to rewrite it with inline asm code, but the kernel text size > > > bacame roughly 2kB larger. So, I prefer C version. > > Could you send me the source code diff between the two versions > you tested? 2kB difference is way too mu

Re: [PATCH 11/23] make atomic_read() and atomic_set() behavior consistent on m32r

2007-08-22 Thread Segher Boessenkool
I also tried to rewrite it with inline asm code, but the kernel text size bacame roughly 2kB larger. So, I prefer C version. Could you send me the source code diff between the two versions you tested? 2kB difference is way too much, the asm version should be smaller if anything. You're not th

Re: [PATCH 11/23] make atomic_read() and atomic_set() behavior consistent on m32r

2007-08-22 Thread Chris Snook
Hirokazu Takata wrote: I think the parameter of atomic_read() should have "const" qualifier to avoid these warnings, and IMHO this modification might be worth applying on other archs. I agree. Here is an additional patch to revise the previous one for m32r. I'll incorporate this change if

Re: [PATCH 11/23] make atomic_read() and atomic_set() behavior consistent on m32r

2007-08-21 Thread Hirokazu Takata
Hi, Chris, From: Hirokazu Takata <[EMAIL PROTECTED]> Date: Wed, 22 Aug 2007 10:56:54 +0900 > From: Chris Snook <[EMAIL PROTECTED]> > Date: Mon, 13 Aug 2007 07:24:52 -0400 > > From: Chris Snook <[EMAIL PROTECTED]> > > > > Use volatile consistently in atomic.h on m32r. > > > > Signed-off-by: Chris

Re: [PATCH 11/23] make atomic_read() and atomic_set() behavior consistent on m32r

2007-08-21 Thread Hirokazu Takata
From: Chris Snook <[EMAIL PROTECTED]> Date: Mon, 13 Aug 2007 07:24:52 -0400 > From: Chris Snook <[EMAIL PROTECTED]> > > Use volatile consistently in atomic.h on m32r. > > Signed-off-by: Chris Snook <[EMAIL PROTECTED]> Thanks, Acked-by: Hirokazu Takata <[EMAIL PROTECTED]> - To unsubscribe from t