MIPS: math-emu: <MADDF|MSUBF>.<D|S>: Fix some cases of zero inputs
authorAleksandar Markovic <[email protected]>
Thu, 27 Jul 2017 16:08:56 +0000 (18:08 +0200)
committerRalf Baechle <[email protected]>
Tue, 29 Aug 2017 13:21:56 +0000 (15:21 +0200)
commit7cf64ce4d37f1b4f44365fcf77f565d523819dcd
treef4fb490c28ef0d095190c6c447d0898f0e6de388
parent0c64fe6348687f0e1cea9a608eae9d351124a73a
MIPS: math-emu: <MADDF|MSUBF>.<D|S>: Fix some cases of zero inputs

Fix the cases of <MADDF|MSUBF>.<D|S> when any of two multiplicands is
+0 or -0, and the third input is also +0 or -0. Depending on the signs
of inputs, certain special cases must be handled.

A relevant example:

MADDF.S fd,fs,ft:
  If fs contains +0.0, ft contains -0.0, and fd contains 0.0, fd is
  going to contain +0.0 (without this patch, it used to contain -0.0).

Fixes: e24c3bec3e8e ("MIPS: math-emu: Add support for the MIPS R6 MADDF FPU instruction")
Fixes: 83d43305a1df ("MIPS: math-emu: Add support for the MIPS R6 MSUBF FPU instruction")
Signed-off-by: Miodrag Dinic <[email protected]>
Signed-off-by: Goran Ferenc <[email protected]>
Signed-off-by: Aleksandar Markovic <[email protected]>
Reviewed-by: James Hogan <[email protected]>
Cc: Bo Hu <[email protected]>
Cc: Douglas Leung <[email protected]>
Cc: Jin Qian <[email protected]>
Cc: Paul Burton <[email protected]>
Cc: Petar Jovanovic <[email protected]>
Cc: Raghu Gandham <[email protected]>
Cc: <[email protected]> # 4.7+
Cc: [email protected]
Cc: [email protected]
Patchwork: https://patchwork.linux-mips.org/patch/16888/
Signed-off-by: Ralf Baechle <[email protected]>
arch/mips/math-emu/dp_maddf.c
arch/mips/math-emu/sp_maddf.c