This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: libm -fno-builtin


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]