From patchwork Mon Jun 5 20:15:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 689243 Delivered-To: patch@linaro.org Received: by 2002:a5d:4d8a:0:0:0:0:0 with SMTP id b10csp2287469wru; Mon, 5 Jun 2023 13:23:38 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4UXn05Wl5s9sRtFzziKAQgzPLns2ROmzfeMcoIk6/dnQZLhV8NG8k0UGVxTgK6LJ40RJb2 X-Received: by 2002:a05:6214:c6d:b0:621:7241:df33 with SMTP id t13-20020a0562140c6d00b006217241df33mr1622qvj.0.1685996618661; Mon, 05 Jun 2023 13:23:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685996618; cv=none; d=google.com; s=arc-20160816; b=qLpM00fT0WkIsLDbW5hCsaUwuY3eOdeZ6MSQLijQUyAJnhcopGVJ9et5uX+GQaoSpE u5tgxNK4SLLSVWGWXoJSkQfB13YtoV13t9w12d89fkT2zUINKe3RvL+0gnyZPPezRGVk vHzhK2bp/BztkZUHfR4xH74kQ8Kw9RFM/CGzSEUM/N00VXjhitus4xT+c/1A4Y1/7q+v mw+7x6f+B4bNasTiRakv3XzNxMQ6GQXYPZX+cC+pe/QsaqPEGn2fS+5VjGSM4rzwoiAd aNee4v4HidyO3rLD13Sm75RlXydHtliPdNjB+JJo5PQ4tGpLY4ez+qV8hLLwAq9KhMAt ac6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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:cc:to :from:dkim-signature; bh=t25Lwror6gMHE9REWAtcEk6T/FuH34tcWxvUnV0Sx38=; b=S0/AjvDZln18M6niy7yFhM3JK9CPPchn7CBq3ATvQAtpcAoSSCklenjOV3I7KUDhrz JXvDI0JK61hkFkpG2fmKlBpL1SEhTTFJz3guX+a7MXmV4Q6BSx8ktx6/yvuQwNw+F6Qu Bp+z/o5yvQfH020DVSos+hhMB+vL4czlhyCsPdCrJotreeyAj/g3tt/mYq5k4hZni5as OBb3oUhYBHurbx3ggOqo41T8599VSvzR97pJvWEDm5nYg5++3TpSdkStkqAxzKBItwQM x94bRNWbpzFgXCNovQ6IuqXwY0fFo1cMlHNKe3O5Zz39gKnpnRqoQp8tJcEXd0vWxg6g Z1pA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wzkd9mb6; 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 o4-20020a0562140e4400b006257cf747fasi5409451qvc.549.2023.06.05.13.23.38 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 05 Jun 2023 13:23:38 -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=wzkd9mb6; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q6Gcn-0001vr-AQ; Mon, 05 Jun 2023 16:16:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q6Gch-0001uL-AE for qemu-devel@nongnu.org; Mon, 05 Jun 2023 16:16:15 -0400 Received: from mail-pf1-x430.google.com ([2607:f8b0:4864:20::430]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q6Gcf-0003qB-J2 for qemu-devel@nongnu.org; Mon, 05 Jun 2023 16:16:15 -0400 Received: by mail-pf1-x430.google.com with SMTP id d2e1a72fcca58-652328c18d5so2567814b3a.1 for ; Mon, 05 Jun 2023 13:16:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1685996172; x=1688588172; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=t25Lwror6gMHE9REWAtcEk6T/FuH34tcWxvUnV0Sx38=; b=wzkd9mb6C6/ynyjnTtFU9lrOyQ53RV0UbyMYVYPbPQHGZIdFzklw/h9ehBaqLEjKFc jZ0VQUG/zEDS8/FZ3MCHT76XVKNUISX2MhY5w8eeGMBzWeAdZKKwN537vO74CwYbxFUt AsrNn1ya/DMfxDwAZ7C6naTFf5pNpf9RSlHKXVciFvPjC4ANnljlajmU3/nM7MLsEC3p RGqJmCpOEtEv1yvjcRhV89ZJLVjbCAcgie4XVHT9WZYP79Y9AwKtpS82Z1B1ZeimNOvK gMveJ767FrEBu/z59Jj1lCCJvPsowYxyEX4U6JBjCdJOvY1Zd+FhnKKT4c3F2sj8NUs4 qMYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685996172; x=1688588172; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=t25Lwror6gMHE9REWAtcEk6T/FuH34tcWxvUnV0Sx38=; b=SuZMl3rD53WBGetiubifjAeuglnn59QdPnmc9O7suxpEh/LQ1mmkeQ4bF0I7Y1N3eG fgXJtDOTpjHnbgeQTc5SUnbXltOpNq1xZRIQCe/obDT/FwcdnHKwkjEoH5Kft/tyqlX2 YDRtwnp99+lXvj/OypItAUnM3n84uarrOYWR8v3YdlCjHbQ1Crdxq++eR9AOM+uvbbTG j6kq+2k6OkKYWXpisiOc6nOzGumKoUkCz5umK9Fq187gAi6nA1G7aSOatJr0xwAfV4rr /NClBbWFPZV1Rrnq5BhueUtEmYzOzYRh77oD0A3QAcKFKjVTpRHSK9iNI4DIQkI8DiS+ 9I4Q== X-Gm-Message-State: AC+VfDxktVDmWKWkL9ss71GvowqBN1sMeTqR76NaZvWDpwpDGlTxRdrm 9TBKKgFAo1nf0Rw1eC3cemlRtsNod5vIMJVC1L8= X-Received: by 2002:a05:6a20:12d6:b0:10b:9dc1:c5e5 with SMTP id v22-20020a056a2012d600b0010b9dc1c5e5mr93465pzg.34.1685996171742; Mon, 05 Jun 2023 13:16:11 -0700 (PDT) Received: from stoup.. ([2602:ae:1598:4c01:3f85:a600:6a3e:e465]) by smtp.gmail.com with ESMTPSA id f18-20020aa78b12000000b0064d32771fa8sm5552924pfd.134.2023.06.05.13.16.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Jun 2023 13:16:11 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL 25/52] target/sh4: Emit insn_start for each insn in gUSA region Date: Mon, 5 Jun 2023 13:15:21 -0700 Message-Id: <20230605201548.1596865-26-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230605201548.1596865-1-richard.henderson@linaro.org> References: <20230605201548.1596865-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::430; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x430.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Fixes an assert in tcg_gen_code that we don't accidentally eliminate an insn_start during optimization. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- target/sh4/translate.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/target/sh4/translate.c b/target/sh4/translate.c index 9d2c7a3337..76f46d268b 100644 --- a/target/sh4/translate.c +++ b/target/sh4/translate.c @@ -2146,9 +2146,7 @@ static void decode_gusa(DisasContext *ctx, CPUSH4State *env) /* The entire region has been translated. */ ctx->envflags &= ~TB_FLAG_GUSA_MASK; - ctx->base.pc_next = pc_end; - ctx->base.num_insns += max_insns - 1; - return; + goto done; fail: qemu_log_mask(LOG_UNIMP, "Unrecognized gUSA sequence %08x-%08x\n", @@ -2165,8 +2163,19 @@ static void decode_gusa(DisasContext *ctx, CPUSH4State *env) purposes of accounting within the TB. We might as well report the entire region consumed via ctx->base.pc_next so that it's immediately available in the disassembly dump. */ + + done: ctx->base.pc_next = pc_end; ctx->base.num_insns += max_insns - 1; + + /* + * Emit insn_start to cover each of the insns in the region. + * This matches an assert in tcg.c making sure that we have + * tb->icount * insn_start. + */ + for (i = 1; i < max_insns; ++i) { + tcg_gen_insn_start(pc + i * 2, ctx->envflags); + } } #endif