This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [DOC Patch] Add sample for @cc constraint
- From: Bernd Schmidt <bschmidt at redhat dot com>
- To: David Wohlferd <dw at LimeGreenSocks dot com>, "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Cc: Richard Henderson <rth at redhat dot com>, Sandra Loosemore <sandra at codesourcery dot com>
- Date: Thu, 24 Mar 2016 16:00:19 +0100
- Subject: Re: [DOC Patch] Add sample for @cc constraint
- Authentication-results: sourceware.org; auth=none
- References: <56E4E5D6 dot 4030500 at LimeGreenSocks dot com>
In principle we probably should have an example, but once again I have
some problems with the style of the added documentation. I prefer
concise writing without unnecessary repetition. Any other reviewers can
of course override me, but the following is my opinion on these changes.
More problematic than a lack of documentation is that I haven't been
able to find an executable testcase. If you could adapt your example for
use in gcc.target/i386, that would be even more important.
On 03/13/2016 05:00 AM, David Wohlferd wrote:
Index: extend.texi
===================================================================
--- extend.texi (revision 234163)
+++ extend.texi (working copy)
@@ -8047,6 +8047,7 @@
Because of the special nature of the flag output operands, the constraint
may not include alternatives.
+Do not clobber flags if they are being used as outputs.
I don't think the manual should point out the obvious. I'd be surprised
if this wasn't documented or at least strongly implied elsewhere for
normal operands.
+For builds that don't support flag output operands,
This feels strange, we should just be documenting the capabilities of
this feature. Other parts of the docs already show what to do without
it. Hence, reduce the example to this (plus the surrounding setup stuff):
+/* Avoid the redundant setc/testb and use the carry flag directly. */
+asm ("bt $0, %1"
+ : "=@@ccc" (a)
+ : "r" (b));
+
+#endif
+Note: On the x86 platform, flags are normally considered clobbered by
+extended asm whether the @code{"cc"} clobber is specified or not.
Is it really necessary or helpful to mention that here? Not only is it
not strictly correct (an output operand is not also considered
clobbered), but to me it breaks the flow because you're left wondering
how that sentence relates to the example (it doesn't).
@anchor{InputOperands}
@@ -8260,6 +8298,8 @@
On other machines, condition code handling is different,
and specifying @code{"cc"} has no effect. But
it is valid no matter what the target.
+For platform-specific uses of flags, see also
+@ref{FlagOutputOperands,Flag Output Operands}.
Is this likely to be helpful? Someone who's looking at how to use flag
outputs probably isn't looking in the "Clobbers" section?
Bernd