public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Segher Boessenkool <segher@kernel.crashing.org>
To: gcc-patches@gcc.gnu.org, jakub@redhat.com,
	       Joseph Myers <joseph@codesourcery.com>,
	jason@redhat.com,        nathan@acm.org, polacek@redhat.com,
	richard.sandiford@arm.com
Subject: Re: [PATCH 2/2] asm inline
Date: Thu, 06 Dec 2018 03:03:00 -0000	[thread overview]
Message-ID: <20181205233201.GW3803@gate.crashing.org> (raw)
In-Reply-To: <87a7ll8g2g.fsf@arm.com>

Hi!

On Tue, Dec 04, 2018 at 03:30:47PM +0000, Richard Sandiford wrote:
> Segher Boessenkool <segher@kernel.crashing.org> writes:

> Hmm, so we allow top-level "asm volatile" in C++ but not C?

Apparently.  Evert top-level asm is effectively volatile, so this doesn't
really matter; but should we try to resolve the difference?

> Probably worth having tests to show that we (intentionally) don't
> allow top-level "asm inline".

Okay, I'll do this separately.

> > --- a/gcc/doc/extend.texi
> > +++ b/gcc/doc/extend.texi
> > @@ -8382,6 +8382,10 @@ various @option{-std} options, use @code{__asm__} instead of
> >  @item volatile
> >  The optional @code{volatile} qualifier has no effect. 
> >  All basic @code{asm} blocks are implicitly volatile.
> > +
> > +@item inline
> > +If you use the @code{inline} qualifier, then for inlining purposes the size
> > +of the asm is taken as the smallest size possible (@pxref{Size of an asm}).
> >  @end table
> >  
> >  @subsubheading Parameters
> 
> You need to update the syntax above too, which currently reads:
> 
> @example
> asm @r{[} volatile @r{]} ( @var{AssemblerInstructions} )
> @end example

That was modified in patch 1?

@example
asm @var{asm-qualifiers} ( @var{AssemblerInstructions} )
@end example

> > +/* Return true ASM_STMT ASM_STMT is an asm statement marked inline.  */
> > +
> > +static inline bool
> > +gimple_asm_inline_p (const gasm *asm_stmt)
> > +{
> > +  return (asm_stmt->subcode & GF_ASM_INLINE) != 0;
> > +}
> 
> Return true if ASM_STMT is ...

Heh, I copied this from the "volatile" one above.  I'll fix that one, too.

> (Or "Return true if asm statement ASM_STMT is marked inline", since gasm
> forces it to be an asm statement.)

Yup, same deal.

> > diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
> > index 5aa782b..7e9ed99 100644
> > --- a/gcc/tree-inline.c
> > +++ b/gcc/tree-inline.c
> > @@ -4109,6 +4109,9 @@ estimate_num_insns (gimple *stmt, eni_weights *weights)
> >  	   with very long asm statements.  */
> >  	if (count > 1000)
> >  	  count = 1000;
> > +	/* If this asm is asm inline, count anything as minimum size.  */
> > +	if (gimple_asm_inline_p (as_a <gasm *> (stmt)))
> > +	  count = !!count;
> 
> FWIW, since Marc found it confusing too... I think MIN (count, 1) would
> show the intent more clearerly.  But that's just personal preference,
> no need to change.

MIN is a nice way to say it, thanks!  Better than "!!" or "!= 0" here.

Thanks for the review, I'm committing it with the changes above (later
today, after a final bootstrap),


Segher

  reply	other threads:[~2018-12-06  3:03 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-02 16:38 [PATCH v2 0/2] asm qualifiers (PR55681) and " Segher Boessenkool
2018-12-02 16:39 ` [PATCH 1/2] asm qualifiers (PR55681) Segher Boessenkool
2018-12-03 22:20   ` Joseph Myers
2018-12-05 21:47   ` Jason Merrill
2018-12-05 23:02     ` Segher Boessenkool
2018-12-02 16:40 ` [PATCH 2/2] asm inline Segher Boessenkool
2018-12-02 17:23   ` Marc Glisse
2018-12-02 17:45     ` Segher Boessenkool
2018-12-02 18:38       ` Marc Glisse
2018-12-04 15:31   ` Richard Sandiford
2018-12-06  3:03     ` Segher Boessenkool [this message]
2018-12-06 18:11 ` [PATCH v2 0/2] asm qualifiers (PR55681) and " Segher Boessenkool
2018-12-06 18:15   ` Jakub Jelinek
2018-12-06 18:19     ` Joseph Myers
2018-12-06 18:54     ` Segher Boessenkool
  -- strict thread matches above, loose matches on Subject: below --
2018-10-30 18:01 [PATCH 0/2] asm qualifiers (PR55681) and asm input Segher Boessenkool
2018-10-30 18:41 ` [PATCH 2/2] asm inline Segher Boessenkool
2018-10-30 18:58   ` Marek Polacek
2018-11-11 21:33   ` Martin Sebor
2018-11-11 22:01     ` Segher Boessenkool
2018-11-11 23:41       ` Martin Sebor
2018-11-12  0:19         ` Segher Boessenkool
2018-11-30 13:14   ` Richard Biener

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=20181205233201.GW3803@gate.crashing.org \
    --to=segher@kernel.crashing.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=jason@redhat.com \
    --cc=joseph@codesourcery.com \
    --cc=nathan@acm.org \
    --cc=polacek@redhat.com \
    --cc=richard.sandiford@arm.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).