https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68095

--- Comment #5 from David <gccbugzilla at limegreensocks dot com> ---
> the target code adds a cc clobber always.

Agreed.  On i386, there is no way to say that an extended asm doesn't clobber
"cc", so it only serves as a comment on that specific platform.

> There is no conflict.

I believe we may be talking about two different things.  From the point of view
of -da and -S, no conflicting code is generated.  The output is correct and
functions as expected.

But looking at the definition of a clobber:

- "values changed by the AssemblerTemplate, beyond those listed as outputs."
- "Clobber descriptions may not in any way overlap with an input or output
operand."

It's hard to reconcile those statements with this code (which the compiler
currently accepts):

    asm("bt $0, %1" : "@ccc" (vout) : "r" (vin) : "cc");

Looking at -da output, it looks like "cc" generates "clobber reg:CC", while @cc
generates "set reg:CC".  It makes no sense to ever generate both, which is what
this C statement implies.

I believe the correct way to write this (which the compiler also accepts and
generates identical code) is:

    asm("bt $0, %1" : "@ccc" (vout) : "r" (vin));

Silently ignoring the user's attempt to simultaneously use and clobber cc is a
logical guess about what the user really wants.  But I'm saying the compiler
should instead treat that the same way it treats simultaneously clobbering and
using other things.  For example:  asm volatile ("" : "=a"(a) :: "eax")
generates an "impossible constraints" error.

If I have not convinced you to generate an error for the simultaneously use,
can I at least write a doc patch for this to help clarify things for users? 
Something that points out that there is no way to disable "cc" for i386, and
provides a sample for using @cc?

Reply via email to