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