This is the mail archive of the
mailing list for the glibc project.
RE: [PATCH 4/5] ARM: Cleanup fenv implementation
- From: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: Wilco <wdijkstr at arm dot com>
- Cc: GNU C Library <libc-alpha at sourceware dot org>
- Date: Wed, 11 Jun 2014 17:13:25 +0000
- Subject: RE: [PATCH 4/5] ARM: Cleanup fenv implementation
- Authentication-results: sourceware.org; auth=none
- References: <003a01cf84cd$71cc24c0$55646e40$ at com> <Pine dot LNX dot 4 dot 64 dot 1406101724030 dot 8581 at digraph dot polyomino dot org dot uk> <004201cf8578$de78c460$9b6a4d20$ at com>
On Wed, 11 Jun 2014, Wilco wrote:
> Joseph wrote:
> > On Tue, 10 Jun 2014, Wilco wrote:
> > > This is a series of patches which improves the ARM fenv implementation.
> > > Improve rounding mode check in libc_fesetround_vfp and
> > > libc_feholdsetround_vfp so it ignores out of range values.
> > I don't see this as an improvement. Invalid rounding modes should never
> > get here, and it's confusing to change a variable called "round" to
> > something other than the rounding mode.
> It's not only safer (for the unlikely case where you pass an incorrect
> rounding mode) but also faster as it saves an instruction and enables the use
> of CBZ. Note the AAarch64 version is exactly the same.
But this is an internal function that should never be able to receive an
invalid rounding mode (if necessary, the caller, e.g. fesetround, should
check), and the compiler should be able to see at each call site that only
valid rounding modes can get there. If the two don't generate the same
code for some caller, then that suggests a microoptimization issue to be
addressed in GCC.
> Maybe naming it "round_adjust" or "round_diff" would make it clearer?
Ordinary C usage would be "if (A != B)" not "if ((A ^ B) != 0)". It's the
compiler's job to convert the former into the latter if that's the best
code sequence on a particular processor; the former is more idiomatic for
humans, and gives the compiler just as much information, so is to be
Joseph S. Myers