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/29337] -mfpmath=387 doesn't use fistp for double-to-integer conversion



------- Comment #1 from pluto at agmk dot net  2006-10-03 21:57 -------
(In reply to comment #0)

> This makes a difference if/when the extra precision of 387 makes difference 

for an extra prescision try to use a `long double'.

$ cat fp.cpp
int convert( long double x ) { return (int)x; }
int convert( double x ) { return (int)x; }

convert(long double):
        fldt    8(%rsp)
        fnstcw  -10(%rsp)
        movzwl  -10(%rsp), %eax
        orb     $12, %ah
        movw    %ax, -12(%rsp)
        fldcw   -12(%rsp)
        fistpl  -16(%rsp)
        fldcw   -10(%rsp)
        movl    -16(%rsp), %eax
        ret

convert(double):
        cvttsd2si       %xmm0, %eax
        ret


-- 

pluto at agmk dot net changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pluto at agmk dot net


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


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