ARM: VFP: Fix emulation of multiply accumulate instructions
Subsystems (2)
PATCH 1/1 ARM: VFP: Fix emulation of multiply accumulate instructions
The emulation for single and double precision multiply accumulate instructions correctly normalised any denormal values in the operand registers, but failed to normalise the destination (accumulator) register.
This fixes https://bugzilla.kernel.org/show_bug.cgi?id=70501
--- arch/arm/vfp/vfpdouble.c | 2 ++ arch/arm/vfp/vfpsingle.c | 2 ++ 2 files changed, 4 insertions(+)
arch/arm/vfp/vfpdouble.c +2 -0
@@ -866,6 +866,8 @@ vfp_double_multiply_accumulate(int dd, int dn, int dm, u32 fpscr, u32 negate, ch vdp.sign =vfp_sign_negate (vdp.sign);vfp_double_unpack (&vdn,vfp_get_double (dd)); +if (vdn.exponent ==0 && vdn.significand) +vfp_double_normalise_denormal (&vdn);if (negate &NEG_SUBTRACT ) vdn.sign =vfp_sign_negate (vdn.sign);
arch/arm/vfp/vfpsingle.c +2 -0
@@ -915,6 +915,8 @@ vfp_single_multiply_accumulate(int sd, int sn, s32 m, u32 fpscr, u32 negate, cha v =vfp_get_float (sd);pr_debug ("VFP: s%u = %08x\n" , sd, v);vfp_single_unpack (&vsn, v); +if (vsn.exponent ==0 && vsn.significand) +vfp_single_normalise_denormal (&vsn);if (negate &NEG_SUBTRACT ) vsn.sign =vfp_sign_negate (vsn.sign);
Signature · 1 line
1.8.3.2
Quoted 8 lines · Jay Foad
The emulation for single and double precision multiply accumulate instructions correctly normalised any denormal values in the operand registers, but failed to normalise the destination (accumulator) register.
This fixes https://bugzilla.kernel.org/show_bug.cgi?id=70501
Signed-off-by Jay Foad <[email protected]>
This appears to be clean and straightforward, so if nobody else has commented on this by the time -rc1 comes out, I suggest you rebase it and send it to the patch system. (See
http://www.arm.linux.org.uk/developer/patches/info.php for details -- make sure you read it carefully.)
Has this issue been hitting real-world users of the kernel, or is this fixing a latent bug?
Cheers
---Dave
Quoted 39 lines
--- arch/arm/vfp/vfpdouble.c | 2 ++ arch/arm/vfp/vfpsingle.c | 2 ++ 2 files changed, 4 insertions(+)arch/arm/vfp/vfpdouble.c +2
-0@@ -866,6 +866,8 @@ vfp_double_multiply_accumulate(int dd, int dn, int dm, u32 fpscr, u32 negate, ch vdp.sign =vfp_sign_negate (vdp.sign);vfp_double_unpack (&vdn,vfp_get_double (dd)); +if (vdn.exponent ==0 && vdn.significand) +vfp_double_normalise_denormal (&vdn);if (negate &NEG_SUBTRACT ) vdn.sign =vfp_sign_negate (vdn.sign);arch/arm/vfp/vfpsingle.c +2
-0@@ -915,6 +915,8 @@ vfp_single_multiply_accumulate(int sd, int sn, s32 m, u32 fpscr, u32 negate, cha v =vfp_get_float (sd);pr_debug ("VFP: s%u = %08x\n" , sd, v);vfp_single_unpack (&vsn, v); +if (vsn.exponent ==0 && vsn.significand) +vfp_single_normalise_denormal (&vsn);if (negate &NEG_SUBTRACT ) vsn.sign =vfp_sign_negate (vsn.sign);Signature · 7 lines
1.8.3.2 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel at lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Quoted 10 lines · Dave Martin
Quoted 8 lines · Jay Foad
The emulation for single and double precision multiply accumulate instructions correctly normalised any denormal values in the operand registers, but failed to normalise the destination (accumulator) register.
This fixes https://bugzilla.kernel.org/show_bug.cgi?id=70501
Signed-off-by Jay Foad <[email protected]>
Quoted 7 lines
Reviewed-by Dave Martin <[email protected]>This appears to be clean and straightforward, so if nobody else has commented on this by the time -rc1 comes out, I suggest you rebase it and send it to the patch system. (See
http://www.arm.linux.org.uk/developer/patches/info.php for details -- make sure you read it carefully.)
Done.
Quoted 2 lines
Has this issue been hitting real-world users of the kernel, or is this fixing a latent bug?
Real world: it was causing failures in the test suite for an APL interpreter running on the Raspberry Pi.
Thanks,
Jay.