Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752503AbbKZAuP (ORCPT ); Wed, 25 Nov 2015 19:50:15 -0500 Received: from unicorn.mansr.com ([81.2.72.234]:43505 "EHLO unicorn.mansr.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751728AbbKZAuM convert rfc822-to-8bit (ORCPT ); Wed, 25 Nov 2015 19:50:12 -0500 From: =?iso-8859-1?Q?M=E5ns_Rullg=E5rd?= To: Nicolas Pitre Cc: Stephen Boyd , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Michal Marek , linux-kbuild@vger.kernel.org, Russell King - ARM Linux , Arnd Bergmann , Steven Rostedt , Thomas Petazzoni Subject: Re: [PATCH v2 2/2] ARM: Replace calls to __aeabi_{u}idiv with udiv/sdiv instructions References: <1448488264-23400-1-git-send-email-sboyd@codeaurora.org> <1448488264-23400-3-git-send-email-sboyd@codeaurora.org> Date: Thu, 26 Nov 2015 00:50:08 +0000 In-Reply-To: (Nicolas Pitre's message of "Wed, 25 Nov 2015 19:44:50 -0500 (EST)") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1493 Lines: 37 Nicolas Pitre writes: > On Thu, 26 Nov 2015, M?ns Rullg?rd wrote: > >> Nicolas Pitre writes: >> >> > 3) In fact I was wondering if the overhead of the branch and back is >> > really significant compared to the non trivial cost of a idiv >> > instruction and all the complex infrastructure required to patch >> > those branches directly, and consequently if the performance >> > difference is actually worth it versus simply doing (2) alone. >> >> Depending on the operands, the div instruction can take as few as 3 >> cycles on a Cortex-A7. > > Even the current software based implementation can produce a result with > about 5 simple ALU instructions depending on the operands. > > The average cycle count is more important than the easy-way-out case. > And then how significant the two branches around it are compared to idiv > alone from direct patching of every call to it. If not calling the function saves an I-cache miss, the benefit can be substantial. No, I have no proof of this being a problem, but it's something that could happen. Of course, none of this is going to be as good as letting the compiler generate div instructions directly. -- M?ns Rullg?rd mans@mansr.com -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/