* [PATCH] ARM: VFP: Fix emulation of multiply accumulate instructions
@ 2014-03-26 16:49 Jay Foad
2014-04-08 13:13 ` Dave Martin
0 siblings, 1 reply; 3+ messages in thread
From: Jay Foad @ 2014-03-26 16:49 UTC (permalink / raw)
To: linux-arm-kernel
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 <jay.foad@gmail.com>
---
arch/arm/vfp/vfpdouble.c | 2 ++
arch/arm/vfp/vfpsingle.c | 2 ++
2 files changed, 4 insertions(+)
diff --git a/arch/arm/vfp/vfpdouble.c b/arch/arm/vfp/vfpdouble.c
index 6cac43bd1d86..423f56dd4028 100644
--- a/arch/arm/vfp/vfpdouble.c
+++ b/arch/arm/vfp/vfpdouble.c
@@ -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);
diff --git a/arch/arm/vfp/vfpsingle.c b/arch/arm/vfp/vfpsingle.c
index b252631b406b..4f96c1617aae 100644
--- a/arch/arm/vfp/vfpsingle.c
+++ b/arch/arm/vfp/vfpsingle.c
@@ -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);
--
1.8.3.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH] ARM: VFP: Fix emulation of multiply accumulate instructions
2014-03-26 16:49 [PATCH] ARM: VFP: Fix emulation of multiply accumulate instructions Jay Foad
@ 2014-04-08 13:13 ` Dave Martin
2014-04-14 15:26 ` Jay Foad
0 siblings, 1 reply; 3+ messages in thread
From: Dave Martin @ 2014-04-08 13:13 UTC (permalink / raw)
To: linux-arm-kernel
On Wed, Mar 26, 2014 at 04:49:09PM +0000, Jay Foad wrote:
> 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 <jay.foad@gmail.com>
Reviewed-by: Dave Martin <Dave.Martin@arm.com>
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
> ---
> arch/arm/vfp/vfpdouble.c | 2 ++
> arch/arm/vfp/vfpsingle.c | 2 ++
> 2 files changed, 4 insertions(+)
>
> diff --git a/arch/arm/vfp/vfpdouble.c b/arch/arm/vfp/vfpdouble.c
> index 6cac43bd1d86..423f56dd4028 100644
> --- a/arch/arm/vfp/vfpdouble.c
> +++ b/arch/arm/vfp/vfpdouble.c
> @@ -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);
>
> diff --git a/arch/arm/vfp/vfpsingle.c b/arch/arm/vfp/vfpsingle.c
> index b252631b406b..4f96c1617aae 100644
> --- a/arch/arm/vfp/vfpsingle.c
> +++ b/arch/arm/vfp/vfpsingle.c
> @@ -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);
>
> --
> 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
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] ARM: VFP: Fix emulation of multiply accumulate instructions
2014-04-08 13:13 ` Dave Martin
@ 2014-04-14 15:26 ` Jay Foad
0 siblings, 0 replies; 3+ messages in thread
From: Jay Foad @ 2014-04-14 15:26 UTC (permalink / raw)
To: linux-arm-kernel
On 8 April 2014 14:13, Dave Martin <Dave.Martin@arm.com> wrote:
> On Wed, Mar 26, 2014 at 04:49:09PM +0000, Jay Foad wrote:
>> 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 <jay.foad@gmail.com>
>
> Reviewed-by: Dave Martin <Dave.Martin@arm.com>
>
> 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.
> 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.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-04-14 15:26 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-26 16:49 [PATCH] ARM: VFP: Fix emulation of multiply accumulate instructions Jay Foad
2014-04-08 13:13 ` Dave Martin
2014-04-14 15:26 ` Jay Foad
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).