Re: PATCH: Add pause intrinsic

2011-05-30 Thread Andrew Haley
On 05/26/2011 08:37 PM, Basile Starynkevitch wrote: > On Thu, 26 May 2011 13:48:13 -0400 > Paul Koning wrote: > >> Relax? Weird. "Pause" is just as weird. It might be an ia32 instruction, >> so as an ia32 builtin it is a reasonable name But if you want a generic >> builtin, you need a name

Re: PATCH: Add pause intrinsic

2011-05-26 Thread Basile Starynkevitch
On Thu, 26 May 2011 13:48:13 -0400 Paul Koning wrote: > Relax? Weird. "Pause" is just as weird. It might be an ia32 instruction, > so as an ia32 builtin it is a reasonable name But if you want a generic > builtin, you need a name that actually has some plausible connection with > what it d

Re: PATCH: Add pause intrinsic

2011-05-26 Thread Andi Kleen
> Relax? Weird. "Pause" is just as weird. It might be an ia32 instruction, > so as an ia32 builtin it is a reasonable name But if you want a generic > builtin, you need a name that actually has some plausible connection with > what it does, and neither "pause" nor "relax" do that. It's a sh

Re: PATCH: Add pause intrinsic

2011-05-26 Thread Paul Koning
On May 26, 2011, at 1:37 PM, Andi Kleen wrote: > On Thu, May 26, 2011 at 06:46:39PM +0200, Jakub Jelinek wrote: >> On Thu, May 26, 2011 at 09:10:32AM -0700, Andi Kleen wrote: >>> Richard Guenther writes: >>> As for why having a builtin: one reason would be portability. >> >> You mean portabilit

Re: PATCH: Add pause intrinsic

