1 From 1a41b3b441508ae63b1a9ec699ec94065739eb60 Mon Sep 17 00:00:00 2001
2 From: Aleksandar Markovic <aleksandar.markovic@imgtec.com>
3 Date: Thu, 27 Jul 2017 18:08:51 +0200
4 Subject: MIPS: math-emu: <MAXA|MINA>.<D|S>: Fix cases of input values with opposite signs
6 From: Aleksandar Markovic <aleksandar.markovic@imgtec.com>
8 commit 1a41b3b441508ae63b1a9ec699ec94065739eb60 upstream.
10 Fix the value returned by <MAXA|MINA>.<D|S>, if the inputs are normal
11 fp numbers of the same absolute value, but opposite signs.
16 If fs contains -3.0, and ft contains +3.0, fd is going to contain
17 +3.0 (without this patch, it used to contain -3.0).
19 Fixes: a79f5f9ba508 ("MIPS: math-emu: Add support for the MIPS R6 MAX{, A} FPU instruction")
20 Fixes: 4e9561b20e2f ("MIPS: math-emu: Add support for the MIPS R6 MIN{, A} FPU instruction")
22 Signed-off-by: Miodrag Dinic <miodrag.dinic@imgtec.com>
23 Signed-off-by: Goran Ferenc <goran.ferenc@imgtec.com>
24 Signed-off-by: Aleksandar Markovic <aleksandar.markovic@imgtec.com>
25 Reviewed-by: James Hogan <james.hogan@imgtec.com>
26 Cc: Bo Hu <bohu@google.com>
27 Cc: Douglas Leung <douglas.leung@imgtec.com>
28 Cc: Jin Qian <jinqian@google.com>
29 Cc: Paul Burton <paul.burton@imgtec.com>
30 Cc: Petar Jovanovic <petar.jovanovic@imgtec.com>
31 Cc: Raghu Gandham <raghu.gandham@imgtec.com>
32 Cc: linux-mips@linux-mips.org
33 Cc: linux-kernel@vger.kernel.org
34 Patchwork: https://patchwork.linux-mips.org/patch/16883/
35 Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
36 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
39 arch/mips/math-emu/dp_fmax.c | 8 ++++++--
40 arch/mips/math-emu/dp_fmin.c | 6 +++++-
41 arch/mips/math-emu/sp_fmax.c | 8 ++++++--
42 arch/mips/math-emu/sp_fmin.c | 6 +++++-
43 4 files changed, 22 insertions(+), 6 deletions(-)
45 --- a/arch/mips/math-emu/dp_fmax.c
46 +++ b/arch/mips/math-emu/dp_fmax.c
47 @@ -243,7 +243,11 @@ union ieee754dp ieee754dp_fmaxa(union ie
50 /* Compare mantissa */
61 --- a/arch/mips/math-emu/dp_fmin.c
62 +++ b/arch/mips/math-emu/dp_fmin.c
63 @@ -243,7 +243,11 @@ union ieee754dp ieee754dp_fmina(union ie
66 /* Compare mantissa */
76 --- a/arch/mips/math-emu/sp_fmax.c
77 +++ b/arch/mips/math-emu/sp_fmax.c
78 @@ -243,7 +243,11 @@ union ieee754sp ieee754sp_fmaxa(union ie
81 /* Compare mantissa */
92 --- a/arch/mips/math-emu/sp_fmin.c
93 +++ b/arch/mips/math-emu/sp_fmin.c
94 @@ -243,7 +243,11 @@ union ieee754sp ieee754sp_fmina(union ie
97 /* Compare mantissa */