[PATCH] [powerpc] SET_RESTORE_ROUND optimizations and bug fix

Paul E Murphy murphyp@linux.ibm.com
Wed Sep 11 21:26:00 GMT 2019



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)
>>> +#else
>>> +/* '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;                                \
>>> +  })
>>> +#endif
> 
>> 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.



More information about the Libc-alpha mailing list