bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: reversal of fsubp and fsubrp


From: Alan Modra
Subject: Re: reversal of fsubp and fsubrp
Date: Tue, 13 Nov 2007 07:43:34 +1030
User-agent: Mutt/1.5.9i

On Mon, Nov 12, 2007 at 08:03:23AM -0800, dancie wrote:
> I have noticed when debugging with gdb that the opcode "de e9" that (in intel
> syntax) gdb gives out fsubrp st1,st0.
> But according to the intel docs this fsubp st1,st0. I have also noticed that
> the opcode for fsubrp st1,st0 gives out
> fsubp st1,st0.
[snip]

This comment from include/opcode/i386.h explains the situation.  You
can build both binutils and gcc with -DSYSV386_COMPAT=0 if you wish.

/* The SystemV/386 SVR3.2 assembler, and probably all AT&T derived
   ix86 Unix assemblers, generate floating point instructions with
   reversed source and destination registers in certain cases.
   Unfortunately, gcc and possibly many other programs use this
   reversed syntax, so we're stuck with it.

   eg. `fsub %st(3),%st' results in st = st - st(3) as expected, but
   `fsub %st,%st(3)' results in st(3) = st - st(3), rather than
   the expected st(3) = st(3) - st

   This happens with all the non-commutative arithmetic floating point
   operations with two register operands, where the source register is
   %st, and destination register is %st(i).

   The affected opcode map is dceX, dcfX, deeX, defX.  */

-- 
Alan Modra
Australia Development Lab, IBM




reply via email to

[Prev in Thread] Current Thread [Next in Thread]