public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
From: Richard Allen <rsaxvc@rsaxvc.net>
To: newlib@sourceware.org
Subject: Re: [PATCH] Avoid extra float->double conversion
Date: Thu, 18 May 2017 23:58:00 -0000	[thread overview]
Message-ID: <CAMY0PLXr=yjJ0mx1-eAEjYZGqQyKDJ=OUQhdUoVxSLTjsHsPAg@mail.gmail.com> (raw)
In-Reply-To: <CAMY0PLVybxoyVwUdsA4zzN1cpffDLBeNKXDAr=pnDTicXpuG0A@mail.gmail.com>

> And just wondering, did you check all of the "f" functions?

I did finally go through the rest of the "f" functions. The
remaining float->double conversions are needed to support
matherr(). mathfp has extra float->double conversions
that should be fixed later, as part of fixing up mathfp.

Is there anything to do before merging this patch?


On Fri, Apr 21, 2017 at 8:30 AM, Richard Allen <rsaxvc@rsaxvc.net> wrote:
>> And just wondering, did you check all of the "f" functions?  (I'd guess so
>> since your 0/0 patch edits multiple files, but better to know for sure.)
>> It would not be at all surprising if others (or even all) of the f forms had
>> the same flaw.
>
> Several of the "f" functions do similar things, mostly compares, but a few
> arithmetic operations. This patch lets my particular project remove rint() at
> link time. There will be a few more patches for those. There's also a few spots
> where some operations are duplicated in if/elses, not sure if I'll go
> after those.
> Eventually, I'd like to get mathfp back up and running, but that's going to be a
> much larger effort.
>
>> This is better than the first one, with the catch on the constants. Have you
>> checked what was linked to be certain that no other double things are still
>> there?  (Perhaps easier than inspecting the source.)
>
> The only float->double and double->float conversions remaining
> are in the error handling when moving to/from exc.retval, exc.arg1, and
> exc.arg2.
>
>> To be the most gung-ho, isnan() should be isnanf() throughout--saves a
>> conversion and might avoid a double function being linked.  (It seems odd
>> that it does have isfinitef(), but not isnanf().)
>
> In C99, isnan() became template-ey, and acts like a macro. newlib
> implements it with __builtin_isnan(), which GCC inlines. Calling
> isnanf() results in a function call, so I didn't change those.
>
> -Richard

      reply	other threads:[~2017-05-18 23:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-19 23:53 Richard Allen
2017-04-20  0:03 ` Richard Allen
2017-04-20  0:36   ` Craig Howland
2017-04-21 13:30     ` Richard Allen
2017-05-18 23:58       ` Richard Allen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAMY0PLXr=yjJ0mx1-eAEjYZGqQyKDJ=OUQhdUoVxSLTjsHsPAg@mail.gmail.com' \
    --to=rsaxvc@rsaxvc.net \
    --cc=newlib@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).