From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14104 invoked by alias); 23 Sep 2012 23:05:06 -0000 Received: (qmail 13846 invoked by uid 48); 23 Sep 2012 23:04:40 -0000 From: "olegendo at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/54686] std::abs (long long) resorts to std::abs (double) if llabs is absent Date: Sun, 23 Sep 2012 23:05:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: olegendo at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2012-09/txt/msg01898.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54686 --- Comment #20 from Oleg Endo 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.