public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
From: Freddie Chopin <freddie_chopin@op.pl>
To: newlib@sourceware.org
Subject: Re: RFD: selective linking of floating point support for *printf / *scanf
Date: Wed, 03 Sep 2014 20:29:00 -0000	[thread overview]
Message-ID: <54077A25.4080206@op.pl> (raw)
In-Reply-To: <540777DB.5000503@oarcorp.com>

W dniu 2014-09-03 22:19, Joel Sherrill pisze:
> I considered this approach in the past specifically for floating point
> formats. At one point in history and on some architectures, declaring
> a floating point variable on the stack of the printf() that did work would
> result in using the FPU even in a task that otherwise didn't use the FPU.[1]
> Separating this functionality into a subroutine would eliminate that.
>
> [1] With RTEMS and some other RTOSes, a task/thread can be specified
> as integer only and, if possible, we disable the FPU when that thread is
> executing. This can significantly improve context switch time but runs
> the risk of an integer only task inadvertently using the FPU. Long ago,
> on the HPPA, GCC would use FPU multiply for array index calculations
> because FP multiply was faster. That was a surprise. We have seen
> implicit use of FPU registers on at least SPARC and PowerPC since
> then at various times.
>
> DISCLAIMER: That was 20+ years of gcc and newlib history above.
> Issues come and go but an approach to save memory and avoid the
> issue is a good thing IMO. :)

I think such approach would be better than the one currently in newlib 
(printf() and iprintf()), because of the reasons you mentioned and 
because it wouldn't result in code duplication if you actually need 
both. It would be also easier to maintain - only one function instead of 
two (I know that now the functions are generated with preprocessor, but 
still).

Users could modify such modular printf anyway they like - overriding any 
__printf_handle_...() they like to keep the code size lower (;

If someone ever comes with a way to modify gcc to detect need for 
floating point it would work too (gcc/ld would select right library 
automatically), but for now I guess it's the simplest solution that has 
all the benefits and is easy to do... Plus the modularity would make 
this monstrous implementation of printf() much more readable (;

Regards,
FCh

      reply	other threads:[~2014-09-03 20:29 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-14  8:52 Joern Rennecke
2014-08-14  9:38 ` Thomas Preud'homme
2014-08-18 10:35 ` RFD: " Joey Ye
2014-10-07  7:33   ` Joern Rennecke
2014-08-26  6:48 ` Thomas Preud'homme
2014-08-26 10:43   ` Joern Rennecke
2014-08-27  7:02     ` Thomas Preud'homme
2014-08-27 10:13       ` Joern Rennecke
2014-08-27 10:41         ` Thomas Preud'homme
2014-08-27 11:54           ` Joern Rennecke
2014-08-28  5:30             ` Thomas Preud'homme
2014-08-28 13:47               ` Joern Rennecke
2014-08-29  6:04                 ` Thomas Preud'homme
2014-08-29 13:20                   ` Eric Blake
     [not found]                     ` <CALC6sNDiJ+EOjTasMj2YCQmq10mVQrZKKsaUurhjQe=Zbn435g@mail.gmail.com>
2014-08-29 16:03                       ` Eric Blake
2014-08-29 16:13                         ` Eric Blake
2014-08-30  4:27                       ` Thomas Preud'homme
2014-08-30  4:45                         ` Thomas Preud'homme
2014-09-02  7:33                         ` Joey Ye
2014-09-02  8:40                           ` Andrew Haley
2014-09-02 15:28                           ` Joseph S. Myers
2014-09-03  6:58                             ` Thomas Preud'homme
2014-09-03 19:27                             ` Joern Rennecke
2014-09-03 20:04                               ` Joseph S. Myers
2014-10-23  8:49                   ` Thomas Preud'homme
2014-10-23 15:21                     ` Joseph S. Myers
2014-10-24  8:06                       ` Thomas Preud'homme
2014-11-02 16:34                         ` Joern Rennecke
2014-11-12 18:08                           ` Thomas Preud'homme
2014-09-03 20:08 ` RFD: " Freddie Chopin
2014-09-03 20:19   ` Joel Sherrill
2014-09-03 20:29     ` Freddie Chopin [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=54077A25.4080206@op.pl \
    --to=freddie_chopin@op.pl \
    --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).