qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] MIPS FP rounding
@ 2007-09-19 20:41 Daniel Jacobowitz
  2007-09-20 17:28 ` [Qemu-devel] " Thiemo Seufer
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel Jacobowitz @ 2007-09-19 20:41 UTC (permalink / raw)
  To: qemu-devel, Thiemo Seufer

Thiemo, in May you added this:

-    update_fcr31();       \
+    update_fcr31();                                           \
+    if (GET_FP_CAUSE(env->fcr31) & FP_INVALID)                \
+        FST2 = 0x7fbfffff;                                    \
+    else if (GET_FP_CAUSE(env->fcr31) & FP_UNDERFLOW) {       \
+        if ((env->fcr31 & 0x3) == 0)                          \
+            FST2 &= 0x80000000ULL;                            \
+    }                     \

That last bit says that if underflow is detected and the rounding mode
is round-to-nearest, return an signed appropriate signed zero.  Why?
The MIPS ISA docs say a rounded result is returned in this case, and
that's what's in FST2 if that code is removed.

This shows up in the mul-subnormal-single-1.c test from GCC's ieee.exp.

-- 
Daniel Jacobowitz
CodeSourcery

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Qemu-devel] Re: MIPS FP rounding
  2007-09-19 20:41 [Qemu-devel] MIPS FP rounding Daniel Jacobowitz
@ 2007-09-20 17:28 ` Thiemo Seufer
  2007-09-24 13:37   ` Daniel Jacobowitz
  0 siblings, 1 reply; 3+ messages in thread
From: Thiemo Seufer @ 2007-09-20 17:28 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: qemu-devel

Daniel Jacobowitz wrote:
> Thiemo, in May you added this:
> 
> -    update_fcr31();       \
> +    update_fcr31();                                           \
> +    if (GET_FP_CAUSE(env->fcr31) & FP_INVALID)                \
> +        FST2 = 0x7fbfffff;                                    \
> +    else if (GET_FP_CAUSE(env->fcr31) & FP_UNDERFLOW) {       \
> +        if ((env->fcr31 & 0x3) == 0)                          \
> +            FST2 &= 0x80000000ULL;                            \
> +    }                     \
> 
> That last bit says that if underflow is detected and the rounding mode
> is round-to-nearest, return an signed appropriate signed zero.  Why?
> The MIPS ISA docs say a rounded result is returned in this case, and
> that's what's in FST2 if that code is removed.

It fixed an internal testcase, I'll have to check what was going
on there, probably tomorrow.


Thiemo

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Qemu-devel] Re: MIPS FP rounding
  2007-09-20 17:28 ` [Qemu-devel] " Thiemo Seufer
@ 2007-09-24 13:37   ` Daniel Jacobowitz
  0 siblings, 0 replies; 3+ messages in thread
From: Daniel Jacobowitz @ 2007-09-24 13:37 UTC (permalink / raw)
  To: Thiemo Seufer; +Cc: qemu-devel

On Thu, Sep 20, 2007 at 06:28:25PM +0100, Thiemo Seufer wrote:
> It fixed an internal testcase, I'll have to check what was going
> on there, probably tomorrow.

I don't suppose you've had a chance to look at this?

-- 
Daniel Jacobowitz
CodeSourcery

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-09-24 13:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-19 20:41 [Qemu-devel] MIPS FP rounding Daniel Jacobowitz
2007-09-20 17:28 ` [Qemu-devel] " Thiemo Seufer
2007-09-24 13:37   ` Daniel Jacobowitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).