Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp503150img; Mon, 18 Mar 2019 07:56:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqxNsvucW6wVcykD/Je5aHAVquiciQbExlWcymB1Kva98kCpXPAWrJ8qCZmuLX0HB11wrEcA X-Received: by 2002:a63:4542:: with SMTP id u2mr17782035pgk.291.1552920972179; Mon, 18 Mar 2019 07:56:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552920972; cv=none; d=google.com; s=arc-20160816; b=OcpEeluwCS3soVFGhkHvZw3q/oeboSoqNWUL1OfOR7z5ibXlxSARK13Qm+fiDHvF2q FILr2e7lzzqodpMWMShPxJwVre2W88h2vFLZ4lPBTRx1yq2D6UGfG9GaBIE65oyTOeO3 qNuKGLVASBdK3uPL84sCU2cnvkXg7yuHoR6wKq+Z147vgHyU+pp3RN8C6Rlkl5GHXPlo OPv7wXC00HNnBxH/TQ3b/JZ+0+gcZ6TDHwWb2ylWL70rBMtnY+HAeq8o/HYcegP7eJ8i rNT7IU2VZrd5xvUyoPsJqgMCrPo45G95ulvCt0LAieId9v03u7KX5J3i9SejbyRpZVpZ hzmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=DveGjV7VlNIt6I9Qj4f1jQT9M6xmzD8Nsl/pc6btbd0=; b=Cl+FUPRwON/1LY/dTpxYcpFLFJamIFhU67ullXYNFWDL23RMgBnpLHT2UKF4nh4wsk X4wlypibF0BSWDx3Y9VcRAvNTL2wNop5Dl9fNbAhgUSEmQcjvENmhQnTjVauDtY5qZLB zkFFxqZOhzBsxSlpLkkwfPySJmN/m3TiEb3n0gtuJz9pa08crD3pctoRTOVTVKNwAcxN 1yXlnM4UeAdxAZJ1XDqUxSRo72IhZT1ZpmdmIVivxhieTfHHt0/puldFVHAROFPE19sS inu6mU0RMJGA3isXFJa6QMJFvo3KbTgJ/mqF7JMdpajnHsKDLydId47dSFd+4xCimv63 dy/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=2H4yOUMM; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p188si7628739pfp.123.2019.03.18.07.55.56; Mon, 18 Mar 2019 07:56:12 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=2H4yOUMM; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726868AbfCROzQ (ORCPT + 99 others); Mon, 18 Mar 2019 10:55:16 -0400 Received: from merlin.infradead.org ([205.233.59.134]:57858 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726677AbfCROzQ (ORCPT ); Mon, 18 Mar 2019 10:55:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=DveGjV7VlNIt6I9Qj4f1jQT9M6xmzD8Nsl/pc6btbd0=; b=2H4yOUMM3xxSTNR8eLH1gQKtG WnRYGNBxhBTtPl7VbjNkm8HNiwmHBxM1uUyJAdBQGic0ByeVSqIoDYL/nc+qJ1nJOutiTkl0Q+rVE Lu4qrsBOp0JioXt8vyoTxdOIbFQ5Fi5ucWxcJmBfbZJpfSTJc4vy63KfkZ1ngUX29iuGm2uZatnVh hyUFVsndQq/7k2VxSjwXUG/F12NlFR+jcdLD2UYNtkxi1+34FIb2JnoUoCdqjM2E4fzIgHT9C8M0z ECuQzdqTBfJNX2SyCgITzsabdqdaub+iMdu+EwanyLbL6FnYemGbbt7iKqWbd4nSyQUiFDFyIGRtC KfOHqUK3A==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1h5tfE-0004QW-OB; Mon, 18 Mar 2019 14:54:57 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id EF69D2030E114; Mon, 18 Mar 2019 15:54:54 +0100 (CET) Date: Mon, 18 Mar 2019 15:54:54 +0100 From: Peter Zijlstra To: David Laight Cc: Nick Desaulniers , Matthias Kaehlcke , Andy Lutomirski , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H . Peter Anvin" , "x86@kernel.org" , LKML , Manoj Gupta , Tiancong Wang , Stephen Hines , "clang-built-linux@googlegroups.com" , Miguel Ojeda Subject: Re: [PATCH] lib: Add shared copy of __lshrti3 from libgcc Message-ID: <20190318145454.GS6058@hirez.programming.kicks-ass.net> References: <20190318091428.GI6058@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 18, 2019 at 02:43:41PM +0000, David Laight wrote: > From: Peter Zijlstra > > Sent: 18 March 2019 09:14 > > On Fri, Mar 15, 2019 at 03:06:37PM -0700, Nick Desaulniers wrote: > > > On Fri, Mar 15, 2019 at 1:54 PM Matthias Kaehlcke wrote: > > > > > > > > The compiler may emit calls to __lshrti3 from the compiler runtime > > > > library, which results in undefined references: > > > > > > > > arch/x86/kvm/x86.o: In function `mul_u64_u64_shr': > > > > include/linux/math64.h:186: undefined reference to `__lshrti3' > > > > > > Looks like Clang will emit this at -Oz (but not -O2): > > > https://godbolt.org/z/w1_2YC > > > > *OMG*, what is that compiler smoking and why do we want that? > > > > It doesn't even do that for "-Os". > > I like the way it moves %edx to %ecx, then %cl to %ecx and finally %ecx back to %edx. > I'm guessing this is all made worse by the prototype containing 'char' not 'int'. > > I'm sure the register tracking gets worse in every version of gcc. This is clang, no GCC on that list comes even close to generating anything as 'brilliant' as that.