Skip to contentSkip to conversation

MIPS: math-emu: Optimise qNaN handling in `ieee754sp_fdp'

PATCH In review Maciej W. Rozycki 1 participant 1 message Apr 3, 2015 MIPS

lore
Share & tools
lore
#0 lore raw

PATCH 28/48 MIPS: math-emu: Optimise qNaN handling in `ieee754sp_fdp'

Rewrite qNaN handling in ieee754sp_fdp' using the ieee754_class_nan' helper recently added, removing the external call to `ieee754sp_isnan' and reducing the size of code by 16 instructions or 64 bytes.

---
linux-mips-emu-sp-fdp.diff

arch/mips/math-emu/sp_fdp.c +7 -5
Index: linux/arch/mips/math-emu/sp_fdp.c
===================================================================
@@ -30,10 +30,11 @@ static inline union ieee754sp ieee754sp_
 
 union ieee754sp ieee754sp_fdp(union ieee754dp x)
 {
+	union ieee754sp y;
 	u32 rm;
 
 	COMPXDP;
-	union ieee754sp nan;
+	COMPYSP;
 
 	EXPLODEXDP;
 
@@ -46,10 +47,11 @@ union ieee754sp ieee754sp_fdp(union ieee
 		return ieee754sp_nanxcpt(ieee754sp_nan_fdp(xs, xm));
 
 	case IEEE754_CLASS_QNAN:
-		nan = ieee754sp_nan_fdp(xs, xm);
-		if (!ieee754sp_isnan(nan))
-			nan = ieee754sp_indef();
-		return nan;
+		y = ieee754sp_nan_fdp(xs, xm);
+		EXPLODEYSP;
+		if (!ieee754_class_nan(yc))
+			y = ieee754sp_indef();
+		return y;
 
 	case IEEE754_CLASS_INF:
 		return ieee754sp_inf(xs);