public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: <Paul_Koning@Dell.com>
To: <dw@LimeGreenSocks.com>
Cc: <gcc@gcc.gnu.org>
Subject: Re: basic asm and memory clobbers
Date: Tue, 24 Nov 2015 17:13:00 -0000	[thread overview]
Message-ID: <54275115-454B-4CCB-BEA8-752A14B24E62@dell.com> (raw)
In-Reply-To: <5653BFC5.5080305@LimeGreenSocks.com>


> On Nov 23, 2015, at 8:39 PM, David Wohlferd <dw@LimeGreenSocks.com> wrote:
> 
> On 11/23/2015 1:44 PM, Paul_Koning@Dell.com wrote:
>>> On Nov 23, 2015, at 4:36 PM, David Wohlferd <dw@LimeGreenSocks.com> wrote:
>>> 
>>> ...
>>>> The more I think about it, I'm just not keen on forcing all those old-style asms to change.
>>> If you mean you aren't keen to change them to "clobber all," I'm with you.  If you are worried about changing them from basic to extended, what kinds of problems do you foresee?  I've been reading a lot of basic asm lately, and it seems to me that most of it would be fine with a simple colon.  Certainly no worse than the current behavior.
>> I'm not sure.  I have some asm("sync") which I think assume that this means asm("sync"::"memory")
> 
> Another excellent reason to nudge people towards using extended asm.  If you saw asm("sync":::"memory"), you would *know* what it did, without having to read the docs (which don't say anyway).
> 
> I'm pretty confident that asm("") doesn't clobber memory on i386, but maybe that behavior is platform-specific.  Since i386 doesn't have "sync", I assume you are on something else?

Yes, MIPS.
> 
> If you have a chance to experiment, I'd love confirmation from other platforms that asm("blah") is the same as asm("blah":).  Feel free to email me off list to discuss.

I'm really concerned with loosening the meaning of basic asm.  I wish I could find the documentation that says, or implies, that it is a memory clobber.  And/or that it is implicitly volatile.

The problem is that it's clear from existing code that this assumption was made, and that defining it otherwise would break such code.  For example, the code I quoted clearly won't work if stores are moved across the asm("sync").

Given the ever improving optimizers, these things are time bombs -- code that worked for years might suddenly break when the compiler is upgraded.

If such breakage is to be done, it must at least come with a warning (which must default to ON).  But I'd prefer to see the more conservative approach (more clobbers) taken.

	paul

  parent reply	other threads:[~2015-11-24 17:13 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-09  0:10 David Wohlferd
2015-11-09  9:32 ` Segher Boessenkool
2015-11-16  1:23   ` David Wohlferd
2015-11-16 21:29     ` Jeff Law
2015-11-17  5:56       ` David Wohlferd
2015-11-17  9:27         ` Andrew Haley
2015-11-17 21:31         ` Jeff Law
2015-11-17 22:07           ` Andrew Pinski
2015-11-18 22:04             ` Jeff Law
2015-11-18  1:28           ` Segher Boessenkool
2015-11-18 22:08             ` Jeff Law
2015-11-20  1:24           ` David Wohlferd
2015-11-20  1:53             ` Sandra Loosemore
2015-11-22  5:09               ` David Wohlferd
2015-11-20  3:14             ` Segher Boessenkool
2015-11-20 10:45               ` David Wohlferd
2015-11-20 14:56                 ` Segher Boessenkool
2015-11-20 20:01                   ` Jeff Law
2015-11-20 22:07                     ` Paul_Koning
2015-11-20 10:17             ` Andrew Haley
2015-11-20 10:38               ` David Wohlferd
2015-11-20 11:14                 ` Andrew Haley
2015-11-20 12:38                   ` David Wohlferd
2015-11-20 13:05                     ` Richard Henderson
2015-11-20 15:20                       ` Segher Boessenkool
2015-11-20 15:30                         ` Richard Henderson
2015-11-20 15:34                           ` Jakub Jelinek
2015-11-20 16:14                             ` Richard Henderson
2015-11-20 23:56                               ` David Wohlferd
2015-11-21 12:57                                 ` David Wohlferd
2015-11-23  9:56                                   ` Joseph Myers
2015-11-23 10:04                                   ` Andrew Haley
2015-11-23 20:37                                     ` Jeff Law
2015-11-23 21:36                                       ` David Wohlferd
2015-11-23 21:44                                         ` Paul_Koning
2015-11-24  1:39                                           ` David Wohlferd
2015-11-24  2:22                                             ` Segher Boessenkool
2015-11-24  4:48                                               ` Jeff Law
2015-11-24  5:12                                                 ` Segher Boessenkool
2015-11-24  5:25                                                   ` Jeff Law
2015-11-24 17:13                                             ` Paul_Koning [this message]
2015-11-24 17:49                                               ` Ian Lance Taylor
2015-11-24 18:00                                                 ` Paul_Koning
2015-11-25  2:11                                               ` David Wohlferd
2015-11-25  9:09                                                 ` Andrew Haley
2015-11-23 21:03                                     ` David Wohlferd
2015-11-24  9:48                                       ` Andrew Haley
2015-11-20 16:21                           ` Segher Boessenkool
2015-11-27 17:45                           ` Segher Boessenkool
2015-11-20 18:24                       ` Jeff Law
2015-11-20 19:39                         ` Paul_Koning
2015-11-26 10:30                       ` Hans-Peter Nilsson
2015-11-26 12:35                         ` Segher Boessenkool
2015-11-26 16:26                           ` Hans-Peter Nilsson
2015-11-26 21:54                             ` David Wohlferd
2015-11-26 23:39                               ` Hans-Peter Nilsson
2015-11-27  1:04                                 ` David Wohlferd
2015-11-20 16:41                   ` Jeff Law

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=54275115-454B-4CCB-BEA8-752A14B24E62@dell.com \
    --to=paul_koning@dell.com \
    --cc=dw@LimeGreenSocks.com \
    --cc=gcc@gcc.gnu.org \
    /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).