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=-8.3 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_MUTT autolearn=ham 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 7F6D7C48BD5 for ; Tue, 25 Jun 2019 09:36:02 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 553DD2084B for ; Tue, 25 Jun 2019 09:36:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="PHymp+JM" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 553DD2084B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-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=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject: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=gmIDLKLEYAI+G/f0wLvuJazfzxC2ekO6YkxDvV9208U=; b=PHymp+JMrCTAQE VyrtgnLjJhGJmPnI+or/QB3UvmeJW7Oyl/Ek7vzO+IsMuGVVQOBBVvS1kmtJW4VR0bmjzNYcu99qo Dz358X8J2yAkYisIWxMQEvXL6r1OvcnHdGfADx3HdUbXw15bSUX7rGZ0v5oMbqZ3iWy2DVCm9VWzP GW9gLYmFKYuAeeX4CLn07Lf0NomFwggN3LcWQCylNMEIQsiQLzdh426tOncB7/Rym4FKxcEVcS55N BzVODP+88abv8Hd3doHTTQcdd1yBQySRcdmuma5tb7YCMAHaZCvCWXSQTv7Y1wLr6ZoMplrYgiC0P GVG46V9jg7sts6evC60w==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hfhrm-000473-BM; Tue, 25 Jun 2019 09:35:54 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hfhrh-00045p-G1 for linux-arm-kernel@lists.infradead.org; Tue, 25 Jun 2019 09:35:51 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 20161360; Tue, 25 Jun 2019 02:35:46 -0700 (PDT) Received: from e103592.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D845D3F71E; Tue, 25 Jun 2019 02:35:44 -0700 (PDT) Date: Tue, 25 Jun 2019 10:35:42 +0100 From: Dave Martin To: Julien Grall Subject: Re: [RFC PATCH v2 3/8] arm64/fpsimdmacros: Allow the macro "for" to be used in more cases Message-ID: <20190625093540.GW2790@e103592.cambridge.arm.com> References: <20190613161656.20765-1-julien.grall@arm.com> <20190613161656.20765-4-julien.grall@arm.com> <20190621153241.GY2790@e103592.cambridge.arm.com> <8ba85821-3734-9e3c-5696-bc5e315a28c4@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <8ba85821-3734-9e3c-5696-bc5e315a28c4@arm.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190625_023549_641276_43A950C8 X-CRM114-Status: GOOD ( 23.78 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Anton.Kirilov@arm.com, catalin.marinas@arm.com, will.deacon@arm.com, oleg@redhat.com, zhang.lei@jp.fujitsu.com, alex.bennee@linaro.org, linux-arm-kernel@lists.infradead.org, Daniel.Kiss@arm.com Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Jun 24, 2019 at 05:10:02PM +0100, Julien Grall wrote: > Hi Dave, > > On 6/21/19 4:32 PM, Dave Martin wrote: > >On Thu, Jun 13, 2019 at 05:16:51PM +0100, Julien Grall wrote: > >>The current version of the macro "for" is only able to work when the > >>counter is used to generate registers using mnemonics. This is because > > > >[*] Is this backwards? Previously, we _can't_ substitute register > >numbers directly into proper instruction mnemonics: we have to use > >.insn with an expression to generate the opcode directly instead > >(possibly via a macro). > > Hmm, yes this is backwards. I want to s/only able/not able/. > > > > >With this change we can paste the _for number straight into human- > >readable assembler mnemonics. > > > >>gas is not able to evaluate the expression generated if used in > >>registers name (i.e x\n). > > > >Nit: maybe: "a register name" or "a register's name" > > Ok. > > > > >>Gas offers a way to evaluate macro arguments by using % in front of > >>them under the alternate macro mode [1]. > > > >This reference is obviously useful to reviewers, but I'm not sure about > >the life expectancy of such a URL. It probably belongs after the > >tearoff line rather than in the commit message. > > Sure. > > > > >>The implementation of "for" is updated to use the alternate macro mode > >>and %, so we can use the macro in more cases. As the alternate macro mode > >>may have side-effect, this is disabled when generating the body. > > > >Nit: side-effects > > > >Nit: I'd probably say "expanding the body", to be consistent with gas's > >own terminology. > > > >(These are pedantic, and inessential to fix.) > > I have fixed them :). > > > > >>While it is enough to prefix the argument of the macro "__for_body" with > >>%, the arguments of "__for" are also prefixed to get a more bearable > >>value in case of compilation error. > >> > >>[1] https://sourceware.org/binutils/docs/as/Altmacro.html > >> > >>Suggested-by: Dave Martin > >>Signed-off-by: Julien Grall > >> > >>--- > >> Changes in v2: > >> - Fix typo in the commit message > >>--- > >> arch/arm64/include/asm/fpsimdmacros.h | 10 +++++++--- > >> 1 file changed, 7 insertions(+), 3 deletions(-) > >> > >>diff --git a/arch/arm64/include/asm/fpsimdmacros.h b/arch/arm64/include/asm/fpsimdmacros.h > >>index 46843515d77b..e2ab77dd9b4f 100644 > >>--- a/arch/arm64/include/asm/fpsimdmacros.h > >>+++ b/arch/arm64/include/asm/fpsimdmacros.h > >>@@ -177,19 +177,23 @@ > >> .macro __for from:req, to:req > >> .if (\from) == (\to) > >>- _for__body \from > >>+ _for__body %\from > >> .else > >>- __for \from, (\from) + ((\to) - (\from)) / 2 > >>- __for (\from) + ((\to) - (\from)) / 2 + 1, \to > >>+ __for %\from, %((\from) + ((\to) - (\from)) / 2) > >>+ __for %((\from) + ((\to) - (\from)) / 2 + 1), %\to > >> .endif > >> .endm > >> .macro _for var:req, from:req, to:req, insn:vararg > >> .macro _for__body \var:req > >>+ .noaltmacro > >> \insn > >>+ .altmacro > >> .endm > >>+ .altmacro > >> __for \from, \to > >>+ .noaltmacro > >> .purgem _for__body > >> .endm > > > >Looks OK to me. With [*] addressed as appropriate, and modulo others' > >comments (if any): > > This is the new commit message (I have taken the opportunity to reflow it): > > commit 0dabd72ee773a62ec25fde289a60a9de908bf41b > Author: Julien Grall > Date: Wed Dec 5 14:44:19 2018 +0000 > > arm64/fpsimdmacros: Allow the macro "for" to be used in more cases > > The current version of the macro "for" is not able to work when the > counter is used to generate registers using mnemonics. This is because > gas is not able to evaluate the expression generated if used in > register's name (i.e x\n). > > Gas offers a way to evaluate macro arguments by using % in front of > them under the alternate macro mode. > > The implementation of "for" is updated to use the alternate macro mode > and %, so we can use the macro in more cases. As the alternate macro > mode may have side-effects, this is disabled when expanding the body. > > While it is enough to prefix the argument of the macro "__for_body" > with %, the arguments of "__for" are also prefixed to get a more > bearable value in case of compilation error. > > Suggested-by: Dave Martin > Signed-off-by: Julien Grall > > --- > > For the alternate macro mode documentation, see: > https://sourceware.org/binutils/docs/as/Altmacro.html > > > > >Reviewed-by: Dave Martin That looks fine to me. Cheers ---Dave _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel