From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf1-x133.google.com (mail-lf1-x133.google.com [IPv6:2a00:1450:4864:20::133]) by sourceware.org (Postfix) with ESMTPS id 78A8B3854172 for ; Thu, 23 Jun 2022 19:37:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 78A8B3854172 Received: by mail-lf1-x133.google.com with SMTP id x3so752282lfd.2 for ; Thu, 23 Jun 2022 12:37:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=aCQsQHbNJNS2xmnOyq4d6D1K0UCXcpzWa0JWe01ENVw=; b=57E3L20GjryiQJFaojDJWHFYjxHE/fEEJxNp0+VrER4DDNaxRvVwY/XRZfM4hPha6K 8Tluxc+h3zwTpUmGx9SJJIsjFlSJ/eZiXKRySatLbBhepCyl/FTQ/efl5kuoji+2kemy pGtfNE6Ro/WX1LgwE9TOvGCYmkhisctTT1GCgprzvXyQfrYiv1xy9NDiW3MlsRNBLS7g aQuSExJV0Vr0P695Dl++Lw0pAx4Xq1Y0ex03WXk4f499S2wTgdumZariiZaiCMAGhryD Ehx13tm+lolRd46J8W8Ledz4wFEV5ga6ULh19l3KMFor9y5epW3aYcNs67FBMZKB40iy t31A== X-Gm-Message-State: AJIora/Kzvf+eJdmTrGO/zDDzHCfC7vqv2yi2xpggejordfgrUh0u4tF A3kpoR667J0VFzRv4crm7Lq3zLTMnjc= X-Google-Smtp-Source: AGRyM1viCQ7rPgd+HMFY9g1H//8PsUfmIsy0sveizpsvrPfPelZ2upNXOCl22hZ5qtI9y+8ofQqbqw== X-Received: by 2002:a05:6512:b26:b0:47d:d65a:f03e with SMTP id w38-20020a0565120b2600b0047dd65af03emr6339308lfu.588.1656013071881; Thu, 23 Jun 2022 12:37:51 -0700 (PDT) Received: from localhost.localdomain (broadband-188-32-220-156.ip.moscow.rt.ru. [188.32.220.156]) by smtp.gmail.com with ESMTPSA id a8-20020ac25208000000b0047f74ee6a1fsm9737lfl.63.2022.06.23.12.37.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jun 2022 12:37:51 -0700 (PDT) Sender: Dmitry Selyutin From: Dmitry Selyutin To: binutils@sourceware.org Cc: Alan Modra , Luke Kenneth Casson Leighton , Dmitry Selyutin Subject: [PATCH v3 2/6] ppc: introduce non-zero operand Date: Thu, 23 Jun 2022 22:37:30 +0300 Message-Id: <20220623193734.1245650-3-ghostmansd@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220623193734.1245650-1-ghostmansd@gmail.com> References: <20220621115115.1068453-1-ghostmansd@gmail.com> <20220623193734.1245650-1-ghostmansd@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-10.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, 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 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:37:54 -0000 svstep and svshape instructions subtract 1 before encoding some of the operands. Obviously zero is not supported for these operands. 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. This patch adds a new flag, PPC_OPCODE_NONZERO, for this purpose. --- gas/config/tc-ppc.c | 3 +++ include/opcode/ppc.h | 3 +++ 2 files changed, 6 insertions(+) diff --git a/gas/config/tc-ppc.c b/gas/config/tc-ppc.c index 76bdfb2e35..7d27334aa6 100644 --- a/gas/config/tc-ppc.c +++ b/gas/config/tc-ppc.c @@ -1951,6 +1951,9 @@ ppc_insert_operand (uint64_t insn, right = max & -max; min = 0; + if ((operand->flags & PPC_OPERAND_NONZERO) != 0) + min = 1; + if ((operand->flags & PPC_OPERAND_SIGNOPT) != 0) { /* Extend the allowed range for addis to [-32768, 65535]. diff --git a/include/opcode/ppc.h b/include/opcode/ppc.h index d5752a42e6..215fa8c5e0 100644 --- a/include/opcode/ppc.h +++ b/include/opcode/ppc.h @@ -463,6 +463,9 @@ extern const unsigned int num_powerpc_operands; #define PPC_OPERAND_FCR (0x1000000) #define PPC_OPERAND_UDI (0x2000000) +/* The operand cannot be zero. */ +#define PPC_OPERAND_NONZERO (0x4000000) + extern ppc_cpu_t ppc_parse_cpu (ppc_cpu_t, ppc_cpu_t *, const char *); static inline int64_t -- 2.36.1