Patch "MIPS: math-emu: <MADDF|MSUBF>.S: Fix accuracy (32-bit case)" has been added to the 4.13-stable tree
Subsystems (2)
This is a note to let you know that I've just added the patch titled
MIPS: math-emu: <MADDF|MSUBF>.S: Fix accuracy (32-bit case)
to the 4.13-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
mips-math-emu-maddf-msubf-.s-fix-accuracy-32-bit-case.patch
and it can be found in the queue-4.13 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From
b3b8e1eb27c523e32b6a8aa7ec8ac4754456af57Mon Sep 17 00:00:00 2001
From: Douglas Leung <[email protected]>
Date: Thu, 27 Jul 2017 18:08:58 +0200
Subject: MIPS: math-emu: <MADDF|MSUBF>.S: Fix accuracy (32-bit case)
From: Douglas Leung <[email protected]>
commit b3b8e1eb27c523e32b6a8aa7ec8ac4754456af57 upstream.
Implement fused multiply-add with correct accuracy.
Fused multiply-add operation has better accuracy than respective sequential execution of multiply and add operations applied on the same inputs. This is because accuracy errors accumulate in latter case.
This patch implements fused multiply-add with the same accuracy as it is implemented in hardware, using 64-bit intermediate calculations.
One test case example (raw bits) that this patch fixes:
MADDF.S fd,fs,ft:
fd = 0x22575225
fs = ft = 0x3727c5ac
Patchwork: https://patchwork.linux-mips.org/patch/16890/
--- arch/mips/math-emu/ieee754sp.h | 4 + arch/mips/math-emu/sp_maddf.c | 116 ++++++++++++++++------------------------- 2 files changed, 50 insertions(+), 70 deletions(-)
arch/mips/math-emu/ieee754sp.h +4 -0
@@ -45,6 +45,10 @@ static inline int ieee754sp_finite(unionreturn SPBEXP (x) !=SP_EMAX +1 +SP_EBIAS ; } +/* 64 bit right shift with rounding */ +#define XSPSRS64 (v, rs) \ + (((rs) >= 64) ? ((v) != 0) : ((v) >> (rs)) | ((v) << (64-(rs)) != 0)) +/* 3bit extended single precision sticky right shift */ #define XSPSRS (v, rs) \ ((rs > (SP_FBITS+3))?1:((v) >> (rs)) | ((v) << (32-(rs)) != 0))
arch/mips/math-emu/sp_maddf.c +46 -70
168 lines not on this page · raw message
Patches currently in stable-queue which might be from [email protected] are
queue-4.13/mips-math-emu-maddf-msubf-.-d-s-fix-nan-propagation.patch queue-4.13/mips-math-emu-max-maxa-min-mina-.-d-s-fix-cases-of-both-inputs-zero.patch queue-4.13/mips-math-emu-max-min-.-d-s-fix-cases-of-both-inputs-negative.patch queue-4.13/mips-math-emu-max-maxa-min-mina-.-d-s-fix-quiet-nan-propagation.patch queue-4.13/mips-math-emu-maddf-msubf-.d-fix-accuracy-64-bit-case.patch queue-4.13/mips-math-emu-maddf-msubf-.s-fix-accuracy-32-bit-case.patch queue-4.13/mips-math-emu-maxa-mina-.-d-s-fix-cases-of-input-values-with-opposite-signs.patch queue-4.13/mips-math-emu-maxa-mina-.-d-s-fix-cases-of-both-infinite-inputs.patch queue-4.13/mips-math-emu-mina.-d-s-fix-some-cases-of-infinity-and-zero-inputs.patch queue-4.13/mips-math-emu-maddf-msubf-.-d-s-fix-some-cases-of-zero-inputs.patch queue-4.13/mips-math-emu-maddf-msubf-.-d-s-clean-up-maddf_flags-enumeration.patch queue-4.13/mips-math-emu-maddf-msubf-.-d-s-fix-some-cases-of-infinite-inputs.patch