Commit bd267a53 authored by Maciej W. Rozycki's avatar Maciej W. Rozycki Committed by Ralf Baechle

MIPS: math-emu: Remove redundant code from NaN comparison

Remove a redundant call to `ieee754_setandtestcx' in `ieee754sp_cmp' and
`ieee754dp_cmp'.  The IEEE 754 exception requested will have already
been set by a call to `ieee754_setcx' immediately above, because `sig'
has to be non-zero to reach here, and the comparison result returned
will be 0 regardless of the result from the call.  Simplify the return
expression remaining.  All this reducing the size of code by 16 and 12
instructions or 64 and 48 bytes respectively.
Signed-off-by: default avatarMaciej W. Rozycki <macro@linux-mips.org>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/9690/Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
parent c9a10845
...@@ -39,13 +39,7 @@ int ieee754dp_cmp(union ieee754dp x, union ieee754dp y, int cmp, int sig) ...@@ -39,13 +39,7 @@ int ieee754dp_cmp(union ieee754dp x, union ieee754dp y, int cmp, int sig)
if (sig || if (sig ||
xc == IEEE754_CLASS_SNAN || yc == IEEE754_CLASS_SNAN) xc == IEEE754_CLASS_SNAN || yc == IEEE754_CLASS_SNAN)
ieee754_setcx(IEEE754_INVALID_OPERATION); ieee754_setcx(IEEE754_INVALID_OPERATION);
if (cmp & IEEE754_CUN) return (cmp & IEEE754_CUN) != 0;
return 1;
if (cmp & (IEEE754_CLT | IEEE754_CGT)) {
if (sig && ieee754_setandtestcx(IEEE754_INVALID_OPERATION))
return 0;
}
return 0;
} else { } else {
vx = x.bits; vx = x.bits;
vy = y.bits; vy = y.bits;
......
...@@ -39,13 +39,7 @@ int ieee754sp_cmp(union ieee754sp x, union ieee754sp y, int cmp, int sig) ...@@ -39,13 +39,7 @@ int ieee754sp_cmp(union ieee754sp x, union ieee754sp y, int cmp, int sig)
if (sig || if (sig ||
xc == IEEE754_CLASS_SNAN || yc == IEEE754_CLASS_SNAN) xc == IEEE754_CLASS_SNAN || yc == IEEE754_CLASS_SNAN)
ieee754_setcx(IEEE754_INVALID_OPERATION); ieee754_setcx(IEEE754_INVALID_OPERATION);
if (cmp & IEEE754_CUN) return (cmp & IEEE754_CUN) != 0;
return 1;
if (cmp & (IEEE754_CLT | IEEE754_CGT)) {
if (sig && ieee754_setandtestcx(IEEE754_INVALID_OPERATION))
return 0;
}
return 0;
} else { } else {
vx = x.bits; vx = x.bits;
vy = y.bits; vy = y.bits;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment