"Tim Roberts" <spamtrap@[EMAIL PROTECTED]
> wrote in message
news:gsj1t39b6qfmvkggkvor3fhdns9n6pa7jo@[EMAIL PROTECTED]
> step <spamtrap@[EMAIL PROTECTED]
> wrote:
> >
> > the code is follow , i used gcc version 4.1.2 20061115 (prerelease)
> >and Target: i486-linux-gnu ,
> > gcc -g testasm.c -lm -o testasm compile this code ,but get the
> >error
> >#include <stdio.h>
> >#include <stdlib.h>
> >
> >int main(int argc,char **argv)
> >{
> > float arg1, arg2, add, sub, mul, div ;
> >
> > printf( "Enter two numbers : " );
> > scanf( "%f%f", &arg1, &arg2 );
> >
> > /* Perform floating point Addition, Subtraction, Multiplication &
> >Division */
> > __asm__ ( "fld %1;"
> > "fld %2;"
> > "fadd;"
> > "fstp %0;" : "=g" (add) : "g" (arg1), "g" (arg2) ) ;
>
> gcc does not use the size of the operand to figure out which instruction
to
> use. It can't tell the difference between the single and
double-precision
> instructions, so you have to tell it, by adding a suffix letter.
>
> If you really want singles (which is what you have here with "float"),
use
> "flds" and "fstps".
Are you sure that's his problem?
gcc 3.4.1 (binutils 2.1.5) compiles the code without error (DJGPP). It
warns about 'fadd' needing to be 'faddp', 'fsub'...'fsubp' etc.
Rod Pemberton


|