diff options
author | Aleksandar Markovic <aleksandar.markovic@imgtec.com> | 2017-06-19 11:50:12 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2017-06-27 20:54:30 -0400 |
commit | ddbfff7429a75d954bf5bdff9f2222bceb4c236a (patch) | |
tree | 89a95f0e4b2d3859fd900e9b1e74a25887bb2355 | |
parent | 25d8b92e0af75d72ce8b99e63e5a449cc0888efa (diff) |
MIPS: math-emu: Handle zero accumulator case in MADDF and MSUBF separately
If accumulator value is zero, just return the value of previously
calculated product. This brings logic in MADDF/MSUBF implementation
closer to the logic in ADD/SUB case.
Signed-off-by: Miodrag Dinic <miodrag.dinic@imgtec.com>
Signed-off-by: Goran Ferenc <goran.ferenc@imgtec.com>
Signed-off-by: Aleksandar Markovic <aleksandar.markovic@imgtec.com>
Cc: James.Hogan@imgtec.com
Cc: Paul.Burton@imgtec.com
Cc: Raghu.Gandham@imgtec.com
Cc: Leonid.Yegoshin@imgtec.com
Cc: Douglas.Leung@imgtec.com
Cc: Petar.Jovanovic@imgtec.com
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/16512/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
-rw-r--r-- | arch/mips/math-emu/dp_maddf.c | 5 | ||||
-rw-r--r-- | arch/mips/math-emu/sp_maddf.c | 5 |
2 files changed, 8 insertions, 2 deletions
diff --git a/arch/mips/math-emu/dp_maddf.c b/arch/mips/math-emu/dp_maddf.c index 4a2d03c72959..caa62f20a888 100644 --- a/arch/mips/math-emu/dp_maddf.c +++ b/arch/mips/math-emu/dp_maddf.c | |||
@@ -54,7 +54,7 @@ static union ieee754dp _dp_maddf(union ieee754dp z, union ieee754dp x, | |||
54 | return ieee754dp_nanxcpt(z); | 54 | return ieee754dp_nanxcpt(z); |
55 | case IEEE754_CLASS_DNORM: | 55 | case IEEE754_CLASS_DNORM: |
56 | DPDNORMZ; | 56 | DPDNORMZ; |
57 | /* QNAN is handled separately below */ | 57 | /* QNAN and ZERO cases are handled separately below */ |
58 | } | 58 | } |
59 | 59 | ||
60 | switch (CLPAIR(xc, yc)) { | 60 | switch (CLPAIR(xc, yc)) { |
@@ -210,6 +210,9 @@ static union ieee754dp _dp_maddf(union ieee754dp z, union ieee754dp x, | |||
210 | } | 210 | } |
211 | assert(rm & (DP_HIDDEN_BIT << 3)); | 211 | assert(rm & (DP_HIDDEN_BIT << 3)); |
212 | 212 | ||
213 | if (zc == IEEE754_CLASS_ZERO) | ||
214 | return ieee754dp_format(rs, re, rm); | ||
215 | |||
213 | /* And now the addition */ | 216 | /* And now the addition */ |
214 | assert(zm & DP_HIDDEN_BIT); | 217 | assert(zm & DP_HIDDEN_BIT); |
215 | 218 | ||
diff --git a/arch/mips/math-emu/sp_maddf.c b/arch/mips/math-emu/sp_maddf.c index a8cd8b4f235e..c91d5e5d9b5f 100644 --- a/arch/mips/math-emu/sp_maddf.c +++ b/arch/mips/math-emu/sp_maddf.c | |||
@@ -54,7 +54,7 @@ static union ieee754sp _sp_maddf(union ieee754sp z, union ieee754sp x, | |||
54 | return ieee754sp_nanxcpt(z); | 54 | return ieee754sp_nanxcpt(z); |
55 | case IEEE754_CLASS_DNORM: | 55 | case IEEE754_CLASS_DNORM: |
56 | SPDNORMZ; | 56 | SPDNORMZ; |
57 | /* QNAN is handled separately below */ | 57 | /* QNAN and ZERO cases are handled separately below */ |
58 | } | 58 | } |
59 | 59 | ||
60 | switch (CLPAIR(xc, yc)) { | 60 | switch (CLPAIR(xc, yc)) { |
@@ -203,6 +203,9 @@ static union ieee754sp _sp_maddf(union ieee754sp z, union ieee754sp x, | |||
203 | } | 203 | } |
204 | assert(rm & (SP_HIDDEN_BIT << 3)); | 204 | assert(rm & (SP_HIDDEN_BIT << 3)); |
205 | 205 | ||
206 | if (zc == IEEE754_CLASS_ZERO) | ||
207 | return ieee754sp_format(rs, re, rm); | ||
208 | |||
206 | /* And now the addition */ | 209 | /* And now the addition */ |
207 | 210 | ||
208 | assert(zm & SP_HIDDEN_BIT); | 211 | assert(zm & SP_HIDDEN_BIT); |