From patchwork Wed Apr 22 01:16:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 185625 Delivered-To: patch@linaro.org Received: by 2002:a92:3d9a:0:0:0:0:0 with SMTP id k26csp164605ilf; Tue, 21 Apr 2020 18:23:57 -0700 (PDT) X-Google-Smtp-Source: APiQypL9pRE64e1hPhAQIjmCTC/NeRY7xhXoWDHwAA3DPLmv+i269k3o4Qb3hbim+SaIz6ii6Yux X-Received: by 2002:a05:6214:17d0:: with SMTP id cu16mr3906678qvb.177.1587518636967; Tue, 21 Apr 2020 18:23:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587518636; cv=none; d=google.com; s=arc-20160816; b=mql2v0I1zUMfuMtupRN1fTKFqBzET8XSwebFh/o03RSWwUl1AlytqyDt6Ut8hXTE+R qjBg9YdeR6owQ+sJLl+FVTW7IntzDQXHDJYbsVqCCDaLdEMSkbNTJYVdTP5JIMwhJWNF iTJ9N9dB7WXyUwrJT6Lb3bmI6mO1XSbXPMaZusNyBVH52Rt/2+aq97AdTKMkHZYaR2xV d6NWHgE8Flb1xK69SvDRVJwI92W1kxJtN/u3d7uiTB3cwHBz3P0+FXMyI5wPCgMgDwG1 b8xz2PXC8BG7+HmkqDofn3MHbDDXmNBcyXkEOe1hKTl5uRUfcy2WlIxHFlToez7BnJJA ktBw== 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=/fduq7+z5S6wjChMKi9oJb/vmTzyRgenbcyuQtF0AWE=; b=AFy2Z32oSogSvRKM/XPDRl76Oez0o29Yyin11S890FLCDYpBjJIplAVZxpGP+cLIGb CHekO4BdavyU0i9e8l6/6gtFnQzFEmo7yyObv0bJToN43JFKaex2e1qxV8codeRR9lEt szhoPLfcEW9CW9GRaYO19b607DBjW1n1HRpVOrXblaMVDPKElT/awR7iZiPl0LbFyq6w PFIdsj7BdJAzT5zysCI3ajLaxXVdd42Km4ET0qB2lTaTjtxnGPj3+6OxIdkuS03NNMUR ckGfcgFmNnXXQ+wtsKDtSWGBArh7jFSC9Ikus4x06Ixe1xLtnEdETieWhmK+9X/EBlzC yuqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eepeh7l3; 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 b2si1091759qvq.200.2020.04.21.18.23.56 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 21 Apr 2020 18:23:56 -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=eepeh7l3; 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]:38730 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jR47I-00043U-Gj for patch@linaro.org; Tue, 21 Apr 2020 21:23:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34596) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jR41G-0001Pi-NG for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:17:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jR41G-0001hR-4x for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:17:42 -0400 Received: from mail-pj1-x1041.google.com ([2607:f8b0:4864:20::1041]:36749) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jR41F-0001eN-Mx for qemu-devel@nongnu.org; Tue, 21 Apr 2020 21:17:41 -0400 Received: by mail-pj1-x1041.google.com with SMTP id np7so161265pjb.1 for ; Tue, 21 Apr 2020 18:17:41 -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=/fduq7+z5S6wjChMKi9oJb/vmTzyRgenbcyuQtF0AWE=; b=eepeh7l3HyUvBzT1ZPXSW34WY1k+DFmtIsHfZZ7I5nvoOr7OnMFU3YjdPr6GYXYqoy c9tIrsdw8a3tkDgb3kTnwa0ITB14lWUGW1hssACq+ig5JGeUCFNPnLoA2zEpIrwbptk2 aPBQVmM7DozoBlRIAELDKzMp1O3i0Gj9XldEqa3+bFPTIQXd7RXDfvrMr8SSpKm767Pr z4afFFHInEQfP6ufaw9Tr6s9yk+6+gMgaxnnXmEehlsIHty5OUbbNsb/BDdC8sjRr8Ud G7Udl6z/ZNBCswye0rIy9KHJr10NyFCtpEwmZnhJ6qeA2KPfXBtx55JM6Pbebmr1KBTu qElw== 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=/fduq7+z5S6wjChMKi9oJb/vmTzyRgenbcyuQtF0AWE=; b=eee5yeexsVuOlcSYDo0kfMdpuHQoJAvK2mPROtay138bN1qSN5KJR8EeRZ5jz9WrOX Ip2c3zFuRtwu72vwGPhYkxzIRwRWgCW7L0OR5Nb4d2cGHLRPRXUimJNj1e6CDmfyBhL6 yqvEvImil2RnUsDfVbX50OigLb8m8UYXaCaCVxAFO7/a2mfQYhcSsBL9MgPY2jdhjEvL VPbDBe7z/cTgCH5vpxhtR62X2VY9zDCgx/f8T/itfSP4ctaknQW6NF3UPkkxDkkML4m5 7ko3JOXnAN5iz6/esBH/lIu+liviqYijZLc/tdsXl0cMVqHJzijEdxC1U8TmwxfVL72N tvAw== X-Gm-Message-State: AGi0PubOTriFOAE19ZpAdoR2DH74T/SF2f33il+7ozmzMnh1qINBKn0V kKj3glvKrydk18THYbm8ZjW13iZ+z3U= X-Received: by 2002:a17:902:aa43:: with SMTP id c3mr12411135plr.7.1587518259985; Tue, 21 Apr 2020 18:17:39 -0700 (PDT) Received: from localhost.localdomain (174-21-149-226.tukw.qwest.net. [174.21.149.226]) by smtp.gmail.com with ESMTPSA id m4sm3673561pfm.26.2020.04.21.18.17.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Apr 2020 18:17:39 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 12/36] tcg: Use tcg_constant_i32 with icount expander Date: Tue, 21 Apr 2020 18:16:58 -0700 Message-Id: <20200422011722.13287-13-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200422011722.13287-1-richard.henderson@linaro.org> References: <20200422011722.13287-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: Error: [-] PROGRAM ABORT : Malformed IPv6 address (bad octet value). Location : parse_addr6(), p0f-client.c:67 X-Received-From: 2607:f8b0:4864:20::1041 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: alex.bennee@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" We must do this before we adjust how tcg_out_movi_i32, lest the under-the-hood poking that we do be broken. Signed-off-by: Richard Henderson --- include/exec/gen-icount.h | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) -- 2.20.1 Reviewed-by: Alex Bennée 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);