From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 634DCC433DB for ; Tue, 30 Mar 2021 10:01:48 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E19A561996 for ; Tue, 30 Mar 2021 10:01:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E19A561996 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=wCKibvSzRfWixzMqmcZmgxC6Qr5mCDz7G74DIzbUFmg=; b=nK7PGCPuU2yjbyuuBdHYzhVPC u//EAATjZcxmmXgUz+ka0oj4IFTEgQxeaDvTIJ4QsxPMwBphb5PeaWJahB4L+7Tuj99PvdPctzZNV I33QRCRqBCRgMwtHm9od8nlNOXwthbJ8WWGQxw2q/rNdb8Eh/7Zt9vUYVmsAuLDQGyvC01SUNNEXd HbHdBc3Uv0DGZK21Xo3dJkfy5pPhrW2gS8+wqUCU9hOLbUgp0pxG7M4W43s19UtrxqZj37QqKZvPO qIHC6l5rkfzwakzvwSXbPY7Z7py3z6fEhX/QG56neHwXGJAq1xvDNIvgszoXHLJvkfripW5DknpTm lt9QTykaQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lRBAC-003KGp-0k; Tue, 30 Mar 2021 09:59:58 +0000 Received: from mail.kernel.org ([198.145.29.99]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lRBA5-003KFl-Fe for linux-arm-kernel@lists.infradead.org; Tue, 30 Mar 2021 09:59:52 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 932D86191D; Tue, 30 Mar 2021 09:59:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1617098387; bh=WOcvGRY7a4j1mwA7iHz+r3yfCYo8kr8XRVh6nIOgYio=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=BY98ydOAxCiz9jsrfUDPPqvwwhdOScGUK1tzr2muVpAxAszPhjkB048I6RmK9jtR+ LvOwQTyIwXvAZKMCElJ5zQ617/UO+Gsny2n8zr2F1r5xKcg3MDnGu1RIzdoMAF8H8V 8izaivrw161Zpx48WX3k1hQLGy4jFZgtsdcZKwlXpR1Ld8W//sjAehmcbGnEi2Rir2 RSEzJvLwFtTg0MXkt8ibLMUgWADWN1mXzyXhwv2MxJkNZPJ4QMSGgzNoJPePOUAre9 JunnqAlpxBsUfb/KhkdJlHI+TIJtNzFEzMh7FngMVHsfYnL0XE/Tan73qjlSM2/rJ4 ruWICFbWU8aEg== Date: Tue, 30 Mar 2021 10:59:42 +0100 From: Will Deacon To: Ard Biesheuvel Cc: linux-crypto@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Dave Martin , Mark Brown , Herbert Xu , Eric Biggers , Catalin Marinas , Thomas Gleixner , Peter Zijlstra , Sebastian Andrzej Siewior , Ingo Molnar , Andy Lutomirski Subject: Re: [PATCH v2 2/9] arm64: assembler: introduce wxN aliases for wN registers Message-ID: <20210330095941.GB5352@willie-the-truck> References: <20210302090118.30666-1-ardb@kernel.org> <20210302090118.30666-3-ardb@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210302090118.30666-3-ardb@kernel.org> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210330_105950_467252_A9CE7F12 X-CRM114-Status: GOOD ( 26.93 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Mar 02, 2021 at 10:01:11AM +0100, Ard Biesheuvel wrote: > The AArch64 asm syntax has this slightly tedious property that the names > used in mnemonics to refer to registers depend on whether the opcode in > question targets the entire 64-bits (xN), or only the least significant > 8, 16 or 32 bits (wN). When writing parameterized code such as macros, > this can be annoying, as macro arguments don't lend themselves to > indexed lookups, and so generating a reference to wN in a macro that > receives xN as an argument is problematic. > > For instance, an upcoming patch that modifies the implementation of the > cond_yield macro to be able to refer to 32-bit registers would need to > modify invocations such as > > cond_yield 3f, x8 > > to > > cond_yield 3f, 8 > > so that the second argument can be token pasted after x or w to emit the > correct register reference. Unfortunately, this interferes with the self > documenting nature of the first example, where the second argument is > obviously a register, whereas in the second example, one would need to > go and look at the code to find out what '8' means. > > So let's fix this by defining wxN aliases for all xN registers, which > resolve to the 32-bit alias of each respective 64-bit register. This > allows the macro implementation to paste the xN reference after a w to > obtain the correct register name. > > Signed-off-by: Ard Biesheuvel > --- > arch/arm64/include/asm/assembler.h | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/arch/arm64/include/asm/assembler.h b/arch/arm64/include/asm/assembler.h > index e0fc1d424f9b..7b076ccd1a54 100644 > --- a/arch/arm64/include/asm/assembler.h > +++ b/arch/arm64/include/asm/assembler.h > @@ -23,6 +23,14 @@ > #include > #include > > + /* > + * Provide a wxN alias for each wN register so what we can paste a xN > + * reference after a 'w' to obtain the 32-bit version. > + */ > + .irp n,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30 > + wx\n .req w\n > + .endr That's a pretty neat hack! I remember seeing code elsewhere which would benefit from this, so might be worth a look at our other macros as I'm sure I got annoyed by one the other day... ah yes, the SVE macros in fpsimdmacros.h Acked-by: Will Deacon Will _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel