All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: xen-devel <xen-devel@lists.xenproject.org>,
	Kevin Tian <kevin.tian@intel.com>,
	Jun Nakajima <jun.nakajima@intel.com>
Subject: Re: [PATCH] x86: use gcc6'es flags asm() output support
Date: Fri, 1 Jul 2016 17:51:55 +0100	[thread overview]
Message-ID: <8b318af1-04d0-26f0-0f4c-bafb5b3fca2e@citrix.com> (raw)
In-Reply-To: <5776B20002000078000FA816@prv-mh.provo.novell.com>


[-- Attachment #1.1: Type: text/plain, Size: 1831 bytes --]

On 01/07/16 17:10, Jan Beulich wrote:
>>>> On 01.07.16 at 17:38, <andrew.cooper3@citrix.com> wrote:
>> As for interleaving inside the asm statement itself, we already have
>> precedent for that with the HAVE_GAS_* predicates.  It would make the
>> patch rather larger, but might end up looking cleaner.  It is probably
>> also worth switching to named parameters to reduce the risk of getting
>> positional parameters out of order.
> So taking just the first example I've converted: Do you think this
>
> static bool_t even_parity(uint8_t v)
> {
>     asm ( "test %1,%1"
> #ifdef __GCC_ASM_FLAG_OUTPUTS__
>           : "=@ccp" (v)
> #else
>           "; setp %0"
>           : "=qm" (v)
> #endif
>           : "q" (v) );
>
>     return v;
> }
>
> is better than the original?

How about a different example, from the second hunk

diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c
b/xen/arch/x86/x86_emulate/x86_emulate.c
index 460d1f7..8d52a41 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -832,8 +832,19 @@ static int read_ulong(
 static bool_t mul_dbl(unsigned long m[2])
 {
     bool_t rc;
-    asm ( "mul %1; seto %2"
-          : "+a" (m[0]), "+d" (m[1]), "=qm" (rc) );
+
+    asm ( "mul %1;"
+#ifndef __GCC_ASM_FLAG_OUTPUTS__
+          "seto %[rc];"
+#endif
+          : "+a" (m[0]), "+d" (m[1]),
+#ifdef __GCC_ASM_FLAG_OUTPUTS__
+            [rc] "=@cco" (rc)
+#else
+            [rc] "=qm" (rc)
+#endif
+        );
+
     return rc;
 }
 
This at least doesn't mix the : inside an #ifdef

> I'm unsure, and I'm actually inclined to
> think that then the abstraction alternative might look better.

If the abstraction comes in two parts, one which may insert a `setcc`
instruction, and one which selects between =qm and =@cc, it wouldn't end
up hiding the :.

~Andrew

[-- Attachment #1.2: Type: text/html, Size: 2879 bytes --]

[-- Attachment #2: Type: text/plain, Size: 126 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

  reply	other threads:[~2016-07-01 16:52 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-01 15:01 [PATCH] x86: use gcc6'es flags asm() output support Jan Beulich
2016-07-01 15:38 ` Andrew Cooper
2016-07-01 15:54   ` Jan Beulich
2016-07-01 16:10   ` Jan Beulich
2016-07-01 16:51     ` Andrew Cooper [this message]
2016-07-04  7:34       ` Jan Beulich
2016-08-01 16:06       ` Jan Beulich
2016-08-01 17:11         ` Andrew Cooper
2016-08-02  6:09           ` Jan Beulich
2016-08-02  9:15             ` Andrew Cooper
2016-08-02 10:39               ` Jan Beulich
2016-07-04  6:24 ` Tian, Kevin

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=8b318af1-04d0-26f0-0f4c-bafb5b3fca2e@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=jun.nakajima@intel.com \
    --cc=kevin.tian@intel.com \
    --cc=xen-devel@lists.xenproject.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.