From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1426219AbdD1OsD (ORCPT ); Fri, 28 Apr 2017 10:48:03 -0400 Received: from foss.arm.com ([217.140.101.70]:49968 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1423862AbdD1Orq (ORCPT ); Fri, 28 Apr 2017 10:47:46 -0400 Date: Fri, 28 Apr 2017 15:47:45 +0100 From: Will Deacon To: Ard Biesheuvel Cc: Mark Rutland , Matthias Kaehlcke , Catalin Marinas , Christoffer Dall , Marc Zyngier , Paolo Bonzini , Radim =?utf-8?B?S3LEjW3DocWZ?= , Tejun Heo , Christoph Lameter , Vladimir Murzin , "linux-arm-kernel@lists.infradead.org" , "kvmarm@lists.cs.columbia.edu" , KVM devel mailing list , "linux-kernel@vger.kernel.org" , Grant Grundler , Greg Hackmann , Michael Davidson Subject: Re: [PATCH v2] arm64: Add ASM modifier for xN register operands Message-ID: <20170428144745.GR13675@arm.com> References: <20170426214616.142580-1-mka@chromium.org> <20170427110256.GC31337@leverpostej> <20170427225221.GS128305@google.com> <20170428143333.GA5292@leverpostej> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 28, 2017 at 03:43:56PM +0100, Ard Biesheuvel wrote: > On 28 April 2017 at 15:33, Mark Rutland wrote: > > On Fri, Apr 28, 2017 at 08:18:52AM +0100, Ard Biesheuvel wrote: > OK, good. That is a departure from previous behavior of Clang, which > was causing build errors before due to the fact that msr/mrs > instructions involving 32-bit values must still use x registers. > > > * If an operand type is 64 bits in size, clang will not produce a warning > > regarding the operand size. > > > > * If an x or w modifier is used, clang will not produce a warning > > regarding the operand size, regardless of whether it matches the > > register size. Clang is happy for %wN to be used on a pointer type. > > > > * If an operand type is less than 64 bits in size, and neither an x or > > w modifier is used, clang will produce a warning as above. > > > > * If an operand type is greater than 64 bits in size, clang encounters > > an internal error. > > > > Given that, I think we *should not* use the x modifier to suppress this > > warning, as I think for those cases we have a potential bug as outlined > > in my prior reply. > > > > Instead, we should use a temporary 64-bit variable (or cast input > > operands to 64-bit), which avoids that and makes clang happy. > > > > Yes, I think that makes sense. Likewise, we could even raise a feature request against GCC because these warnings actually sound useful. Thanks for getting to the bottom of this. Will