This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug target/36923] Crashes with FPU inline-assembly



------- Comment #1 from ubizjak at gmail dot com  2008-08-03 09:16 -------
Stack asm constraints have some annoying properties. Please note, that in your
testcase, value in %st1 isn't popped from the stack. Also, reverse subtract can
be used to avoid fxch. I propose to rewrite your function as:

static float fraction( float _x )
{
 int tmp;

 asm ( "fld %%st\n\t"
       "fisttp %1\n\t"
       "fild %1\n\t"
       "fsubrp %%st, %%st(1)"
       : "+t"( _x ), "=m"( tmp )
       :
       : "st(1)" );

 return( _x );
}


-- 

ubizjak at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36923


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]