This is the mail archive of the gcc@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: inline asm constraints for conditions


Richard Henderson wrote:
> On Mon, Sep 29, 2003 at 06:21:34PM +0100, Jamie Lokier wrote:
> > If the flags register is killed, then "reloading" should be a simple
> > matter of either redoing the comparison, as effectively happens all
> > the time now, or saving the _particular_ comparison results that are
> > wanted using setcc, sbbl etc. into an ordinary register.
> 
> In the case under discussion the compiler would not have access to the
> instruction that set the flags -- it's hidden in an asm.  If the insns
> in question were exposed via __builtins, the flags might have been set
> by an instruction like xaddl or cmpxchg which cannot be re-done.

Later in that mail I described what to do when the instruction cannot
be re-done, or when it's better not to redo it:

	4. reload "moves" one condition register _to_ a general register
	   or memory using setcc/sbb.

	5. reload "moves" one condition register _from_ a general
	   register or memory by doing a comparison against the saved
	   value to set the real flags again.

	   Of course this clobbers all the other condition registers :)

In other words, a particular condition is saved as a 0 or 1 value,
using setcc/sbb.  The originating asm instruction is not redone.

> So, no, this would not help at all.

Perhaps it wouldn't, but I think the particular reason you gave is not
the right one :)

-- Jamie


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