This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
RE: [PATCH 4/13] AArch64: Cleanup fenv implementation
- From: "Wilco Dijkstra" <wdijkstr at arm dot com>
- To: "'Carlos O'Donell'" <carlos at redhat dot com>, <libc-alpha at sourceware dot org>
- Date: Fri, 24 Oct 2014 16:27:40 +0100
- Subject: RE: [PATCH 4/13] AArch64: Cleanup fenv implementation
- Authentication-results: sourceware.org; auth=none
- References: <000e01cfeee7$99383f10$cba8bd30$ at com> <5449888D dot 9030005 at redhat dot com>
> Carlos O'Donell wrote:
> > ---
> > sysdeps/aarch64/fpu/fclrexcpt.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/sysdeps/aarch64/fpu/fclrexcpt.c b/sysdeps/aarch64/fpu/fclrexcpt.c
> > index b24f0ff..4471373 100644
> > --- a/sysdeps/aarch64/fpu/fclrexcpt.c
> > +++ b/sysdeps/aarch64/fpu/fclrexcpt.c
> > @@ -28,7 +28,7 @@ feclearexcept (int excepts)
> > excepts &= FE_ALL_EXCEPT;
> >
> > _FPU_GETFPSR (fpsr);
> > - fpsr_new = (fpsr & ~FE_ALL_EXCEPT) | (fpsr & FE_ALL_EXCEPT & ~excepts);
> > + fpsr_new = fpsr & ~excepts;
>
> OK.
>
> The logic does seem to collapse down nicely. No need to assembly the final
> fpsr_new from the two halves.
>
> Is the generated code better?
Absolutely - it saves 3 instructions. GCC understands ((X & ~Y) | (X & Y)) == X,
but it doesn't do (X & ~Y) | (X & Y & Z) -> X & (Z | ~Y). In any case the new
version is much easier to understand as you no longer have to figure out what
it is trying to achieve!
Thanks for the link btw, I know what to do in the future for trivial patches.
Patch 1-4 have been committed.
Wilco