From patchwork Sat May 1 18:51:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 430270 Delivered-To: patch@linaro.org Received: by 2002:a02:c901:0:0:0:0:0 with SMTP id t1csp1533904jao; Sat, 1 May 2021 12:23:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw/ujnp+ru8Uz90MHzoVMIxhzgzt2Vl3RkdkcmqK+Fza629lNalAwmrucNubunXkrjVs+6i X-Received: by 2002:a92:603:: with SMTP id x3mr9246525ilg.215.1619896988498; Sat, 01 May 2021 12:23:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619896988; cv=none; d=google.com; s=arc-20160816; b=V0eCkMRsoW3r+54PsfaeZxZXkVVkcda0kQWJLdeX1Na4vbJcR2dZlsrOCu9VFrXYyM JLY7700OMYqTcNRXVyhDIft8K7v1eQp/WPMqApS+VieYjqmvFzC7iqh9ViKV0AeAcGz+ EgqS6nXTA4t/M7a5qAFFg4q8Gf6sP+cl8YIV/J4rLhkTgR9vJ7YZ+gBlb7iOsJcKnKa0 LRIe6mb7ltlo9oucI+QDGWvZH9DFQ/FCJe8VcIL9LMl7e1DEHgP2w/ywaB9CksfzOlgl uEWRJYjpnDBCSL9rG2zQyTowhzjPromvIyKtR/ScQCwM9NUzh1H7t6C8Jm/xKsJqm8ar KlEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=cUnlPrvK75q4XSJyyRAV3mEtaJHVxQptn5uL4uV7YhQ=; b=UBGI7iBib0y+hhN+9IjVhAQZ0APC5CnMMRSVdJhOG4KKn5TpM8Th5tOnnamS4eGZRS 3KolIFY9K3ggFouuhhXXt62zVRR2Ubr0CCwCk5UMG/suQEhjuDJXGSQbJVtdtetD3LRs CA+nV3GdXeCXd1a5K8RijTuIrVPmRHcBOycMM29gYJKB6z7z707scxHaDr3tZgQmnel5 Yi9HjMl7apeGRvxDUmxMlhya4257l8U7auKG3jMl7wEBrquE5d75lhBeMH7xM3uwE7lN DAYkIZZU6K0+Ps5UqSla21q+Ru89QaOj7ZP2ceXWN6GiabKGRSJK2RnJ7HEvT5xrEDGv +E3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MXhKWAJv; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id g13si7623941ilf.94.2021.05.01.12.23.08 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 01 May 2021 12:23:08 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MXhKWAJv; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:36164 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lcvCl-0004Xm-Qz for patch@linaro.org; Sat, 01 May 2021 15:23:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46426) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lcui6-0006Wx-Jb for qemu-devel@nongnu.org; Sat, 01 May 2021 14:51:27 -0400 Received: from mail-pj1-x102c.google.com ([2607:f8b0:4864:20::102c]:39726) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lcui1-0003m7-Gu for qemu-devel@nongnu.org; Sat, 01 May 2021 14:51:26 -0400 Received: by mail-pj1-x102c.google.com with SMTP id z6-20020a17090a1706b0290155e8a752d8so3452664pjd.4 for ; Sat, 01 May 2021 11:51:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=cUnlPrvK75q4XSJyyRAV3mEtaJHVxQptn5uL4uV7YhQ=; b=MXhKWAJv6ScpVXCZUwqOpLDSMRt0VxxPRuL1iGTYbjf+y4D+O2KkzaI77J+4xzAWgy 0oy4+wmTKEqZIefKkJxUIqcppol69Vs8I9rtUca3wl65H04+oVzjNt/Ym2BQ6b7FHvMi czYJAI2DF6Q/Aa2DjeRn3qcoi3PM4rtuY1Er+hUb2It67fNx7A2IOEd2lpagN4VI94nG M1LeZhsw0ZvpMnYZKBEgnD/D97pj8LXo8xpm5zVssgUTfFmyRJa8M2aUAXxSNwldJ+xK D62C2jpeZHFT+BVXw5VfI3nVvssc1Rq1miUgcwzcXOwYlAUWD3aD+YfStv3yHfiy0kce zC7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=cUnlPrvK75q4XSJyyRAV3mEtaJHVxQptn5uL4uV7YhQ=; b=SjJMkWh8jDhPf/aebC7NDiNNeL9tH4vcijsFnQO5AvOB0RZ8aH2ZXC5BLrxZbLxV8t z2oBe8iFmbLTfaTjGbYGFtcCv3eDeGi+ZCy0xiIMb+Mu9oF+SLbi4d+Niqw2StBIIYrK jp2IJayjZHVAuBEOrQZHxhu2gL6kaVyjEPYC3bveV6JU9vqhUVH6bGNtquwshuLl2Tkg A6zs40oeXlGi/iuvy10qtLhR2c4iqiBwwXqus3bJeykhshmMvaPhGHlrtdu0MtlW8aFi Wn4sS7RWdn0wggV86DAHaEkFE62D8d2+yU4XNMobrp2+Qfa0zGAEuX2se/fRR7d3j1VY FEug== X-Gm-Message-State: AOAM530FaDSuAT9jZ3EzjPLvoA/fdxAHuWmCB3IWWjU7G1FxrDhBVrZt /qvRDgFfPITOZyv+rJNfuIFX2B091aXC9A== X-Received: by 2002:a17:90a:a4c7:: with SMTP id l7mr11726643pjw.147.1619895080274; Sat, 01 May 2021 11:51:20 -0700 (PDT) Received: from localhost.localdomain ([71.212.144.24]) by smtp.gmail.com with ESMTPSA id k17sm4971360pfa.68.2021.05.01.11.51.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 01 May 2021 11:51:20 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 4/5] decodetree: Add support for 64-bit instructions Date: Sat, 1 May 2021 11:51:15 -0700 Message-Id: <20210501185116.1338875-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210501185116.1338875-1-richard.henderson@linaro.org> References: <20210501185116.1338875-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102c; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, Luis Fernando Fujita Pires , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Luis Fernando Fujita Pires Allow '64' to be specified for the instruction width command line params and use the appropriate extract and deposit functions in that case. This will be used to implement the new 64-bit Power ISA 3.1 instructions. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Luis Pires Message-Id: [rth: Drop the change to the field type; use bitop_width instead of separate variables for extract/deposit; use "ull" for 64-bit constants.] Reviewed-by: Luis Pires Signed-off-by: Richard Henderson --- scripts/decodetree.py | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) -- 2.25.1 diff --git a/scripts/decodetree.py b/scripts/decodetree.py index d5da101167..f85da45ee3 100644 --- a/scripts/decodetree.py +++ b/scripts/decodetree.py @@ -27,6 +27,7 @@ import getopt insnwidth = 32 +bitop_width = 32 insnmask = 0xffffffff variablewidth = False fields = {} @@ -112,7 +113,9 @@ def whexC(val): """Return a hex string for val padded for insnwidth, and with the proper suffix for a C constant.""" suffix = '' - if val >= 0x80000000: + if val >= 0x100000000: + suffix = 'ull' + elif val >= 0x80000000: suffix = 'u' return whex(val) + suffix @@ -199,11 +202,9 @@ def __str__(self): return str(self.pos) + ':' + s + str(self.len) def str_extract(self): - if self.sign: - extr = 'sextract32' - else: - extr = 'extract32' - return f'{extr}(insn, {self.pos}, {self.len})' + global bitop_width + s = 's' if self.sign else '' + return f'{s}extract{bitop_width}(insn, {self.pos}, {self.len})' def __eq__(self, other): return self.sign == other.sign and self.mask == other.mask @@ -224,6 +225,7 @@ def __str__(self): return str(self.subs) def str_extract(self): + global bitop_width ret = '0' pos = 0 for f in reversed(self.subs): @@ -231,7 +233,7 @@ def str_extract(self): if pos == 0: ret = ext else: - ret = f'deposit32({ret}, {pos}, {32 - pos}, {ext})' + ret = f'deposit{bitop_width}({ret}, {pos}, {bitop_width - pos}, {ext})' pos += f.len return ret @@ -1270,6 +1272,7 @@ def main(): global insntype global insnmask global decode_function + global bitop_width global variablewidth global anyextern @@ -1299,6 +1302,10 @@ def main(): if insnwidth == 16: insntype = 'uint16_t' insnmask = 0xffff + elif insnwidth == 64: + insntype = 'uint64_t' + insnmask = 0xffffffffffffffff + bitop_width = 64 elif insnwidth != 32: error(0, 'cannot handle insns of width', insnwidth) else: