a2cf7d
commit 7b8481b330720d28c019a2e5994492a1923d5daa
a2cf7d
Author: Paul A. Clarke <pc@us.ibm.com>
a2cf7d
Date:   Thu Sep 19 11:11:04 2019 -0500
a2cf7d
a2cf7d
    [powerpc] No need to enter "Ignore Exceptions Mode"
a2cf7d
    
a2cf7d
    Since at least POWER8, there is no performance advantage to entering
a2cf7d
    "Ignore Exceptions Mode", and doing so conditionally requires
a2cf7d
     - the conditional logic, and
a2cf7d
     - a system call.
a2cf7d
    
a2cf7d
    Make it a no-op for uses within glibc.
a2cf7d
a2cf7d
diff --git a/sysdeps/powerpc/fpu/fenv_private.h b/sysdeps/powerpc/fpu/fenv_private.h
a2cf7d
index 666fbfdd9fef7759..e09137e892a8e3f3 100644
a2cf7d
--- a/sysdeps/powerpc/fpu/fenv_private.h
a2cf7d
+++ b/sysdeps/powerpc/fpu/fenv_private.h
a2cf7d
@@ -23,6 +23,17 @@
a2cf7d
 #include <fenv_libc.h>
a2cf7d
 #include <fpu_control.h>
a2cf7d
 
a2cf7d
+#ifdef _ARCH_PWR8
a2cf7d
+/* There is no performance advantage to non-stop mode.  */
a2cf7d
+/* The odd syntax here is to innocuously reference the given variables
a2cf7d
+   to prevent warnings about unused variables.  */
a2cf7d
+#define __TEST_AND_BEGIN_NON_STOP(old, new) do {} while ((old) * (new) * 0 != 0)
a2cf7d
+#define __TEST_AND_END_NON_STOP(old, new) do {} while ((old) * (new) * 0 != 0)
a2cf7d
+#else
a2cf7d
+#define __TEST_AND_BEGIN_NON_STOP __TEST_AND_ENTER_NON_STOP
a2cf7d
+#define __TEST_AND_END_NON_STOP __TEST_AND_EXIT_NON_STOP
a2cf7d
+#endif
a2cf7d
+
a2cf7d
 static __always_inline void
a2cf7d
 libc_feholdexcept_setround_ppc (fenv_t *envp, int r)
a2cf7d
 {
a2cf7d
@@ -30,7 +41,7 @@ libc_feholdexcept_setround_ppc (fenv_t *envp, int r)
a2cf7d
 
a2cf7d
   old.fenv = *envp = fegetenv_register ();
a2cf7d
 
a2cf7d
-  __TEST_AND_ENTER_NON_STOP (old.l, 0ULL);
a2cf7d
+  __TEST_AND_BEGIN_NON_STOP (old.l, 0ULL);
a2cf7d
 
a2cf7d
   /* Clear everything and set the rounding mode.  */
a2cf7d
   new.l = r;
a2cf7d
@@ -49,8 +60,8 @@ __libc_femergeenv_ppc (const fenv_t *envp, unsigned long long old_mask,
a2cf7d
   /* Merge bits while masking unwanted bits from new and old env.  */
a2cf7d
   new.l = (old.l & old_mask) | (new.l & new_mask);
a2cf7d
 
a2cf7d
-  __TEST_AND_EXIT_NON_STOP (old.l, new.l);
a2cf7d
-  __TEST_AND_ENTER_NON_STOP (old.l, new.l);
a2cf7d
+  __TEST_AND_END_NON_STOP (old.l, new.l);
a2cf7d
+  __TEST_AND_BEGIN_NON_STOP (old.l, new.l);
a2cf7d
 
a2cf7d
   /* If requesting to keep status, replace control, and merge exceptions,
a2cf7d
      and exceptions haven't changed, we can just set new control instead
a2cf7d
@@ -141,7 +152,7 @@ libc_feholdsetround_noex_ppc_ctx (struct rm_ctx *ctx, int r)
a2cf7d
   ctx->env = old.fenv;
a2cf7d
   if (__glibc_unlikely (new.l != old.l))
a2cf7d
     {
a2cf7d
-      __TEST_AND_ENTER_NON_STOP (old.l, 0ULL);
a2cf7d
+      __TEST_AND_BEGIN_NON_STOP (old.l, 0ULL);
a2cf7d
       fesetenv_control (new.fenv);
a2cf7d
       ctx->updated_status = true;
a2cf7d
     }