[Bug target/54686] std::abs (long long) resorts to std::abs (double) if llabs is absent
olegendo at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sun Sep 23 23:05:00 GMT 2012
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54686
--- Comment #20 from Oleg Endo <olegendo at gcc dot gnu.org> 2012-09-23 23:04:39 UTC ---
(In reply to comment #17)
>
> 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?
I haven't checked, but the only kind of target where this could be true is
probably something < 32 bit. Why not leave this decision up to the target
and/or middle-end abs expansion? Stuff like "return __x >= 0 ? __x : -__x;" is
recognized by the middle-end and turned into an abs RTL, if the target defines
one for the mode in question. If not it will expand into
if-then-else-something or try out some branch-free alternative.
More information about the Gcc-bugs
mailing list