From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15414 invoked by alias); 19 Dec 2012 16:40:22 -0000 Received: (qmail 15234 invoked by uid 48); 19 Dec 2012 16:39:58 -0000 From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug gcov-profile/55734] [4.8 Regression] gcov-io.c uses builtins not available in non-GCC compilers Date: Wed, 19 Dec 2012 16:40:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: gcov-profile X-Bugzilla-Keywords: build X-Bugzilla-Severity: blocker X-Bugzilla-Who: jakub at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 4.8.0 X-Bugzilla-Changed-Fields: CC 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-12/txt/msg01898.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55734 Jakub Jelinek changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #17 from Jakub Jelinek 2012-12-19 16:39:56 UTC --- I guess a problem of such approach is if not in libgcov.a and HOST_WIDE_INT is smaller than long long (or for clz even not exactly 64-bit). For popcount, I wonder why the code uses __builtin_popcountll at all, when the value is unsigned int, it should just use __builtin_popcount and I think we can safely assume that HOST_WIDE_INT is at least as wide as int. So just using either popcount_hwi or __builtin_popcount (no ll) should be fine. For clz, there is: if (v > 0) r = 63 - __builtin_clzll (v); i.e. it relies on clzll having exactly 64-bit argument. For __builtin_clzll perhaps the assumption is fine, for clz_hwi not so. So you need some extra code to implement clz_ll on top of clz_hwi if HWI is smaller than 64-bit.