From patchwork Thu Jan 14 02:16:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 362804 Delivered-To: patch@linaro.org Received: by 2002:a02:ccad:0:0:0:0:0 with SMTP id t13csp71017jap; Wed, 13 Jan 2021 18:28:39 -0800 (PST) X-Google-Smtp-Source: ABdhPJz9LY3ps5mqmpMgEsRwGdhGcLvyxjzX2wYmFBD+0c+dVmTJkxfz2xlrqjo55/Gg3Xmy55BB X-Received: by 2002:a5b:a8d:: with SMTP id h13mr7095074ybq.170.1610591319045; Wed, 13 Jan 2021 18:28:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610591319; cv=none; d=google.com; s=arc-20160816; b=SUuUzHZ1t2z2lQsP+CNHc08ZC4c40w/3/9bH+YwJnvJtcTdf5aF6G1PAechUb7fBFr II6rZwnT6oFMyPihZ5d94AkuBgJ/QpTCLaJTDgvmVjDx9posMWYeFC0DlfUGfCKf39g4 4fwE23U8nP7AJ9NBFn/KyZN+X/38t4vfgInsuA3rZtaWra4YlMFDdcP3wkewoYeEvK1h DKlJ7oDmM2nXDg/lJMon4TRo4GYXhvDmuHVSgutfXHVSJ9T5fYTykgjhcpURDCR29fU+ jONXrdcJYj5pxXl4MKmusPHmDC/dCtut9/7CG6duyfunJS69vvwfZjNrveohirJxjJhQ 4Z9A== 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=tYsbmjolK+Eg4JFu4uyWsu7Q9CaREMLO0zlw/InU6fk=; b=ioeLrRfS6WJni7jLrigZs3CoMI4NVbd2G5/mI7pz1pTLpdtsNCTKRKmnswNqudLH1I DpdQnNZsj9In6Zbw/HVShVkueYsSn7cpNwT7LruifxqWcm641wvYTFYpxvJdPA7Lm24A u8iiXNIEDnbcy161nOjuWKpU/PXhfT3OU9zRbKB8IvUyM3Iz2ckgg8VUFIwlp1CU+FY8 GWIZZojzh7N5KJpBcG7mtmOq1tdNJk235FXI7KlChZtl1xcx1a/nUWYhPP4JFFTuCy5Q UF8megnmcmJNtUfVNXAXiQ5x336yKzoFH3sascNJT2e5ypjLRgyTRYz/0SYfXJZa4PHI tSMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=y5RcDgq2; 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 y10si3428895ybr.300.2021.01.13.18.28.38 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 13 Jan 2021 18:28:39 -0800 (PST) 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=y5RcDgq2; 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]:38432 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kzsNK-0000L8-IL for patch@linaro.org; Wed, 13 Jan 2021 21:28:38 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60366) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kzsCc-0003eT-C9 for qemu-devel@nongnu.org; Wed, 13 Jan 2021 21:17:34 -0500 Received: from mail-pg1-x534.google.com ([2607:f8b0:4864:20::534]:41145) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kzsCP-0003TR-SI for qemu-devel@nongnu.org; Wed, 13 Jan 2021 21:17:31 -0500 Received: by mail-pg1-x534.google.com with SMTP id i7so2734015pgc.8 for ; Wed, 13 Jan 2021 18:17:21 -0800 (PST) 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=tYsbmjolK+Eg4JFu4uyWsu7Q9CaREMLO0zlw/InU6fk=; b=y5RcDgq2fdst/kBTTQbLorBBSIs0VaKJXmrZWD++/CRbwTCbij/FJkj4/RrNMi2cPk XOeaecF7GTY+rTNcDBhLdyk6xyXykujqhRGbJTrhkPGIQ94i3yDV3f6a3Zcb22bidsJP TSw5vCj08V8/OT4JN04k6RJwZ7UUYS3U1yC+CQa8gVK/xJplDUdz9Dd9c3Xx8w8BGqxJ HXW6D2ROPVG1IeX4EVSYNmfJnT5NrKxwzDFp490Y4kAnt1V1yriYZfIIFYvfvT9jXzNT ds1WFktaws5cgA33TXrlCc0ZA+r2R+rkTHiMxM8lj+kSuqotBVj/p6h+kElzZzMepyTG EnCQ== 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=tYsbmjolK+Eg4JFu4uyWsu7Q9CaREMLO0zlw/InU6fk=; b=JaPX4CmeTxCw/JJ9tgQIgm6Y/6hMx7cp+7MM7dT0cU8opb6npuAoOrYvs0QvueJR0r Ozg74oMW8lV4wEDPYF1keszhDXk9hJLYmeTJllLcOV4w1WAxce5JEy/V2U0u98DYNAKj MvnsHywm75XBPIlGt5qvDlhgh8FNO8iJ0OzgqwUw4CJ4OaQdSMXeJUTJrCb6z54X0YSt dD+TiXfxjTjYmuFQyclWZ8cc8vmB6VPP8SOGv6GJznlbuD8JUnyjKuXSXkOv0GG2Qq3X a7TaR0yUbKUgkelOAeS+T1LiYShgS+3Qdfj8EAXkgwJWY68MnwU8WWND7oLJccytpF+W W41w== X-Gm-Message-State: AOAM530Ng04B2wT0bkIvKsbwEqVFOzUONvnpAQF9hxSHvBb3M6tNGRLp 6bQcAq+GlHC4Gl4lOv/JEwWJbV7yBj6nOw== X-Received: by 2002:a63:ff4f:: with SMTP id s15mr5075928pgk.62.1610590640158; Wed, 13 Jan 2021 18:17:20 -0800 (PST) Received: from localhost.localdomain (rrcs-173-197-107-21.west.biz.rr.com. [173.197.107.21]) by smtp.gmail.com with ESMTPSA id i7sm3771687pfc.50.2021.01.13.18.17.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Jan 2021 18:17:19 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 13/24] tcg: Use tcg_constant_i32 with icount expander Date: Wed, 13 Jan 2021 16:16:43 -1000 Message-Id: <20210114021654.647242-14-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210114021654.647242-1-richard.henderson@linaro.org> References: <20210114021654.647242-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::534; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x534.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, =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" We must do this before we adjust tcg_out_movi_i32, lest the under-the-hood poking that we do for icount be broken. Reviewed-by: Alex Bennée Signed-off-by: Richard Henderson --- include/exec/gen-icount.h | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) -- 2.25.1 diff --git a/include/exec/gen-icount.h b/include/exec/gen-icount.h index aa4b44354a..298e01eef4 100644 --- a/include/exec/gen-icount.h +++ b/include/exec/gen-icount.h @@ -34,7 +34,7 @@ static inline void gen_io_end(void) static inline void gen_tb_start(const TranslationBlock *tb) { - TCGv_i32 count, imm; + TCGv_i32 count; tcg_ctx->exitreq_label = gen_new_label(); if (tb_cflags(tb) & CF_USE_ICOUNT) { @@ -48,15 +48,13 @@ static inline void gen_tb_start(const TranslationBlock *tb) offsetof(ArchCPU, env)); if (tb_cflags(tb) & CF_USE_ICOUNT) { - imm = tcg_temp_new_i32(); - /* We emit a movi with a dummy immediate argument. Keep the insn index - * of the movi so that we later (when we know the actual insn count) - * can update the immediate argument with the actual insn count. */ - tcg_gen_movi_i32(imm, 0xdeadbeef); + /* + * We emit a sub with a dummy immediate argument. Keep the insn index + * of the sub so that we later (when we know the actual insn count) + * can update the argument with the actual insn count. + */ + tcg_gen_sub_i32(count, count, tcg_constant_i32(0)); icount_start_insn = tcg_last_op(); - - tcg_gen_sub_i32(count, count, imm); - tcg_temp_free_i32(imm); } tcg_gen_brcondi_i32(TCG_COND_LT, count, 0, tcg_ctx->exitreq_label); @@ -74,9 +72,12 @@ static inline void gen_tb_start(const TranslationBlock *tb) static inline void gen_tb_end(const TranslationBlock *tb, int num_insns) { if (tb_cflags(tb) & CF_USE_ICOUNT) { - /* Update the num_insn immediate parameter now that we know - * the actual insn count. */ - tcg_set_insn_param(icount_start_insn, 1, num_insns); + /* + * Update the num_insn immediate parameter now that we know + * the actual insn count. + */ + tcg_set_insn_param(icount_start_insn, 2, + tcgv_i32_arg(tcg_constant_i32(num_insns))); } gen_set_label(tcg_ctx->exitreq_label);