From patchwork Wed Sep 9 00:16:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 249416 Delivered-To: patch@linaro.org Received: by 2002:a92:5b9c:0:0:0:0:0 with SMTP id c28csp5018140ilg; Tue, 8 Sep 2020 17:28:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyp9wBxonOfzNe8cTJZdD4q8q/FcVLhMV5IfTSxk3gbZOLORB+Xiq1nCzYXrF+MdPZOvE9c X-Received: by 2002:a25:ad22:: with SMTP id y34mr2191517ybi.52.1599611297436; Tue, 08 Sep 2020 17:28:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599611297; cv=none; d=google.com; s=arc-20160816; b=sZA/kvVDw/Npss1N1k6VeuVRviAMu53IDohY5d8A/g6TFJUZ6nF2PKCk5K0fD1lrMZ vO1iu9woK+Pi0T/JUxqFZTEbW0BhQqXnk9c1d46vcOu6rgPMYfxxQ5BdT4L7JoBHwxTA 91PrGYPMVuo7AUB81aKbP5ZgH75FE2hdmEPAPRSkkdrhEjTDYUWppN2DUoRIXzxaSNS1 WicuDHJ38hXYuDWYBPJIHd883Dy4yTsWrn7+fLzpxeFusuqkl+iDDgo7gfAfMhdaD45Y z87oGU6SmQCf4DlsX8y0YayXSNqCjqvNnuDJbO8I6JDNp5VwAhuM4pMr400hikx56rOQ YpPw== 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=mEMZJyAsz2pya7wCS7q3Y/mkN8EK0RWNbiEA9tVJa2o=; b=uEIPMS6XjlPIWO8s0thYXjt1Gf/vukEOR0n/uGaDYs62KJb239MmPCzyDyAnSFj9Qf 0QlC9H8hLybeGcpUhRpgt4n79Ba1gHnS+KwirkZJHZvWhqf++oX8KB0YIDfUFkXR2V2+ ksN7x7TSX0ViKQvEiVHnAtl8xKLRA0MVc9K6OTa2QyZdhQ/II31Qkhlbz0S17Ox+r9Q0 IEAYCF9GWnJSJv+QUXRgL8sidmTNl2Y3uuhHF5ZSJomn06ae5YaracAu1D2x5ftyDu7Z 5hlAe0RSvmLAGm6JBeFPR6PQe3mQDwfZf4Vs8wdQ4oXblEEwoIYxOmi+sY1c6Uk2V8+P x9jA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hDMoKmOZ; 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 e14si1048915ybq.296.2020.09.08.17.28.17 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 08 Sep 2020 17:28:17 -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=hDMoKmOZ; 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]:60388 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kFnyC-0000ji-TP for patch@linaro.org; Tue, 08 Sep 2020 20:28:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37630) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kFnne-00004v-1e for qemu-devel@nongnu.org; Tue, 08 Sep 2020 20:17:22 -0400 Received: from mail-pj1-x1041.google.com ([2607:f8b0:4864:20::1041]:35442) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kFnnc-0002GQ-4Y for qemu-devel@nongnu.org; Tue, 08 Sep 2020 20:17:21 -0400 Received: by mail-pj1-x1041.google.com with SMTP id jw11so439080pjb.0 for ; Tue, 08 Sep 2020 17:17:19 -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=mEMZJyAsz2pya7wCS7q3Y/mkN8EK0RWNbiEA9tVJa2o=; b=hDMoKmOZUUGjVln1k5ny28MW96Qbh1XTQSp25eRLt+a78DImCkAPiJQgIN2hcVVDfv xmcvps+GOLKl1faGvT4WTqnivlv2yBgxbFSmf5rTj1BS5hKosDSI2wn0JyUaQE63yRB9 cw8Ot+FYm1klluQTT31LqBYNdNBbzaRQzJ92Po23qva4Z1VZ5RIRohmn4s2Q7wppnXf7 td7oKvhzO9bq38+AzDJDWFOexMDf1KCaoQQnsmvtMPVilWybzKxKa0AXbD0K7c9k5iha iULI1fhNgAZp9CKyBePgcudI6R0rrDM0/qTzGRpPfc7DKkNgrINFG42w0SGVk0yTPkBs +GXw== 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=mEMZJyAsz2pya7wCS7q3Y/mkN8EK0RWNbiEA9tVJa2o=; b=MSlQkxwda2HqwzKkQ87r7FyYQ/WxMCAox2V3870geRrDubRVQOzS6xryXPu54+icKt AT+0HngjIkcSxbKyNXG6Mr4MGUPGHQdXIQiW/Uxp0xBUS9OpRf5Zy0KfRLQtdYIb697Z OK1AM2mC0i6WxpjlEGEgzc4Yo4c+6i1RtuGBkvNrq6IOmdwegX5N0WGKApADBDSY6MvW y2DM7MwIZbm7OhoNo0BVmHlsh0BErDkiRHD2/CfScfOMKzzBh1iBNg/28PkKd75Db7eI axdG7ElfHZoQ4z/FY+vhvlSSVHSPmlOgWtmp9MM8MTGD2n82xDsUVp/+U1UmrIgKGuin Xh3Q== X-Gm-Message-State: AOAM533iYMN5s1N2Y5gyg/xcG67KfCl5TYiXOEJ7kfMenHa5PCHeOeNP Io0KbLam/USAhbMVJ0hBlxB/HpWl616ysg== X-Received: by 2002:a17:90b:715:: with SMTP id s21mr1128445pjz.113.1599610638255; Tue, 08 Sep 2020 17:17:18 -0700 (PDT) Received: from localhost.localdomain ([71.212.141.89]) by smtp.gmail.com with ESMTPSA id 137sm505437pfu.149.2020.09.08.17.17.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Sep 2020 17:17:17 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 23/43] tcg: Use tcg_constant_i32 with icount expander Date: Tue, 8 Sep 2020 17:16:27 -0700 Message-Id: <20200909001647.532249-24-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200909001647.532249-1-richard.henderson@linaro.org> References: <20200909001647.532249-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1041; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1041.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_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: =?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 822c43cfd3..404732518a 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(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(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(TranslationBlock *tb) static inline void gen_tb_end(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);