This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: inline asm and status flags on x86
On Thu, May 04, 2000 at 07:08:05PM +0100, Richard Earnshaw wrote:
> > On Thu, May 04, 2000 at 01:42:31PM -0400, Geoff Berry wrote:
> > > How's this?
> > >
> > > 2000-05-04 Geoff Berry <geoffb@bops.com>
> > >
> > > * extend.texi (Extended Asm): Document inability to give asm
> > > statements access to condition codes.
> > >
> > > Index: extend.texi
> > > ===================================================================
> > > RCS file: /cvs/gcc/egcs/gcc/extend.texi,v
> > > retrieving revision 1.44
> > > diff -c -3 -p -r1.44 extend.texi
> > > *** extend.texi 2000/03/14 08:24:21 1.44
> > > --- extend.texi 2000/05/04 17:39:52
> > > *************** instructions would alter the condition c
> > > *** 2662,2667 ****
> > > --- 2662,2671 ----
> > > test it. This problem doesn't arise for ordinary ``test'' and
> > > ``compare'' instructions because they don't have any output operands.
> > >
> > > + For reasons similar to those described above, it is not possible to give
> > > + an assembler instruction access to the condition code left by previous
> > > + instructions.
> > > +
> > > If you are writing a header file that should be includable in ANSI C
> > > programs, write @code{__asm__} instead of @code{asm}. @xref{Alternate
> > > Keywords}.
> >
> > We probably should at least think about redoing the wording of previous
> > paragraph for non-CC0 machines.
> >
>
> I don't see how you would do it even for non-CC0 machines. The inputs to
> an ASM are 'C' (or other language) variables, or expressions. There are
> no expressions that directly represent the state of the condition-codes at
> this level, so there is no way to specify to the ASM what was intended.
In some non-CC0 machines, you can represent the condition code as a register,
possibly through the use of __asm__ on a declaration or as output from another
__asm__.
--
Michael Meissner, Cygnus Solutions, a Red Hat company.
PMB 198, 174 Littleton Road #3, Westford, Massachusetts 01886, USA
Work: meissner@redhat.com phone: +1 978-486-9304
Non-work: meissner@spectacle-pond.org fax: +1 978-692-4482