From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?iso-8859-1?Q?M=E5ns_Rullg=E5rd?= Subject: Re: [PATCH v2 2/2] ARM: Replace calls to __aeabi_{u}idiv with udiv/sdiv instructions Date: Thu, 26 Nov 2015 00:50:08 +0000 Message-ID: References: <1448488264-23400-1-git-send-email-sboyd@codeaurora.org> <1448488264-23400-3-git-send-email-sboyd@codeaurora.org> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: QUOTED-PRINTABLE Return-path: In-Reply-To: (Nicolas Pitre's message of "Wed, 25 Nov 2015 19:44:50 -0500 (EST)") Sender: linux-kbuild-owner@vger.kernel.org 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 List-Id: linux-arm-msm@vger.kernel.org Nicolas Pitre writes: > On Thu, 26 Nov 2015, M=E5ns Rullg=E5rd wrote: > >> Nicolas Pitre writes: >>=20 >> > 3) In fact I was wondering if the overhead of the branch and back = is=20 >> > really significant compared to the non trivial cost of a idiv=20 >> > instruction and all the complex infrastructure required to patc= h=20 >> > those branches directly, and consequently if the performance=20 >> > difference is actually worth it versus simply doing (2) alone. >>=20 >> 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 w= ith=20 > about 5 simple ALU instructions depending on the operands. > > The average cycle count is more important than the easy-way-out case.= =20 > And then how significant the two branches around it are compared to i= div=20 > 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. --=20 M=E5ns Rullg=E5rd mans@mansr.com -- To unsubscribe from this list: send the line "unsubscribe linux-kbuild"= in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html