From nobody Tue Feb 10 10:19:14 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1591641745; cv=none; d=zohomail.com; s=zohoarc; b=b/SdFlcn4ewZ6RXCMy31e2GyVwcZ7WDXeR6LMYdseb9iuj6sbk9gbRkaqcxa/xDu5eRPNn8Qm20HtT48kalkZeUSO9kY7iyL9Q7Udn72BrtiuxlOfyDEsYEIM/ToE00fI8m+/sYR/nIrHGhhnbRIFVojHZCydh9msDpajuF1FSM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591641745; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=D9iJwfXIlrrZhBoa0zYBpMpQDudGom24uMHOfJzYaos=; b=YrOvzdujpkgmN7g5WU8qcM0keyYLZiLsX7LGR8+1YeHe3tcJtZHIvh9Tn0rYnsFgH7/6ofL7BRst4I6MTe5lAM6DXdScqbmPgWynmNonf8cHI9lHRCaUsL5mT+VaoJ63xy4EqKhIg3huav6NoOYQl8rK06s9ipeUX+7ONTZtaJU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1591641745037281.32156035708977; Mon, 8 Jun 2020 11:42:25 -0700 (PDT) Received: from localhost ([::1]:58290 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jiMj1-00049J-Lf for importer@patchew.org; Mon, 08 Jun 2020 14:42:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57578) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jiMdr-0007XJ-5y for qemu-devel@nongnu.org; Mon, 08 Jun 2020 14:37:03 -0400 Received: from mail-pf1-x444.google.com ([2607:f8b0:4864:20::444]:40117) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jiMdq-0001VD-2L for qemu-devel@nongnu.org; Mon, 08 Jun 2020 14:37:02 -0400 Received: by mail-pf1-x444.google.com with SMTP id s23so7597869pfh.7 for ; Mon, 08 Jun 2020 11:37:01 -0700 (PDT) Received: from localhost.localdomain (174-21-143-238.tukw.qwest.net. [174.21.143.238]) by smtp.gmail.com with ESMTPSA id i22sm7854235pfo.92.2020.06.08.11.36.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jun 2020 11:36:59 -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=D9iJwfXIlrrZhBoa0zYBpMpQDudGom24uMHOfJzYaos=; b=dTqZkv9jvfvfq1OFDvraXcQBvuP8mqFVA2zU+sj6+kJY4VVpLoRxccBT7NDm0fezq8 HO2Fv0GbIMjcfq9MAPxiRCrtu+dSwRSpB9yQWO+JnZRfLRLdq+lre80kwsdslZu1G6zR oHBTPfr7WZ62Kjer9d+tSdf7yMV3oX11G5dZ8fGq+Es0kwypTDnHm3ugOA5i4kQOxQ5J HFWRHhYLJ/ZwVtmRbrT5p0QEn1gYFLkfBu8vc51Gc7QBt13EikFUf+j6vXP/XjU7az0Z cnl7vasDwmaumiR/JXR5eXFb2UmupZ5Gke0J7zZS+CzSBXsoHfZt88bmP0i6oTwSauKd VHUA== 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=D9iJwfXIlrrZhBoa0zYBpMpQDudGom24uMHOfJzYaos=; b=tnpkcdaAUob6eWOHEaPoXhRo+7ymFPMeW5vM9hV/48yWvOJSuEmS6DDefMbHowqnGN //rQIZ+KgOMEeQMY03UlqLxiDvK5ISStv1Sodr/2kaIFQlyp6yHwi6/8ZLtz7A9DLKof Lf7Ed29bDj5GGVtlR3hz8IOuhS0xGRXrxsrIjK/CSEU4MhpVxx10mmG212/un+md/5q0 4KPRqcBAY2fiK3uYXH+SVaiQeY9+tlR2/e2A2bx1kpYDV7usRl1TQhFS9ZJG6YCZ5rqQ Vb+fk+aJeVHT3u9ZQSpY9vUt1chYrDtSDSPqGCWatiivrdYns/Mrd7k28dRfY8FLHiQ2 /5Og== X-Gm-Message-State: AOAM532WXo+xmpW0YMLCd4Cvb140ASHC19Tgyjb6swgrZLrNVtCognZ3 WZ1QenBliK324GSkYWM9EBSwhbcxHWY= X-Google-Smtp-Source: ABdhPJwK3y/VDDgrSNyo0XqiICKnzhVL65WnrLzpg9FgT+F2qolJtpWWN8pf8tngQ/VY8CcY6pUzmw== X-Received: by 2002:a63:da0e:: with SMTP id c14mr20908773pgh.377.1591641420266; Mon, 08 Jun 2020 11:37:00 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 4/9] decodetree: Allow group covering the entire insn space Date: Mon, 8 Jun 2020 11:36:47 -0700 Message-Id: <20200608183652.661386-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200608183652.661386-1-richard.henderson@linaro.org> References: <20200608183652.661386-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::444; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x444.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. 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_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN 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 Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" This is an edge case for sure, but the logic that disallowed this case was faulty. Further, a few fixes scattered about can allow this to work. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- ...est1.decode =3D> succ_pattern_group_nest2.decode} | 2 +- scripts/decodetree.py | 14 +++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) rename tests/decode/{err_pattern_group_nest1.decode =3D> succ_pattern_grou= p_nest2.decode} (85%) diff --git a/tests/decode/err_pattern_group_nest1.decode b/tests/decode/suc= c_pattern_group_nest2.decode similarity index 85% rename from tests/decode/err_pattern_group_nest1.decode rename to tests/decode/succ_pattern_group_nest2.decode index 92e971c3c5..8d5ab4b2d3 100644 --- a/tests/decode/err_pattern_group_nest1.decode +++ b/tests/decode/succ_pattern_group_nest2.decode @@ -6,7 +6,7 @@ %sub3 16:8 %sub4 24:8 =20 -# Groups with no overlap are supposed to fail +# Group with complete overlap of the two patterns { top 00000000 00000000 00000000 00000000 sub4 ........ ........ ........ ........ %sub1 %sub2 %sub3 %sub4 diff --git a/scripts/decodetree.py b/scripts/decodetree.py index ea313bcdea..3307c74c30 100755 --- a/scripts/decodetree.py +++ b/scripts/decodetree.py @@ -124,6 +124,7 @@ def is_pow2(x): =20 def ctz(x): """Return the number of times 2 factors into X.""" + assert x !=3D 0 r =3D 0 while ((x >> r) & 1) =3D=3D 0: r +=3D 1 @@ -131,6 +132,8 @@ def ctz(x): =20 =20 def is_contiguous(bits): + if bits =3D=3D 0: + return -1 shift =3D ctz(bits) if is_pow2((bits >> shift) + 1): return shift @@ -793,9 +796,8 @@ def build_incmulti_pattern(lineno, pats): error(lineno, 'width mismatch in patterns within braces') =20 repeat =3D True - while repeat: - if fixedmask =3D=3D 0: - error(lineno, 'no overlap in patterns within braces') + fixedbits =3D 0 + while repeat and fixedmask !=3D 0: fixedbits =3D None for p in pats: thisbits =3D p.fixedbits & fixedmask @@ -978,6 +980,12 @@ def build_tree(pats, outerbits, outermask): innermask &=3D i.fixedmask =20 if innermask =3D=3D 0: + # Edge condition: One pattern covers the entire insnmask + if len(pats) =3D=3D 1: + t =3D Tree(outermask, innermask) + t.subs.append((0, pats[0])) + return t + text =3D 'overlapping patterns:' for p in pats: text +=3D '\n' + p.file + ':' + str(p.lineno) + ': ' + str(p) --=20 2.25.1