NetBSD-Bugs archive

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

Re: misc/44767: floating point support broken in QEMU



The following reply was made to PR misc/44767; it has been noted by GNATS.

From: Martin Husemann <martin%duskware.de@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: 
Subject: Re: misc/44767: floating point support broken in QEMU
Date: Wed, 1 Jun 2011 10:02:12 +0200

 I think it realy is a QEMU bug, the differences between the linux code (which
 is a slightly modified version of our code) is: to set the rounding down
 mode in the FP controll register, Linux uses 32bit operations, while our
 code uses 16 bit ops.
 
 The only other difference is that we save and restore %xmm0.
 
 Simple test to verify this hypothesis: run the test under qemu with the
 following patch (untested):
 
 Index: s_floor.S
 ===================================================================
 RCS file: /cvsroot/src/lib/libm/arch/i387/s_floor.S,v
 retrieving revision 1.8
 diff -u -r1.8 s_floor.S
 --- s_floor.S  26 Jul 2003 19:25:02 -0000      1.8
 +++ s_floor.S  1 Jun 2011 08:00:56 -0000
 @@ -29,10 +29,10 @@
  #else
        movsd   %xmm0, -8(%rsp)
        fstcw   -12(%rsp)
 -      movw    -12(%rsp),%dx
 -      orw     $0x0400,%dx
 -      andw    $0xf7ff,%dx
 -      movw    %dx,-16(%rsp)
 +      movl    -12(%rsp),%edx
 +      orl     $0x0400,%edx
 +      andl    $0xf7ff,%edx
 +      movl    %edx,-16(%rsp)
        fldcw   -16(%rsp)
        fldl    -8(%rsp)
        frndint
 
 
 If this helps, tell the QEMU folks about it.
 
 Martin
 


Home | Main Index | Thread Index | Old Index