public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug inline-asm/68095] New: "cc" clobber with Flag Output Operands
@ 2015-10-26  4:39 gccbugzilla at limegreensocks dot com
  2015-10-27  2:07 ` [Bug inline-asm/68095] " gccbugzilla at limegreensocks dot com
  2015-10-28  4:57 ` segher at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: gccbugzilla at limegreensocks dot com @ 2015-10-26  4:39 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 68095
           Summary: "cc" clobber with Flag Output Operands
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: inline-asm
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gccbugzilla at limegreensocks dot com
  Target Milestone: ---

Normally when trying to use a register and clobber it at the same time, the
compiler kicks out an error (operand has impossible constraints).  However that
doesn't happen when using Flag Output Operands and the "cc" clobber:

  asm ("cmp %2, %1" : "=@ccc"(r) : "m"(*p), "ri"(2): "cc");

Should this be a conflict?

On the other hand, the asm is changing the flags.  So is the "cc" *required*? 
But it doesn't seem to be:

  asm ("cmp %2, %1" : "=@ccc"(r) : "m"(*p), "ri"(2));

Now that asm flags are a real thing, we should pick one and enforce it.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug inline-asm/68095] "cc" clobber with Flag Output Operands
  2015-10-26  4:39 [Bug inline-asm/68095] New: "cc" clobber with Flag Output Operands gccbugzilla at limegreensocks dot com
@ 2015-10-27  2:07 ` gccbugzilla at limegreensocks dot com
  2015-10-28  4:57 ` segher at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: gccbugzilla at limegreensocks dot com @ 2015-10-27  2:07 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from David <gccbugzilla at limegreensocks dot com> ---
On further reflection, perhaps the best solution is even simpler.

It is my understanding that the "cc" clobber is redundant.  Internally, the
flags are clobbered whether you set this or not.  And I can't see how this
behavior can ever change now that it has been like this for so long.

As a result, perhaps the solution is to just change the docs for the "cc"
clobber to say that it is meaningless.  Maybe something like:

"cc" This clobber is only kept for historical reasons.  It no longer has any
effect on the generation of code.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug inline-asm/68095] "cc" clobber with Flag Output Operands
  2015-10-26  4:39 [Bug inline-asm/68095] New: "cc" clobber with Flag Output Operands gccbugzilla at limegreensocks dot com
  2015-10-27  2:07 ` [Bug inline-asm/68095] " gccbugzilla at limegreensocks dot com
@ 2015-10-28  4:57 ` segher at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: segher at gcc dot gnu.org @ 2015-10-28  4:57 UTC (permalink / raw)
  To: gcc-bugs

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

Segher Boessenkool <segher at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |segher at gcc dot gnu.org

--- Comment #2 from Segher Boessenkool <segher at gcc dot gnu.org> ---
"=@ccc"(r) does not output to the "cc" register, it outputs to a general
register.  It clobbers the "cc" register.  Mentioning that more than
once ("=@ccc", the clobber in the asm, and it is default for the x86
target) is no problem and has clear semantics.

The "cc" clobber is not deprecated, not on other targets anyway.
Even on x86 it still serves to mark those asms that really clobber
the flags register, which can be helpful to the reader.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-10-28  4:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-26  4:39 [Bug inline-asm/68095] New: "cc" clobber with Flag Output Operands gccbugzilla at limegreensocks dot com
2015-10-27  2:07 ` [Bug inline-asm/68095] " gccbugzilla at limegreensocks dot com
2015-10-28  4:57 ` segher at gcc dot gnu.org

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).