public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Michael Matz <matz@suse.de>
To: Andrew Haley <aph@redhat.com>
Cc: Richard Guenther <richard.guenther@gmail.com>,
	"H.J. Lu" <hjl.tools@gmail.com>,
	gcc-patches@gcc.gnu.org
Subject: Re: PATCH: Add pause intrinsic
Date: Thu, 26 May 2011 15:58:00 -0000	[thread overview]
Message-ID: <Pine.LNX.4.64.1105261642360.9668@wotan.suse.de> (raw)
In-Reply-To: <4DDE65FF.8010105@redhat.com>

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.  Why it's not a compiler memory barrier,
> > 
> > It is not a compiler memory barrier because it is a builtin function call
> > which is never assumed to be a barrier for local automatic storage
> > that does not have its address taken.
> 
> OK.  How would you tell the difference between the kind of barrier
> that it is and a real compiler memory barrier?

First we have to determine if this builtin really does what its users 
intend to use it for.  I believe they _do_ want to use it also with 
regards to auto variables (it includes also address-takens whose address 
doesn't escape).  A normal builtin call is not a barrier for operations on 
such entities, hence it might very well be that the implementation of HJ 
actually doesn't what he wanted.

I don't have a good word for what functions calls are in their barrierness 
part of pre/post conditions.  "global memory movement barrier" perhaps, 
with an appropriate definition of global memory (which funnily include 
address-taken escaped local storage, ugh).

> > 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 non-address taken storage
> > (global and practically most of address-taken local storage
> > is covered by a builtin function call already).
> 
> Well, the fact that it's also a memory clobber has to be documented
> somehow.  If the present documentation is to be changed, it should
> not be changed by deleting a vital piece of information.

It's not only about the docu.  As implemented right now it's neither an 
optimization barrier nor a memory clobber.


Ciao,
Michael.

  reply	other threads:[~2011-05-26 14:47 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-24 19:35 H.J. Lu
2011-05-25 12:36 ` Andrew Haley
2011-05-25 13:20   ` Richard Guenther
2011-05-25 13:45     ` H.J. Lu
2011-05-25 13:40   ` H.J. Lu
2011-05-25 14:51     ` Andrew Haley
2011-05-25 15:19       ` H.J. Lu
2011-05-25 15:31         ` Andrew Haley
2011-05-25 15:32           ` Richard Guenther
2011-05-25 16:05             ` Andrew Haley
2011-05-25 16:16               ` Richard Guenther
2011-05-25 16:32                 ` Michael Matz
2011-05-25 16:39                   ` Richard Guenther
2011-05-25 16:53                     ` H.J. Lu
2011-05-25 17:30                       ` Andrew Haley
2011-05-25 17:56                         ` H.J. Lu
2011-05-25 18:09                           ` Andrew Pinski
2011-05-25 18:16                             ` Andrew Haley
2011-05-26 10:49                           ` Richard Guenther
2011-05-26 13:51                             ` Andrew Haley
2011-05-26 14:39                               ` Richard Guenther
2011-05-26 14:45                                 ` Andrew Haley
2011-05-26 15:19                                   ` Richard Guenther
2011-05-26 15:37                                     ` Jakub Jelinek
2011-05-26 15:42                                       ` Richard Guenther
2011-05-26 15:43                                     ` Andrew Haley
2011-05-26 15:58                                       ` Michael Matz [this message]
2011-05-26 17:36                                     ` Andi Kleen
2011-05-26 17:40                                       ` Jakub Jelinek
2011-05-26 18:23                                         ` Andi Kleen
2011-05-26 18:37                                           ` Paul Koning
2011-05-26 19:05                                             ` Andi Kleen
2011-05-26 21:56                                             ` Basile Starynkevitch
2011-05-30 10:39                                               ` Andrew Haley
2011-05-25 15:31         ` Richard Guenther
2011-05-25 19:53   ` Basile Starynkevitch
2011-05-25 20:03     ` H.J. Lu
2011-05-25 21:10       ` Basile Starynkevitch
2011-05-26  9:35     ` Andrew Haley
2011-05-26 17:37     ` Andi Kleen
2011-05-26 17:48       ` Basile Starynkevitch
2011-05-25 14:08 ` Uros Bizjak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.64.1105261642360.9668@wotan.suse.de \
    --to=matz@suse.de \
    --cc=aph@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=hjl.tools@gmail.com \
    --cc=richard.guenther@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).