From: David Wohlferd <dw@LimeGreenSocks.com>
To: Bernd Schmidt <bschmidt@redhat.com>
Cc: "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>,
Richard Henderson <rth@redhat.com>,
Sandra Loosemore <sandra@codesourcery.com>,
David Wohlferd <dw@LimeGreenSocks.com>
Subject: Re: [DOC Patch] Add sample for @cc constraint
Date: Tue, 26 Apr 2016 00:16:00 -0000 [thread overview]
Message-ID: <245ed05c-e585-e8e8-c177-a548d7e19921@LimeGreenSocks.com> (raw)
In-Reply-To: <571DE898.4020905@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 625 bytes --]
On 4/25/2016 2:51 AM, Bernd Schmidt wrote:
> On 04/16/2016 01:12 AM, David Wohlferd wrote:
>> There were basically 3 changes I was trying for in that doc patch. Are
>> any of them worth keeping? Or are we done?
>>
>> 1) "Do not clobber flags if they are being used as outputs."
>> 2) Output flags sample (with #if removed).
>> 3) "On the x86 platform, flags are always treated as clobbered by
>> extended asm whether @code{"cc"} is specified or not."
>>
>> I'm prepared to send an updated patch if there's anything here that
>> might get approved.
>
> I think the updated flags sample would be nice to have.
Attached.
dw
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: ccB.patch --]
[-- Type: text/x-patch; name="ccB.patch", Size: 734 bytes --]
Index: extend.texi
===================================================================
--- extend.texi (revision 235054)
+++ extend.texi (working copy)
@@ -8135,6 +8135,26 @@
``not'' @var{flag}, or inverted versions of those above
@end table
+This example uses the @code{bt} instruction (which sets the carry flag) to
+see if bit 0 of an integer is set. To see the improvement in the generated
+output, make sure optimizations are enabled.
+
+@example
+void TestEven (int value)
+@{
+ char CarryIsSet;
+
+ asm ("bt $0, %[value]"
+ : "=@@ccc" (CarryIsSet)
+ : [value] "rm" (value));
+
+ if (CarryIsSet)
+ printf ("odd\n");
+ else
+ printf ("even\n");
+@}
+@end example
+
@end table
@anchor{InputOperands}
prev parent reply other threads:[~2016-04-26 0:16 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-13 4:01 David Wohlferd
2016-03-23 7:02 ` David Wohlferd
2016-03-24 15:21 ` Bernd Schmidt
2016-03-24 17:59 ` Sandra Loosemore
2016-03-27 22:34 ` David Wohlferd
2016-03-29 12:10 ` Bernd Schmidt
2016-04-01 23:39 ` David Wohlferd
2016-04-11 22:49 ` David Wohlferd
2016-04-12 13:06 ` Bernd Schmidt
2016-04-15 23:13 ` David Wohlferd
2016-04-25 9:51 ` Bernd Schmidt
2016-04-26 0:16 ` David Wohlferd [this message]
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=245ed05c-e585-e8e8-c177-a548d7e19921@LimeGreenSocks.com \
--to=dw@limegreensocks.com \
--cc=bschmidt@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=rth@redhat.com \
--cc=sandra@codesourcery.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).