Commit afc09008 authored by Russell King's avatar Russell King

[ARM] Fix VFP NaN flag handling.

The special non-signalling NaN flag was escaping and setting some
FPSCR exception enable flags.  Ensure that this flag is masked out
before we update the FPSCR.
parent 081d2786
...@@ -337,3 +337,8 @@ extern u32 vfp_get_sys(unsigned int reg); ...@@ -337,3 +337,8 @@ extern u32 vfp_get_sys(unsigned int reg);
extern void vfp_put_sys(unsigned int reg, u32 val); extern void vfp_put_sys(unsigned int reg, u32 val);
u32 vfp_estimate_sqrt_significand(u32 exponent, u32 significand); u32 vfp_estimate_sqrt_significand(u32 exponent, u32 significand);
/*
* A special flag to tell the normalisation code not to normalise.
*/
#define VFP_NAN_FLAG 0x100
...@@ -195,7 +195,7 @@ u32 vfp_double_normaliseround(int dd, struct vfp_double *vd, u32 fpscr, u32 exce ...@@ -195,7 +195,7 @@ u32 vfp_double_normaliseround(int dd, struct vfp_double *vd, u32 fpscr, u32 exce
dd, d, exceptions); dd, d, exceptions);
vfp_put_double(dd, d); vfp_put_double(dd, d);
} }
return exceptions; return exceptions & ~VFP_NAN_FLAG;
} }
/* /*
...@@ -240,7 +240,7 @@ vfp_propagate_nan(struct vfp_double *vdd, struct vfp_double *vdn, ...@@ -240,7 +240,7 @@ vfp_propagate_nan(struct vfp_double *vdd, struct vfp_double *vdn,
/* /*
* If one was a signalling NAN, raise invalid operation. * If one was a signalling NAN, raise invalid operation.
*/ */
return tn == VFP_SNAN || tm == VFP_SNAN ? FPSCR_IOC : 0x100; return tn == VFP_SNAN || tm == VFP_SNAN ? FPSCR_IOC : VFP_NAN_FLAG;
} }
/* /*
......
...@@ -201,7 +201,7 @@ u32 vfp_single_normaliseround(int sd, struct vfp_single *vs, u32 fpscr, u32 exce ...@@ -201,7 +201,7 @@ u32 vfp_single_normaliseround(int sd, struct vfp_single *vs, u32 fpscr, u32 exce
vfp_put_float(sd, d); vfp_put_float(sd, d);
} }
return exceptions; return exceptions & ~VFP_NAN_FLAG;
} }
/* /*
...@@ -246,7 +246,7 @@ vfp_propagate_nan(struct vfp_single *vsd, struct vfp_single *vsn, ...@@ -246,7 +246,7 @@ vfp_propagate_nan(struct vfp_single *vsd, struct vfp_single *vsn,
/* /*
* If one was a signalling NAN, raise invalid operation. * If one was a signalling NAN, raise invalid operation.
*/ */
return tn == VFP_SNAN || tm == VFP_SNAN ? FPSCR_IOC : 0x100; return tn == VFP_SNAN || tm == VFP_SNAN ? FPSCR_IOC : VFP_NAN_FLAG;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment