This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [DOC Patch] Add sample for @cc constraint


Ping? (link to original post: https://gcc.gnu.org/ml/gcc-patches/2016-03/msg00743.html )

This patch adds a sample for a new-to-v6 feature. Is this not the right time for doc improvements?

I considered adding some assembler output.  Something like:

------------------------
Before this feature, you had to write code like this:

   asm("bt $0, %1 ; setc %0" : "=q" (a) : "r" (value) : "cc");
   if (a)

This would generate code like this:

        bt $0, %ebx
        setc %al <--------- Convert flags to byte
        testb   %al, %al <------ Convert byte back to flags
        jne     .L5

Using @cc, this code

   asm("bt $0, %1" : "=@ccc" (a) : "r" (value) );
   if (a)

produces this output:

        bt $0, %ebx
        jc      .L5 <--------- Use the flags directly
----------------

While this helps show the benefit of the feature, it just seemed like too much detail. Showing people the c code and reminding them to enable optimizations (what the current patch does) seems like it should be sufficient.

dw

On 3/12/2016 8:00 PM, David Wohlferd wrote:
The docs for the new(-ish) @cc constraint need an example. Attached.

ChangeLog:

2016-03-12  David Wohlferd  <dw@LimeGreenSocks.com>

    * doc/extend.texi: Add sample for @cc constraint

Note that while I have a release on file with FSF, I don't have write access to SVN.

dw


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]