From 960ba7975cf05b2466ed793f6a1ee4bffb205b9d Mon Sep 17 00:00:00 2001 From: Stan Shebs Date: Wed, 26 Sep 2018 14:44:39 -0700 Subject: [PATCH] Work around mtfsb0 syntax limitation with clang --- sysdeps/powerpc/powerpc64/fpu/s_nearbyint.S | 8 ++++++++ sysdeps/powerpc/powerpc64/fpu/s_nearbyintf.S | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/sysdeps/powerpc/powerpc64/fpu/s_nearbyint.S b/sysdeps/powerpc/powerpc64/fpu/s_nearbyint.S index 7d89e78f880..27020c92ed9 100644 --- a/sysdeps/powerpc/powerpc64/fpu/s_nearbyint.S +++ b/sysdeps/powerpc/powerpc64/fpu/s_nearbyint.S @@ -42,7 +42,11 @@ ENTRY (__nearbyint, 4) fcmpu cr7,fp1,fp12 /* if (x > 0.0) */ ble cr7, L(lessthanzero) mffs fp11 +#if defined __clang__ + mtfsb0 31 /* Disable FE_INEXACT exception */ +#else mtfsb0 4*cr7+lt /* Disable FE_INEXACT exception */ +#endif fadd fp1,fp1,fp13 /* x+= TWO52 */ fsub fp1,fp1,fp13 /* x-= TWO52 */ fabs fp1,fp1 /* if (x == 0.0) */ @@ -51,7 +55,11 @@ ENTRY (__nearbyint, 4) L(lessthanzero): bgelr cr7 /* if (x < 0.0) */ mffs fp11 +#if defined __clang__ + mtfsb0 31 +#else mtfsb0 4*cr7+lt +#endif fsub fp1,fp1,fp13 /* x -= TWO52 */ fadd fp1,fp1,fp13 /* x += TWO52 */ fnabs fp1,fp1 /* if (x == 0.0) */ diff --git a/sysdeps/powerpc/powerpc64/fpu/s_nearbyintf.S b/sysdeps/powerpc/powerpc64/fpu/s_nearbyintf.S index 4b62ba1e8d5..0522b1058b2 100644 --- a/sysdeps/powerpc/powerpc64/fpu/s_nearbyintf.S +++ b/sysdeps/powerpc/powerpc64/fpu/s_nearbyintf.S @@ -43,7 +43,11 @@ ENTRY (__nearbyintf, 4) fcmpu cr7,fp1,fp12 /* if (x > 0.0) */ ble cr7, L(lessthanzero) mffs fp11 +#if defined __clang__ + mtfsb0 31 /* Disable FE_INEXACT exception */ +#else mtfsb0 4*cr7+lt /* Disable FE_INEXACT exception */ +#endif fadds fp1,fp1,fp13 /* x += TWO23 */ fsubs fp1,fp1,fp13 /* x -= TWO23 */ fabs fp1,fp1 /* if (x == 0.0) */ @@ -52,7 +56,11 @@ ENTRY (__nearbyintf, 4) L(lessthanzero): bgelr cr7 /* if (x < 0.0) */ mffs fp11 +#if defined __clang__ + mtfsb0 31 /* Disable FE_INEXACT exception */ +#else mtfsb0 4*cr7+lt /* Disable FE_INEXACT exception */ +#endif fsubs fp1,fp1,fp13 /* x -= TWO23 */ fadds fp1,fp1,fp13 /* x += TWO23 */ fnabs fp1,fp1 /* if (x == 0.0) */ -- 2.47.2