From a51bc4fe9da9f2b97877beb6692f7043f6c14a16 Mon Sep 17 00:00:00 2001 From: Paul Clarke Date: Mon, 4 Feb 2019 19:16:50 -0600 Subject: Use float in e_sqrt.c The type used within e_sqrt.c(__slow_ieee754_sqrtf) was, unnecessarily and likely inadvertently, double. float is not only appropriate, but also more efficient, avoiding the need for the compiler to emit a round-to-single-precision instruction. This is the difference in compiled code: 0000000000000000 <__ieee754_sqrtf>: 0: 2c 08 20 ec fsqrts f1,f1 - 4: 18 08 20 fc frsp f1,f1 - 8: 20 00 80 4e blr + 4: 20 00 80 4e blr (Found by Anton Blanchard.) --- sysdeps/powerpc/fpu/e_sqrtf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sysdeps/powerpc') diff --git a/sysdeps/powerpc/fpu/e_sqrtf.c b/sysdeps/powerpc/fpu/e_sqrtf.c index 65df94bb80..5d9e900005 100644 --- a/sysdeps/powerpc/fpu/e_sqrtf.c +++ b/sysdeps/powerpc/fpu/e_sqrtf.c @@ -138,7 +138,7 @@ __slow_ieee754_sqrtf (float x) float __ieee754_sqrtf (float x) { - double z; + float z; #ifdef _ARCH_PPCSQ asm ("fsqrts %0,%1\n" :"=f" (z):"f" (x)); -- cgit 1.4.1