This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [02/12] Add fesetexcept: aarch64
On Thu, 11 Aug 2016, Paul Eggert wrote:
> Thanks, that patch series looks good, though I have one minor question and/or
> quibble.
>
> > + if (fpsr != fpsr_new)
> > + _FPU_SETFPSR (fpsr_new);
>
> I assume that the 'if (fpsr != fpsr_new)' is present purely for performance
> reasons, i.e., that the code would be correct if '_FPU_SETFPSR (fpsr_new)'
> were executed unconditionally. Are practical programs likely to see a
> performance improvement because of the 'if (fpsr != fpsr_new)'? My guess is
> no, because typically programs will use fesetexcept to change settings. If my
> guess is right, I'd omit the 'if (fpsr != fpsr_new)' test, on the grounds of
> simplicity.
I'm deliberately following the fesetexceptflag implementations for each
architecture, as the most similar C99/C11 function. If those have this
optimization, then I'm including it in fesetexcept as well. Doing
otherwise would make fesetexcept for AArch64 inconsistent with all the
other <fenv.h> function implementations for AArch64, which systematically
use this optimization (either directly, or in the <fenv_private.h>
functions they call).
Similarly, when I implement fesetmode, that will have this optimization on
architectures where fesetenv does.
--
Joseph S. Myers
joseph@codesourcery.com