From patchwork Fri Apr 30 01:15:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 429728 Delivered-To: patch@linaro.org Received: by 2002:a02:c901:0:0:0:0:0 with SMTP id t1csp2104711jao; Thu, 29 Apr 2021 18:20:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxNBiubK/3cucv1Zk6NeiwJe+w4bcQbFQfJ1N8utqnIFcD+giEgINQZnzFqqYBsyUE1k4ho X-Received: by 2002:a92:d1d0:: with SMTP id u16mr2077826ilg.48.1619745652814; Thu, 29 Apr 2021 18:20:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619745652; cv=none; d=google.com; s=arc-20160816; b=kqyxJiWA3rTjSoIVIRkqtkXZGiAnxgOTTpPoq5PlMlIDcm6sPlD63ayFvev2sTanoa BXN3GPu9koQb/ad1IoxQNIP9yEwUIl8PXT2YmoVS1/piItOAsDu3NfXnaYonzoTNIp8i l13Pfqw2FP48xT50bubi1zVyBn8ALv1/O9rdR9nLH+IkJhnge1M2lRGs0Iml9AtgrOz3 VlGJwmLnNaPS9NqX1xH1CdLTFRGsRMJXXKWNKX9fXOBvWhfowT7r73ahPxirwg2BfE/O hjpLc9THsl9yPtmNK6OJ2jdAd2ww9BxR/W03i9TtR4ELAH6pVx9f3XPza8dUA2+HPlLb mbFg== 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=XDA7d3QjWWFtV2qtFhcmd5DNvHMTMh2+SFPB7dy5cBY=; b=R4tBXqIB8KHee2aaLWjkJBp5EcH7Tv0OKeScfnIbPAYfdhfvEqOemfCCML3ANiSyEf rO0c2rlBZAm0GYupC0K5S3oqGmSuWb9unesc/0HISWn2y55B5i5pjdwoOTCt9CqMKbXG g085pFZzLLPAial+dM53PR3Hwxe7z6rghnQszM5prWy3SYY5vyjuknOWNxN+W0opEzsr aGs3bRJVdGsTYzcLMrAqT0ySyT33jm4NrTEjcaEdBvWin0Ix1hFFJv5baWT2vuDwyLgP WXu9XrlzNTBLitusyO+6M8ygTTxLREtADPX/MRvV5SfN79UmAiYclwkkClJdFF/bz6SJ Bipw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=AEFId7+I; 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=fail (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 z11si2111237ioq.81.2021.04.29.18.20.52 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 29 Apr 2021 18:20:52 -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=fail header.i=@linaro.org header.s=google header.b=AEFId7+I; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:42784 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lcHps-0007E2-90 for patch@linaro.org; Thu, 29 Apr 2021 21:20:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33800) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lcHlD-0002mK-3I for qemu-devel@nongnu.org; Thu, 29 Apr 2021 21:16:03 -0400 Received: from mail-pj1-x102c.google.com ([2607:f8b0:4864:20::102c]:38901) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lcHky-0007U5-20 for qemu-devel@nongnu.org; Thu, 29 Apr 2021 21:16:02 -0400 Received: by mail-pj1-x102c.google.com with SMTP id f11-20020a17090a638bb02901524d3a3d48so827974pjj.3 for ; Thu, 29 Apr 2021 18:15:47 -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=XDA7d3QjWWFtV2qtFhcmd5DNvHMTMh2+SFPB7dy5cBY=; b=AEFId7+IGe3+y2uGgLt5bTbhVM3Tfl47D6lroUbNEdXDn8eFyGEXo84Dv+a6Dx64BO lh8o0H4blkdQXVS4oY9OBIPedzHhPl0cUwiIcM+DncBNQCXgDMapgoIfme5Ju7BoYitk AR/TTUFLPttsjCt0ntp784jDCsSIbU++vM80w5f4IdSyU4C/TPw0lctlLY2dpgxbq3+B QWPoyvpIz7NqtVjiezVu+NQtq4DIWZcldOI/hFp+L3CINxZ9wDjJqk2atHwzJew4gk36 boghk08zoqR+iW1aotluHIJ5G3YQ4oDqiJ8ub8VBtKCJhTyg/dHXOL5aE8lJSH7QEokq EjLA== 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=XDA7d3QjWWFtV2qtFhcmd5DNvHMTMh2+SFPB7dy5cBY=; b=GHKAAJfihA3JH+SkJl3yYUMHmSkT2qBqxm6D2M5X2BOIY4hlCAiD4+elxIutbaDTYG rBI7oJtlXO1DmjiHl133qU8CnXMRVSRaBBY7aPJvOaLETEW3no2ulIdh+jFLCLiBPhkK frSwW8o44u56po0jbd69j6NwhEZxIheMVcPe3y+nIS0SkuV5VKTto1E15bGMvTBzZHlD sYbd1gCfDZHuVLKAiw1MK9zLQsEvqolOkUSB0Pz0tksxdxeXVU5lWgat2iHrfwfbcvZN yQhHiK4iB/qm6y/2irZiBEw6dpT3TNXO9JEH7hNBH1Yc4dIuLszq5lg/ieK+AjdNcPor f1Lg== X-Gm-Message-State: AOAM533qHyLQUrUnUn1VDjvn32G5W7t0Zq9wDzooswRyQCpBYUN2TqAr 5kKYBEu2IEhXG9MD4agCGLdBtDfU8IiF7Q== X-Received: by 2002:a17:90b:4a4e:: with SMTP id lb14mr11979641pjb.115.1619745346670; Thu, 29 Apr 2021 18:15:46 -0700 (PDT) Received: from localhost.localdomain ([71.212.144.24]) by smtp.gmail.com with ESMTPSA id 1sm161277pjx.46.2021.04.29.18.15.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Apr 2021 18:15:46 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 03/30] decodetree: Add support for 64-bit instructions Date: Thu, 29 Apr 2021 18:15:16 -0700 Message-Id: <20210430011543.1017113-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210430011543.1017113-1-richard.henderson@linaro.org> References: <20210430011543.1017113-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: f4bug@amsat.org, luis.pires@eldorado.org.br, qemu-ppc@nongnu.org, lagarcia@br.ibm.com, bruno.larsen@eldorado.org.br, matheus.ferst@eldorado.org.br, david@gibson.dropbear.id.au 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.] Signed-off-by: Richard Henderson --- scripts/decodetree.py | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) -- 2.25.1 Reviewed-by: Luis Pires 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: