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 02:19:48 +0000 Message-ID: References: <1448488264-23400-1-git-send-email-sboyd@codeaurora.org> <1448488264-23400-3-git-send-email-sboyd@codeaurora.org> <20151126012859.GX8644@n2100.arm.linux.org.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: QUOTED-PRINTABLE Return-path: In-Reply-To: <20151126012859.GX8644@n2100.arm.linux.org.uk> (Russell King's message of "Thu, 26 Nov 2015 01:28:59 +0000") Sender: linux-kbuild-owner@vger.kernel.org To: Russell King - ARM Linux Cc: Nicolas Pitre , 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, Arnd Bergmann , Steven Rostedt , Thomas Petazzoni List-Id: linux-arm-msm@vger.kernel.org Russell King - ARM Linux writes: > On Thu, Nov 26, 2015 at 12:50:08AM +0000, M=E5ns Rullg=E5rd wrote: >> If not calling the function saves an I-cache miss, the benefit can b= e >> substantial. No, I have no proof of this being a problem, but it's >> something that could happen. > > That's a simplistic view of modern CPUs. > > As I've already said, modern CPUs which have branch prediction, but > they also have speculative instruction fetching and speculative data > prefetching - which the CPUs which have idiv support will have. > > With such features, the branch predictor is able to learn that the > branch will be taken, and because of the speculative instruction > fetching, it can bring the cache line in so that it has the > instructions it needs with minimal or, if working correctly, > without stalling the CPU pipeline. It doesn't matter how many fancy features the CPU has. Executing more branches and using more cache lines puts additional pressure on those resources, reducing overall performance. Besides, the performance counters readily show that the prediction is nothing near as perfect as you seem to believe. --=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