[Bug target/54686] std::abs (long long) resorts to std::abs (double) if llabs is absent
glisse at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sun Sep 23 22:55:00 GMT 2012
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54686
--- Comment #17 from Marc Glisse <glisse at gcc dot gnu.org> 2012-09-23 22:54:47 UTC ---
(In reply to comment #15)
> Ok... thanks Marc for handling this. If we could handle in the same way
> div(long long, long long), it would be great and more consistent. Are we sure
> we can't?
It needs lldiv_t.
> Also, too bad that we don't use llabs (and lldiv) as implementation details
> when safe, it would be more consistent with the long overloads. I seemed to
> remember that we were already doing that.
I was a bit surprised to see that indeed.
For llabs: why bother, it isn't like there is anything fancy llabs could be
doing. Is the point that with -Os, a call to llabs is slightly shorter than an
inlined version? We could use llabs when safe, it's just more macros...
For lldiv: glibc's implementation does more than a simple / and % (the behavior
of div with negative numbers is more strictly standardized than that of / and
%, so on some platforms the adjustment may be needed, but I don't know if such
platforms are still used). On the other hand, gcc doesn't have a builtin for
it, so if we call lldiv, it can never be inlined.
More information about the Gcc-bugs
mailing list