[PATCH] atomic_dec_if_positive sign extension fix
Gabriel Paubert
paubert at iram.es
Tue Jan 16 15:28:29 EST 2007
On Mon, Jan 15, 2007 at 05:01:12PM +0100, Segher Boessenkool wrote:
> >It also avoids clobbering the carry, you don't know whether a future
> >version of GCC will require explicit clobbers for the carry. For now
> >they are useless: you can specify "xer" in the clobber list AFAIR but
> >no pattern can be split between setters and users of the carry in the
> >machine description.
>
> You can specify "cc" in the clobber list already, don't use
> "xer" unless you're clobbering something else in the XER.
>
Hmm, I believed "cc" was an alias for cr0.
[Looking at gcc sources]
Ths snippet of gcc/config/rs6000.h confirms this:
{"cr0", 68}, {"cr1", 69}, {"cr2", 70}, {"cr3", 71}, \
{"cr4", 72}, {"cr5", 73}, {"cr6", 74}, {"cr7", 75}, \
{"cc", 68}, {"sp", 1}, {"toc", 2} }
In this file, xer has number 76. So "cc" does not indicate a carry
clobber. There is currently no way to specify a carry clobber, but
also gcc will never insert an inline asm between settings and uses
of the carry.
The following comment:
/* PSImode is used for the XER register. The XER register
is not used for anything; perhaps it should be deleted,
except that that would change register numbers. */
PARTIAL_INT_MODE (SI);
in gcc/config/rs6000-modes.def is actually a bit misleading since the
XER is often clobbered by instructions. But the XER is actually never
exposed to the instruction scheduler: all the patterns that set and use
the carry are simple lists of machine instructions which will be put in
the final object without modifications (only register number and possibly
immediate value substitution).
Gabriel
More information about the Linuxppc-dev
mailing list