From patchwork Fri May 8 18:26:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 186420 Delivered-To: patch@linaro.org Received: by 2002:a92:8d81:0:0:0:0:0 with SMTP id w1csp226264ill; Fri, 8 May 2020 11:27:13 -0700 (PDT) X-Google-Smtp-Source: APiQypKSGn6xXbWu/kl1G69nV1Srf0qE+ywGQgvnNqGe+nPYE8aZt8+VyRLFhPey3ibXndhbevJt X-Received: by 2002:ac8:80d:: with SMTP id u13mr4558213qth.355.1588962433609; Fri, 08 May 2020 11:27:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588962433; cv=none; d=google.com; s=arc-20160816; b=kQTkzdqE8C8PsndBhgB48tuxUp6sXQAhzDlcWawh+k2LLCuEj53OIb/Gbp7naRWE5V dwjTHJPPbSyefkzeQ8hKPdxzMMvMrZa3tRYh/2ygNP0OZvkiNlbr9ox8ob/tb832EEL1 DohOyIG4x2liMf0ErNnoHPXaJKCAYB+RNyczWmvD1rYUBST+od8mQ00iuJmzLOq+PADM NtnHdBLmdTzlldNotdh1tARax36lgEhOaYX4OhFfgv+ZUDG6UEEwuLjmGXF5Udkib5q9 IaBy5jKYEDMIh5+t13DkVHACHACzYTHJ+7hXZWQztdIruUonUrw2Lbm9bGVVCP3nuw6a X3Ng== 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=Wot8cVjNfhYdwjbPEb/DRxN+VrYjwXPiNxtZudeESRQ=; b=V0GBQGUGWiWRuJiAJvlNO1wLzZQ5O5TN5IiPQ2+UgZKRSOGg7MsL2pwYP75LiE3QCi pfisa02X4cPzClRIKzlvXlD96xv+0Rq+ewPC8unQ5Rs4wNiIAzkk7SPhSYIfpC+inyE6 FIALCHD8DEIbSHYhWaHFR6iVGeCorpZ5q77qKV5I4OPww5UvI7l5QvUXYRIsIrRxph1+ 9uyrh+g7fLu9Wao2VPiGiHECa1VhCCs7/fFBH/vDDrveMWIe5jHa4r9qHCHQ3sASpN5i YrKRigpGxqbpCNTq3PYnd+415rxbRymoL2uhY5JRNt9ZkuQJmMtL1znkE8+xgXpEVU/D gi4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=a6SPl4BA; 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 e19si1831316qtw.377.2020.05.08.11.27.13 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 08 May 2020 11:27:13 -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=a6SPl4BA; 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]:39874 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jX7iL-0006jE-44 for patch@linaro.org; Fri, 08 May 2020 14:27:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33670) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jX7ha-0006gA-IO for qemu-devel@nongnu.org; Fri, 08 May 2020 14:26:26 -0400 Received: from mail-pj1-x1042.google.com ([2607:f8b0:4864:20::1042]:37278) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jX7hZ-0005lv-Kb for qemu-devel@nongnu.org; Fri, 08 May 2020 14:26:26 -0400 Received: by mail-pj1-x1042.google.com with SMTP id a7so4658775pju.2 for ; Fri, 08 May 2020 11:26:25 -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=Wot8cVjNfhYdwjbPEb/DRxN+VrYjwXPiNxtZudeESRQ=; b=a6SPl4BAn/u6jCrm6XqJHdrAHjpVXFoAQcKB2decqWsbG3SmEhgTtoYyGLJVOUYglj Q06YUEOE9nOdaJaklkLVw+2iE1vzXyPI0EkKxbfgTneQMMWSQ8VIF1ERemA0jkuARDYg azypeJjQfCpAfTBvFE9SR3WREJORrNuzxTPwOGD0w1fijgDPhMX1KFbotw9kH3NlR+D1 qMEGZMjfCQKUa3G40TN2k951xRebs7jHvH3IsqDb3fQh3QVZjf5QZlpP+G3+vjcUmAi1 jiLsW+8FW3fvkSwgK6AyfgpLwsntr4PrhjjQqxPfJr1ww9A/RTfoiCc/VZm6eobztx3n XZgQ== 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=Wot8cVjNfhYdwjbPEb/DRxN+VrYjwXPiNxtZudeESRQ=; b=N2e/gU/TCMkZkK3ovRaCfHfOgqQMVNC93MWxG2Ynt2XZ1lqcL8KWLRnh/8PBtdB5wS jC+GuwnayQmGSTeOq1nPNhONbVQ5QYJ72NJsg8+VVMHKQh31ia8ybLI+Hrp0fJ8SoJju bWOOhXU7j54BroDiPTzDiXVbSj8CxX7ISuTki0XbNispCPaYx2vOvvA26SAshIr3wog6 MhrUMA2SBtF2Q2Wl/kDFi9jwI2jwpUekS3vQ7ujtMUEbgeFJpjeG0Eusd5BkXYvV7yad j+aZ0Sxds1mqXoWp0vig5dDtgtHfS7pTsrbCDv+20gNIpYodO5lj3Vo6H5+SWvvqZa6T qAlQ== X-Gm-Message-State: AGi0PuZa+vUeD2P09KFwymm2dTf2shyKRJZPLYVfuBS6DzFnkrgnYijI z4h3NC/lQ/Eq64wqskmvOmrldZAouW4= X-Received: by 2002:a17:90a:20e2:: with SMTP id f89mr6773438pjg.205.1588962383862; Fri, 08 May 2020 11:26:23 -0700 (PDT) Received: from localhost.localdomain (174-21-149-226.tukw.qwest.net. [174.21.149.226]) by smtp.gmail.com with ESMTPSA id u9sm2421775pfn.197.2020.05.08.11.26.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 May 2020 11:26:23 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v4 04/19] tcg: Use tcg_constant_i32 with icount expander Date: Fri, 8 May 2020 11:26:01 -0700 Message-Id: <20200508182616.18318-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200508182616.18318-1-richard.henderson@linaro.org> References: <20200508182616.18318-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1042; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1042.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: 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. Reviewed-by: Alex Bennée Signed-off-by: Richard Henderson --- include/exec/gen-icount.h | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) -- 2.20.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);