From mboxrd@z Thu Jan 1 00:00:00 1970 From: Will Deacon Subject: Re: [PATCH v2] arm64: Add ASM modifier for xN register operands Date: Fri, 28 Apr 2017 15:47:45 +0100 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-Transfer-Encoding: 7bit Cc: KVM devel mailing list , Marc Zyngier , Catalin Marinas , "linux-kernel@vger.kernel.org" , Greg Hackmann , Michael Davidson , Grant Grundler , Matthias Kaehlcke , "linux-arm-kernel@lists.infradead.org" , Tejun Heo , Paolo Bonzini , Christoph Lameter , "kvmarm@lists.cs.columbia.edu" To: Ard Biesheuvel Return-path: Content-Disposition: inline In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kvmarm-bounces@lists.cs.columbia.edu Sender: kvmarm-bounces@lists.cs.columbia.edu List-Id: kvm.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