From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by sourceware.org (Postfix) with ESMTPS id 76A513857B84 for ; Thu, 23 Jun 2022 19:58:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 76A513857B84 Received: by mail-wr1-x432.google.com with SMTP id i10so366262wrc.0 for ; Thu, 23 Jun 2022 12:58:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:user-agent:in-reply-to:references :mime-version:content-transfer-encoding:subject:to:cc:from :message-id; bh=AmM+EagZrrCBsAv1iDQ0vO+jekoWYOr/hQwLlYPFoy4=; b=xW7GAo5p7JQc6EyH5qp3K4QyvEjzuevmPVM16G2S8qoU+VGE2VNR/iC9imzXe4zq0h MabRpltdGAU5QbtGPyYIq7tPrQd8gfHm7PPtWb6yNpQ9u20mr7gk2m40aKXDg64WXUBV 1JAfNsBfXHSGwZxOvSt18eOnudY6/3/DG0J4KQwVlkWswS+8HP6PKA6+J+raLm4/jr4a Cg2l6F1RZ5n3h/0UXQsYnHEOWjvCQ+CqfLKAU/zeN8q7qqG5vukuResAgT0/NImizVLC meVoYOIxWLXGiSnTfXwtgm5q/f48kIs+228RZkbsgLJHGpnTFmEyBVOeyBjLfx/y8sgO lIPA== X-Gm-Message-State: AJIora+lK2BWuZumrTvRbYC0jp2o14zEBCTWJ9hknE1ZE048wzIKoFb6 5hhsjgVQeMVX1Y/pK7ZxxMI= X-Google-Smtp-Source: AGRyM1s69dAJGdS8muRKjQPvv9npG/azJcIMS75Is8KdoM1TTGIgnaberw2rG7qsDNMpsi92DNBnpA== X-Received: by 2002:a05:6000:993:b0:21b:8f16:5b3f with SMTP id by19-20020a056000099300b0021b8f165b3fmr9825226wrb.628.1656014281254; Thu, 23 Jun 2022 12:58:01 -0700 (PDT) Received: from [192.168.1.103] (92.40.173.187.threembb.co.uk. [92.40.173.187]) by smtp.gmail.com with ESMTPSA id r1-20020a05600c424100b0039c7c4a542csm233099wmm.47.2022.06.23.12.58.00 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 23 Jun 2022 12:58:00 -0700 (PDT) Date: Thu, 23 Jun 2022 20:58:02 +0100 User-Agent: XryptoMail for Android In-Reply-To: <20220623193734.1245650-3-ghostmansd@gmail.com> References: <20220621115115.1068453-1-ghostmansd@gmail.com> <20220623193734.1245650-1-ghostmansd@gmail.com> <20220623193734.1245650-3-ghostmansd@gmail.com> MIME-Version: 1.0 Subject: Re: [PATCH v3 2/6] ppc: introduce non-zero operand To: Dmitry Selyutin ,binutils@sourceware.org From: lkcl Message-ID: <9C4570F2-B718-458D-8D13-986FADD7052F@gmail.com> X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, HTML_MESSAGE, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jun 2022 19:58:04 -0000 the "normal" way of handling this is e=2Eg=2E to have a 5-bit field where 0= b00000 represents 32 (i=2Ee=2E 0b100000 rather than 0b00000)=2E the reasoning behind the decision to go with the -1 offset is that a futur= e version, using v3=2E1 64-bit prefixing, may end up extending the immediat= es with a lot more bits, at which point it gets complicated to detect the m= aximum=2E l=2E On June 23, 2022 8:37:30 PM GMT+01:00, Dmitry Selyutin wrote: >svstep and svshape instructions subtract 1 before encoding some of the >operands=2E Obviously zero is not supported for these operands=2E Whilst >PPC_OPCODE_PLUS1 fits perfectly to mark that maximal value should be >incremented, there is no flag which marks the fact that zero values are >not allowed=2E This patch adds a new flag, PPC_OPCODE_NONZERO, for this >purpose=2E >--- > gas/config/tc-ppc=2Ec | 3 +++ > include/opcode/ppc=2Eh | 3 +++ > 2 files changed, 6 insertions(+) > >diff --git a/gas/config/tc-ppc=2Ec b/gas/config/tc-ppc=2Ec >index 76bdfb2e35=2E=2E7d27334aa6 100644 >--- a/gas/config/tc-ppc=2Ec >+++ b/gas/config/tc-ppc=2Ec >@@ -1951,6 +1951,9 @@ ppc_insert_operand (uint64_t insn, > right =3D max & -max; > min =3D 0; >=20 >+ if ((operand->flags & PPC_OPERAND_NONZERO) !=3D 0) >+ min =3D 1; >+ > if ((operand->flags & PPC_OPERAND_SIGNOPT) !=3D 0) > { > /* Extend the allowed range for addis to [-32768, 65535]=2E >diff --git a/include/opcode/ppc=2Eh b/include/opcode/ppc=2Eh >index d5752a42e6=2E=2E215fa8c5e0 100644 >--- a/include/opcode/ppc=2Eh >+++ b/include/opcode/ppc=2Eh >@@ -463,6 +463,9 @@ extern const unsigned int num_powerpc_operands; > #define PPC_OPERAND_FCR (0x1000000) > #define PPC_OPERAND_UDI (0x2000000) >=20 >+/* The operand cannot be zero=2E */ >+#define PPC_OPERAND_NONZERO (0x4000000) >+ > extern ppc_cpu_t ppc_parse_cpu (ppc_cpu_t, ppc_cpu_t *, const char *); >=20 > static inline int64_t >--=20 >2=2E36=2E1