This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
Re: libm -fno-builtin
- From: Wilco Dijkstra <Wilco dot Dijkstra at arm dot com>
- To: "freddie_chopin at op dot pl" <freddie_chopin at op dot pl>
- Cc: nd <nd at arm dot com>, "newlib at sourceware dot org" <newlib at sourceware dot org>, Jon Beniston <jon at beniston dot com>
- Date: Thu, 21 Jun 2018 13:25:18 +0000
- Subject: Re: libm -fno-builtin
- Nodisclaimer: True
- Spamdiagnosticmetadata: NSPM
- Spamdiagnosticoutput: 1:99
Freddie wrote:
> If you'd ask me, I'd remove them all (; It will be much easier to win
> the attention of the maintainers when something breaks (very unlikely)
> instead of other way aroun ("if it ain’t broke, don’t fix it").
Agreed - there aren't many cases where you actually need -fno-builtin.
For math functions an obvious candidate is fabs where a compiler could
recognize common patterns. If a target doesn't have an fabs instruction (!),
you might get a call to fabs and thus an infinite loop. I don't think this could
happen with the newlib math/fabs.c.
> Anyway - is there any automatic test that can be done for removal of
> this option, or maybe you just "manually" (or "visually") inspected
> generated assembly for some typical cases? ARM also has this option, so
> I think it would be nice to remove it.
I'd build it both ways, and check number of calls has reduced to confirm inlining
of builtins. Also check for single-instruction functions tailcalling themselves.
Note -fno-math-errno is also a good option to add for libm since it enables
more inlining. I added it to GLIBC a while back, no issues found since.
Wilco