Talk About Network



Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Assembly x86 > what can i do f...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 4 Topic 4558 of 4646
Post > Topic >>

what can i do for this error "suffix or operands invalid for `fld'"

by step <spamtrap@[EMAIL PROTECTED] > Mar 5, 2008 at 03:02 AM

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) ) ;

    __asm__ ( "fld %2;"
              "fld %1;"
              "fsub;"
              "fstp %0;" : "=g" (sub) : "g" (arg1), "g" (arg2) ) ;

    __asm__ ( "fld %1;"
              "fld %2;"
              "fmul;"
              "fstp %0;" : "=g" (mul) : "g" (arg1), "g" (arg2) ) ;

    __asm__ ( "fld %2;"
              "fld %1;"
              "fdiv;"
              "fstp %0;" : "=g" (div) : "g" (arg1), "g" (arg2) ) ;

    printf( "%f + %f = %f\n", arg1, arg2, add );
    printf( "%f - %f = %f\n", arg1, arg2, sub );
    printf( "%f * %f = %f\n", arg1, arg2, mul );
    printf( "%f / %f = %f\n", arg1, arg2, div );
    return 0;
}

  is it lack flags to gcc ?




 4 Posts in Topic:
what can i do for this error "suffix or operands invalid for `fl
step <spamtrap@[EMAIL  2008-03-05 03:02:10 
Re: what can i do for this error "suffix or operands invalid for
Tim Roberts <spamtrap  2008-03-07 05:19:27 
Re: what can i do for this error "suffix or operands invalid for
"Rod Pemberton"  2008-03-07 05:49:05 
Re: what can i do for this error "suffix or operands invalid for
Tim Roberts <spamtrap  2008-03-09 00:48:43 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Tue May 13 8:03:45 CDT 2008.