From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934574AbdGTKKf (ORCPT ); Thu, 20 Jul 2017 06:10:35 -0400 Received: from merlin.infradead.org ([205.233.59.134]:48584 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933320AbdGTKKd (ORCPT ); Thu, 20 Jul 2017 06:10:33 -0400 Date: Thu, 20 Jul 2017 12:10:01 +0200 From: Peter Zijlstra To: Eric Dumazet Cc: Rasmus Villemoes , Andi Kleen , Andi Kleen , akpm@linux-foundation.org, linux-kernel@vger.kernel.org, davidlohr.bueso@hp.com, rafael.j.wysocki@intel.com, lenb@kernel.org Subject: Re: [PATCH] Optimize int_sqrt for small values for faster idle Message-ID: <20170720101001.kubsvi5mpzwp3ujd@hirez.programming.kicks-ass.net> References: <1454017365-8509-1-git-send-email-andi@firstfloor.org> <87y4b4azsy.fsf@rasmusvillemoes.dk> <20160201213622.GA15302@tassilo.jf.intel.com> <87powgav0h.fsf@rasmusvillemoes.dk> <1454373398.7627.193.camel@edumazet-glaptop2.roam.corp.google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1454373398.7627.193.camel@edumazet-glaptop2.roam.corp.google.com> User-Agent: NeoMutt/20170609 (1.8.3) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Feb 01, 2016 at 04:36:38PM -0800, Eric Dumazet wrote: > On Tue, 2016-02-02 at 00:08 +0100, Rasmus Villemoes wrote: > > > Thanks. (Is there a good way to tell gcc that avg*avg is actually a > > 32x32->64 multiplication?) > > If avg is 32bit, compiler does that for you. > > u32 avg = ... > > u64 result = (u64)avg * avg; It does not in fact do that :/ See commit: 9e3d6223d209 ("math64, timers: Fix 32bit mul_u64_u32_shr() and friends")