From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 076243861032; Tue, 20 Oct 2020 10:40:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 076243861032 From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/97445] Some fonctions marked static inline in Linux kernel are not inlined Date: Tue, 20 Oct 2020 10:40:48 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: 10.1.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Oct 2020 10:40:49 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D97445 --- Comment #33 from Jakub Jelinek --- (In reply to Jan Hubicka from comment #32) > get_order is a wrapper around ffs64. This can be implemented w/o asm > statement as follows: > int > my_fls64 (__u64 x) > { > if (!x) > return 0; > return 64 - __builtin_clzl (x); > } >=20 > This results in longer assembly than the kernel asm implementation. If > that matters I would replace builtin_constnat_p part of get_order by this > implementation that is more transparent to the code size estimation and > things will get inlined. Better __builtin_clzll so that it works also on 32-bit arches. Anyway, if kernel's fls64 results in better code than the my_fls64, we shou= ld look at GCC's code generation for that case. And, perhaps kernel's const_ilog2 should be reimplemented using __builtin_c= lz*? Or, maybe even better, keep const_ilog2 as is because as it is declared it should be usable even in pedantic C constant expressions, and just change i= log2 to: #define ilog2(n) \ ( \ __builtin_constant_p(n) ? \ ((n) < 2 ? 0 : 63 - __builtin_clzll (n)) : \ (sizeof(n) <=3D 4) ? \ __ilog2_u32(n) : \ __ilog2_u64(n) \ )=