2011-05-26 Thread Andi Kleen
On Thu, May 26, 2011 at 06:46:39PM +0200, Jakub Jelinek wrote: > On Thu, May 26, 2011 at 09:10:32AM -0700, Andi Kleen wrote: > > Richard Guenther writes: > > As for why having a builtin: one reason would be portability. > > You mean portability to other compilers (I think reasonable amount > of t

Re: PATCH: Add pause intrinsic

2011-05-26 Thread Basile Starynkevitch
On Thu, 26 May 2011 09:12:06 -0700 Andi Kleen wrote: > Basile Starynkevitch writes: > > > > Perhaps the doc might explain why is it necessary to have a builtin for > > two independent roles: first, the full compiler memory barrier (which > > probably means to spill all the registers on the stack

Re: PATCH: Add pause intrinsic

2011-05-26 Thread Jakub Jelinek
On Thu, May 26, 2011 at 09:10:32AM -0700, Andi Kleen wrote: > Richard Guenther writes: > As for why having a builtin: one reason would be portability. You mean portability to other compilers (I think reasonable amount of them support gcc-ish inline asm), or to other architectures? __builtin_ia32_

Re: PATCH: Add pause intrinsic

2011-05-26 Thread Andi Kleen
Basile Starynkevitch writes: > > Perhaps the doc might explain why is it necessary to have a builtin for > two independent roles: first, the full compiler memory barrier (which > probably means to spill all the registers on the stack - definitely a > task for a compiler); second, to "pause" the pr

Re: PATCH: Add pause intrinsic

2011-05-26 Thread Andi Kleen
Richard Guenther writes: > > To make it a compiler memory barrier you have to "expand" the > builtin already in the frontend and present the middle-end with > __asm__ ("" : : : "memory"). That will serve as a compiler Those are the intended semantics (at least those I asked for :-). For all

Re: PATCH: Add pause intrinsic

2011-05-26 Thread Michael Matz
Hi, On Thu, 26 May 2011, Andrew Haley wrote: > >>> +Generates the @code{pause} machine instruction. > >> > >> But that's missing the fact that it generates a compiler memory > >> barrier, which is important. And if you think it's not a compiler > >> memory barrier, please explain > >> > >> a.

Re: PATCH: Add pause intrinsic

2011-05-26 Thread Andrew Haley
On 05/26/2011 03:29 PM, Richard Guenther wrote: > On Thu, May 26, 2011 at 3:53 PM, Andrew Haley wrote: >> On 05/26/2011 02:51 PM, Richard Guenther wrote: >>> On Thu, May 26, 2011 at 3:30 PM, Andrew Haley wrote: On 05/26/2011 10:34 AM, Richard Guenther wrote: >> Index: doc/extend.tex

Re: PATCH: Add pause intrinsic

2011-05-26 Thread Richard Guenther
On Thu, May 26, 2011 at 4:34 PM, Jakub Jelinek wrote: > On Thu, May 26, 2011 at 04:29:50PM +0200, Richard Guenther wrote: >> To make it a compiler memory barrier you have to "expand" the >> builtin already in the frontend and present the middle-end with >> __asm__ ("" : : : "memory").  That wi

Re: PATCH: Add pause intrinsic

2011-05-26 Thread Jakub Jelinek
On Thu, May 26, 2011 at 04:29:50PM +0200, Richard Guenther wrote: > To make it a compiler memory barrier you have to "expand" the > builtin already in the frontend and present the middle-end with > __asm__ ("" : : : "memory"). That will serve as a compiler > memory barrier also covering local

Re: PATCH: Add pause intrinsic

2011-05-26 Thread Richard Guenther
On Thu, May 26, 2011 at 3:53 PM, Andrew Haley wrote: > On 05/26/2011 02:51 PM, Richard Guenther wrote: >> On Thu, May 26, 2011 at 3:30 PM, Andrew Haley wrote: >>> On 05/26/2011 10:34 AM, Richard Guenther wrote: >>> > Index: doc/extend.texi > ===

Re: PATCH: Add pause intrinsic

2011-05-26 Thread Andrew Haley
On 05/26/2011 02:51 PM, Richard Guenther wrote: > On Thu, May 26, 2011 at 3:30 PM, Andrew Haley wrote: >> On 05/26/2011 10:34 AM, Richard Guenther wrote: >> Index: doc/extend.texi === --- doc/extend.texi (revision 1

Re: PATCH: Add pause intrinsic

2011-05-26 Thread Richard Guenther
On Thu, May 26, 2011 at 3:30 PM, Andrew Haley wrote: > On 05/26/2011 10:34 AM, Richard Guenther wrote: > >>> Index: doc/extend.texi >>> === >>> --- doc/extend.texi     (revision 174216) >>> +++ doc/extend.texi     (working copy) >>> @

Re: PATCH: Add pause intrinsic

2011-05-26 Thread Andrew Haley
On 05/26/2011 10:34 AM, Richard Guenther wrote: >> Index: doc/extend.texi >> === >> --- doc/extend.texi (revision 174216) >> +++ doc/extend.texi (working copy) >> @@ -8699,7 +8699,8 @@ The following built-in function is alway

Re: PATCH: Add pause intrinsic

2011-05-26 Thread Richard Guenther
On Wed, May 25, 2011 at 7:19 PM, H.J. Lu wrote: > On Wed, May 25, 2011 at 9:43 AM, Andrew Haley wrote: >> On 05/25/2011 04:32 PM, H.J. Lu wrote: >>> On Wed, May 25, 2011 at 8:27 AM, Richard Guenther >>> wrote: On Wed, May 25, 2011 at 5:20 PM, Michael Matz wrote: > Hi, > > On We

Re: PATCH: Add pause intrinsic

2011-05-26 Thread Andrew Haley
On 25/05/11 20:17, Basile Starynkevitch wrote: > On Wed, 25 May 2011 11:26:51 +0100 > Andrew Haley wrote: > >> On 05/24/2011 07:28 PM, H.J. Lu wrote: >> >>> This patch implements pause intrinsic suggested by Andi. OK >>> for trunk? >> >> What does "full memory barrier" here mean? >> >> +@table @

Re: PATCH: Add pause intrinsic

2011-05-25 Thread Basile Starynkevitch
On Wed, 25 May 2011 12:31:17 -0700 "H.J. Lu" wrote: > On Wed, May 25, 2011 at 12:17 PM, Basile Starynkevitch > wrote: > > Perhaps the doc might explain why is it necessary to have a builtin for > > two independent roles: first, the full compiler memory barrier (which > > probably means to spill

Re: PATCH: Add pause intrinsic

2011-05-25 Thread H.J. Lu
On Wed, May 25, 2011 at 12:17 PM, Basile Starynkevitch wrote: > On Wed, 25 May 2011 11:26:51 +0100 > Andrew Haley wrote: > >> On 05/24/2011 07:28 PM, H.J. Lu wrote: >> >> > This patch implements pause intrinsic suggested by Andi.  OK >> > for trunk? >> >> What does "full memory barrier" here mean

Re: PATCH: Add pause intrinsic

2011-05-25 Thread Basile Starynkevitch
On Wed, 25 May 2011 11:26:51 +0100 Andrew Haley wrote: > On 05/24/2011 07:28 PM, H.J. Lu wrote: > > > This patch implements pause intrinsic suggested by Andi. OK > > for trunk? > > What does "full memory barrier" here mean? > > +@table @code > +@item void __builtin_ia32_pause (void) > +Genera

Re: PATCH: Add pause intrinsic

2011-05-25 Thread Andrew Haley
On 05/25/2011 06:26 PM, Andrew Pinski wrote: > On Wed, May 25, 2011 at 10:19 AM, H.J. Lu wrote: >> -- >> H.J. >> --- >> Index: doc/extend.texi >> === >> --- doc/extend.texi (revision 174216) >> +++ doc/extend.texi (working cop

Re: PATCH: Add pause intrinsic

2011-05-25 Thread Andrew Pinski
On Wed, May 25, 2011 at 10:19 AM, H.J. Lu wrote: > -- > H.J. > --- > Index: doc/extend.texi > === > --- doc/extend.texi     (revision 174216) > +++ doc/extend.texi     (working copy) > @@ -8699,7 +8699,8 @@ The following built-in func

Re: PATCH: Add pause intrinsic

2011-05-25 Thread H.J. Lu
On Wed, May 25, 2011 at 9:43 AM, Andrew Haley wrote: > On 05/25/2011 04:32 PM, H.J. Lu wrote: >> On Wed, May 25, 2011 at 8:27 AM, Richard Guenther >> wrote: >>> On Wed, May 25, 2011 at 5:20 PM, Michael Matz wrote: Hi, On Wed, 25 May 2011, Richard Guenther wrote: >>> asm v

Re: PATCH: Add pause intrinsic

2011-05-25 Thread Andrew Haley
On 05/25/2011 04:32 PM, H.J. Lu wrote: > On Wed, May 25, 2011 at 8:27 AM, Richard Guenther > wrote: >> On Wed, May 25, 2011 at 5:20 PM, Michael Matz wrote: >>> Hi, >>> >>> On Wed, 25 May 2011, Richard Guenther wrote: >>> >> asm volatile ("" : : : "memory") in fact will work as a full memory >

Re: PATCH: Add pause intrinsic

2011-05-25 Thread H.J. Lu
On Wed, May 25, 2011 at 8:27 AM, Richard Guenther wrote: > On Wed, May 25, 2011 at 5:20 PM, Michael Matz wrote: >> Hi, >> >> On Wed, 25 May 2011, Richard Guenther wrote: >> >>> >> asm volatile ("" : : : "memory") in fact will work as a full memory >>> >> barrier >>> > >>> > How?  You surely need

Re: PATCH: Add pause intrinsic

2011-05-25 Thread Richard Guenther
On Wed, May 25, 2011 at 5:20 PM, Michael Matz wrote: > Hi, > > On Wed, 25 May 2011, Richard Guenther wrote: > >> >> asm volatile ("" : : : "memory") in fact will work as a full memory >> >> barrier >> > >> > How?  You surely need MFENCE or somesuch, unless all you care about is >> > a compiler bar

Re: PATCH: Add pause intrinsic

2011-05-25 Thread Michael Matz
Hi, On Wed, 25 May 2011, Richard Guenther wrote: > >> asm volatile ("" : : : "memory") in fact will work as a full memory > >> barrier > > > > How?  You surely need MFENCE or somesuch, unless all you care about is > > a compiler barrier.  That's what I think needs to be clarified. > > Well, ye

Re: PATCH: Add pause intrinsic

2011-05-25 Thread Richard Guenther
On Wed, May 25, 2011 at 5:09 PM, Andrew Haley wrote: > On 05/25/2011 03:57 PM, Richard Guenther wrote: >> >> asm volatile ("" : : : "memory") in fact will work as a full memory barrier > > How?  You surely need MFENCE or somesuch, unless all you > care about is a compiler barrier.  That's what I t

Re: PATCH: Add pause intrinsic

2011-05-25 Thread Andrew Haley
On 05/25/2011 03:57 PM, Richard Guenther wrote: > > asm volatile ("" : : : "memory") in fact will work as a full memory barrier How? You surely need MFENCE or somesuch, unless all you care about is a compiler barrier. That's what I think needs to be clarified. Andrew.

Re: PATCH: Add pause intrinsic

2011-05-25 Thread Richard Guenther
On Wed, May 25, 2011 at 4:54 PM, Andrew Haley wrote: > On 05/25/2011 03:47 PM, H.J. Lu wrote: >> On Wed, May 25, 2011 at 7:36 AM, Andrew Haley wrote: >>> On 05/25/2011 01:34 PM, H.J. Lu wrote: On Wed, May 25, 2011 at 3:26 AM, Andrew Haley wrote: > On 05/24/2011 07:28 PM, H.J. Lu wrote:

Re: PATCH: Add pause intrinsic

2011-05-25 Thread Andrew Haley
On 05/25/2011 03:47 PM, H.J. Lu wrote: > On Wed, May 25, 2011 at 7:36 AM, Andrew Haley wrote: >> On 05/25/2011 01:34 PM, H.J. Lu wrote: >>> On Wed, May 25, 2011 at 3:26 AM, Andrew Haley wrote: On 05/24/2011 07:28 PM, H.J. Lu wrote: > This patch implements pause intrinsic suggested b

Re: PATCH: Add pause intrinsic

2011-05-25 Thread Richard Guenther
On Wed, May 25, 2011 at 4:47 PM, H.J. Lu wrote: > On Wed, May 25, 2011 at 7:36 AM, Andrew Haley wrote: >> On 05/25/2011 01:34 PM, H.J. Lu wrote: >>> On Wed, May 25, 2011 at 3:26 AM, Andrew Haley wrote: On 05/24/2011 07:28 PM, H.J. Lu wrote: > This patch implements pause intrinsic s

Re: PATCH: Add pause intrinsic

2011-05-25 Thread H.J. Lu
On Wed, May 25, 2011 at 7:36 AM, Andrew Haley wrote: > On 05/25/2011 01:34 PM, H.J. Lu wrote: >> On Wed, May 25, 2011 at 3:26 AM, Andrew Haley wrote: >>> On 05/24/2011 07:28 PM, H.J. Lu wrote: >>> This patch implements pause intrinsic suggested by Andi.  OK for trunk? >>> >>> What does

Re: PATCH: Add pause intrinsic

2011-05-25 Thread Andrew Haley
On 05/25/2011 01:34 PM, H.J. Lu wrote: > On Wed, May 25, 2011 at 3:26 AM, Andrew Haley wrote: >> On 05/24/2011 07:28 PM, H.J. Lu wrote: >> >>> This patch implements pause intrinsic suggested by Andi. OK >>> for trunk? >> >> What does "full memory barrier" here mean? >> >> +@table @code >> +@item

Re: PATCH: Add pause intrinsic

2011-05-25 Thread Uros Bizjak
On Tue, May 24, 2011 at 8:28 PM, H.J. Lu wrote: > This patch implements pause intrinsic suggested by Andi.  OK > for trunk? > gcc/ > > 2011-05-24  H.J. Lu   > >        * config/i386/i386.c (ix86_builtins): Add IX86_BUILTIN_PAUSE. >        (bdesc_special_args): Add pause intrinsic. > >        * c

Re: PATCH: Add pause intrinsic

2011-05-25 Thread H.J. Lu
On Wed, May 25, 2011 at 3:31 AM, Richard Guenther wrote: > On Wed, May 25, 2011 at 12:26 PM, Andrew Haley wrote: >> On 05/24/2011 07:28 PM, H.J. Lu wrote: >> >>> This patch implements pause intrinsic suggested by Andi.  OK >>> for trunk? >> >> What does "full memory barrier" here mean? >> >> +@ta

Re: PATCH: Add pause intrinsic

2011-05-25 Thread H.J. Lu
On Wed, May 25, 2011 at 3:26 AM, Andrew Haley wrote: > On 05/24/2011 07:28 PM, H.J. Lu wrote: > >> This patch implements pause intrinsic suggested by Andi.  OK >> for trunk? > > What does "full memory barrier" here mean? > > +@table @code > +@item void __builtin_ia32_pause (void) > +Generates the

Re: PATCH: Add pause intrinsic

2011-05-25 Thread Richard Guenther
On Wed, May 25, 2011 at 12:26 PM, Andrew Haley wrote: > On 05/24/2011 07:28 PM, H.J. Lu wrote: > >> This patch implements pause intrinsic suggested by Andi.  OK >> for trunk? > > What does "full memory barrier" here mean? > > +@table @code > +@item void __builtin_ia32_pause (void) > +Generates the

Re: PATCH: Add pause intrinsic

2011-05-25 Thread Andrew Haley
On 05/24/2011 07:28 PM, H.J. Lu wrote: > This patch implements pause intrinsic suggested by Andi. OK > for trunk? What does "full memory barrier" here mean? +@table @code +@item void __builtin_ia32_pause (void) +Generates the @code{pause} machine instruction with full memory barrier. +@end tabl

PATCH: Add pause intrinsic

2011-05-24 Thread H.J. Lu
Hi, This patch implements pause intrinsic suggested by Andi. OK for trunk? Thanks. -- H.J. --- gcc/ 2011-05-24 H.J. Lu * config/i386/i386.c (ix86_builtins): Add IX86_BUILTIN_PAUSE. (bdesc_special_args): Add pause intrinsic. * config/i386/i386.md (UNSPEC_PAUSE): N