This is the mail archive of the mailing list for the glibc project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] [powerpc] SET_RESTORE_ROUND optimizations and bug fix

On 9/11/19 3:34 PM, Paul Clarke wrote:
On 9/10/19 5:06 PM, Paul E Murphy wrote:
On 9/10/19 1:15 PM, Paul A. Clarke wrote:
+/* Like fegetenv_status, but also sets the rounding mode.  */
+#ifdef _ARCH_PWR9
+#define fegetenv_and_set_rn(rn) __fe_mffscrn (rn)
+/* 'mffscrn' will decode to 'mffs' on ARCH < 3_00, which is still necessary
+   but not sufficient, because it does not set the rounding mode.
+   Explicitly set the rounding mode when 'mffscrn' actually doesn't.  */
+#define fegetenv_and_set_rn(rn)                        \
+  ({register fenv_union_t __fr;                        \
+    __fr.fenv = __fe_mffscrn (rn);                    \
+    if (__glibc_unlikely (!(GLRO(dl_hwcap2) & PPC_FEATURE2_ARCH_3_00)))    \
+      __fesetround_inline (rn);                        \
+    __fr.fenv;                                \
+  })

Is the conditional code faster than unconditionally calling __fesetround_inline?

My measurements indicate that unconditionally calling _fesetround_inline is a bit slower than with the condition (on POWER9, where the condition will always fail).

OK, thanks. LGTM.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]