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