* [Qemu-devel] [6106] Implement default-NaN mode.
@ 2008-12-19 13:53 Paul Brook
2008-12-19 14:11 ` Laurent Desnogues
0 siblings, 1 reply; 3+ messages in thread
From: Paul Brook @ 2008-12-19 13:53 UTC (permalink / raw)
To: qemu-devel
Revision: 6106
http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6106
Author: pbrook
Date: 2008-12-19 13:53:37 +0000 (Fri, 19 Dec 2008)
Log Message:
-----------
Implement default-NaN mode.
Signed-off-by: Paul Brook <paul@codesourcery.com>
Modified Paths:
--------------
trunk/fpu/softfloat-specialize.h
trunk/fpu/softfloat.h
trunk/target-arm/helper.c
Modified: trunk/fpu/softfloat-specialize.h
===================================================================
--- trunk/fpu/softfloat-specialize.h 2008-12-19 13:37:53 UTC (rev 6105)
+++ trunk/fpu/softfloat-specialize.h 2008-12-19 13:53:37 UTC (rev 6106)
@@ -144,6 +144,9 @@
flag aIsNaN, aIsSignalingNaN, bIsNaN, bIsSignalingNaN;
bits32 av, bv, res;
+ if ( STATUS(default_nan_mode) )
+ return float32_default_nan;
+
aIsNaN = float32_is_nan( a );
aIsSignalingNaN = float32_is_signaling_nan( a );
bIsNaN = float32_is_nan( b );
@@ -276,6 +279,9 @@
flag aIsNaN, aIsSignalingNaN, bIsNaN, bIsSignalingNaN;
bits64 av, bv, res;
+ if ( STATUS(default_nan_mode) )
+ return float64_default_nan;
+
aIsNaN = float64_is_nan( a );
aIsSignalingNaN = float64_is_signaling_nan( a );
bIsNaN = float64_is_nan( b );
@@ -412,6 +418,12 @@
{
flag aIsNaN, aIsSignalingNaN, bIsNaN, bIsSignalingNaN;
+ if ( STATUS(default_nan_mode) ) {
+ a.low = floatx80_default_nan_low;
+ a.high = floatx80_default_nan_high;
+ return a;
+ }
+
aIsNaN = floatx80_is_nan( a );
aIsSignalingNaN = floatx80_is_signaling_nan( a );
bIsNaN = floatx80_is_nan( b );
@@ -532,6 +544,12 @@
{
flag aIsNaN, aIsSignalingNaN, bIsNaN, bIsSignalingNaN;
+ if ( STATUS(default_nan_mode) ) {
+ a.low = float128_default_nan_low;
+ a.high = float128_default_nan_high;
+ return a;
+ }
+
aIsNaN = float128_is_nan( a );
aIsSignalingNaN = float128_is_signaling_nan( a );
bIsNaN = float128_is_nan( b );
Modified: trunk/fpu/softfloat.h
===================================================================
--- trunk/fpu/softfloat.h 2008-12-19 13:37:53 UTC (rev 6105)
+++ trunk/fpu/softfloat.h 2008-12-19 13:53:37 UTC (rev 6106)
@@ -190,10 +190,15 @@
#ifdef FLOATX80
signed char floatx80_rounding_precision;
#endif
+ flag default_nan_mode;
} float_status;
void set_float_rounding_mode(int val STATUS_PARAM);
void set_float_exception_flags(int val STATUS_PARAM);
+INLINE void set_default_nan_mode(flag val STATUS_PARAM)
+{
+ STATUS(default_nan_mode) = val;
+}
INLINE int get_float_exception_flags(float_status *status)
{
return STATUS(float_exception_flags);
Modified: trunk/target-arm/helper.c
===================================================================
--- trunk/target-arm/helper.c 2008-12-19 13:37:53 UTC (rev 6105)
+++ trunk/target-arm/helper.c 2008-12-19 13:53:37 UTC (rev 6106)
@@ -2334,6 +2334,8 @@
}
set_float_rounding_mode(i, &env->vfp.fp_status);
}
+ if (changed & (1 << 25))
+ set_default_nan_mode((val & (1 << 25)) != 0, &env->vfp.fp_status);
i = vfp_exceptbits_to_host((val >> 8) & 0x1f);
set_float_exception_flags(i, &env->vfp.fp_status);
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [6106] Implement default-NaN mode.
2008-12-19 13:53 [Qemu-devel] [6106] Implement default-NaN mode Paul Brook
@ 2008-12-19 14:11 ` Laurent Desnogues
2008-12-19 14:25 ` Paul Brook
0 siblings, 1 reply; 3+ messages in thread
From: Laurent Desnogues @ 2008-12-19 14:11 UTC (permalink / raw)
To: qemu-devel
On Fri, Dec 19, 2008 at 2:53 PM, Paul Brook <paul@nowt.org> wrote:
> Revision: 6106
> http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6106
> Author: pbrook
> Date: 2008-12-19 13:53:37 +0000 (Fri, 19 Dec 2008)
>
> Log Message:
> -----------
> Implement default-NaN mode.
>
> Signed-off-by: Paul Brook <paul@codesourcery.com>
>
> Modified Paths:
> --------------
> trunk/fpu/softfloat-specialize.h
> trunk/fpu/softfloat.h
> trunk/target-arm/helper.c
[...]
> Modified: trunk/target-arm/helper.c
> ===================================================================
> --- trunk/target-arm/helper.c 2008-12-19 13:37:53 UTC (rev 6105)
> +++ trunk/target-arm/helper.c 2008-12-19 13:53:37 UTC (rev 6106)
> @@ -2334,6 +2334,8 @@
> }
> set_float_rounding_mode(i, &env->vfp.fp_status);
> }
> + if (changed & (1 << 25))
> + set_default_nan_mode((val & (1 << 25)) != 0, &env->vfp.fp_status);
>
> i = vfp_exceptbits_to_host((val >> 8) & 0x1f);
> set_float_exception_flags(i, &env->vfp.fp_status);
Doesn't this require an update to the way flags are computed in
target-arm/cpu.h/cpu_get_tb_cpu_state?
Also I guess the comment at end of vfp_set_fpscr needs some
update to reflect the handling of DN :-)
Laurent
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [6106] Implement default-NaN mode.
2008-12-19 14:11 ` Laurent Desnogues
@ 2008-12-19 14:25 ` Paul Brook
0 siblings, 0 replies; 3+ messages in thread
From: Paul Brook @ 2008-12-19 14:25 UTC (permalink / raw)
To: qemu-devel; +Cc: Laurent Desnogues
> Doesn't this require an update to the way flags are computed in
> target-arm/cpu.h/cpu_get_tb_cpu_state?
No. These are all runtime checks.
In theory this patch (and the flush-to-zero patch) introduce some runtime
overhead. However it should only effect the exceptional cases of denormals
and NaNs, normal numbers should be unaffected.
> Also I guess the comment at end of vfp_set_fpscr needs some
> update to reflect the handling of DN :-)
Keep reading :-)
Paul
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-12-19 14:25 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-19 13:53 [Qemu-devel] [6106] Implement default-NaN mode Paul Brook
2008-12-19 14:11 ` Laurent Desnogues
2008-12-19 14:25 ` Paul Brook
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).