public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Marc Glisse <marc.glisse@inria.fr>
To: Segher Boessenkool <segher@kernel.crashing.org>
Cc: gcc-patches@gcc.gnu.org, jakub@redhat.com,
	    Joseph Myers <joseph@codesourcery.com>,
	jason@redhat.com, nathan@acm.org,     polacek@redhat.com
Subject: Re: [PATCH 2/2] asm inline
Date: Sun, 02 Dec 2018 17:23:00 -0000	[thread overview]
Message-ID: <alpine.DEB.2.21.1812021807100.14305@stedding.saclay.inria.fr> (raw)
In-Reply-To: <afb52e086d68be11d17ef2f749d9754bfc4d6ff9.1543766396.git.segher@kernel.crashing.org>

On Sun, 2 Dec 2018, Segher Boessenkool wrote:

> 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;
> 	return MAX (1, count);
>       }

Hello,

what is the point of !!count when we take the max with 1 on the very
next line? Is it in prevision of a time when we may remove the MAX? (sorry 
if this was covered in previous iterations)

By the way, not related to the patch, but I wonder why we cannot have a
cost of 0. My main use of inline asm is as an optimization barrier:
asm("":"+gx"(local_var))
possibly marked volatile to prevent more optimizations. I certainly
expect it to generate exactly 0 instruction in most cases. Although if I 
am not careful it could easily generate moves from x87 to sse/memory for 
instance. I guess a minimal cost is safer and doesn't affect decisions too 
badly.

-- 
Marc Glisse

  reply	other threads:[~2018-12-02 17:23 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 [this message]
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
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=alpine.DEB.2.21.1812021807100.14305@stedding.saclay.inria.fr \
    --to=marc.glisse@inria.fr \
    --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=segher@kernel.crashing.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).