From patchwork Sat Apr 18 16:19:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 185556 Delivered-To: patch@linaro.org Received: by 2002:a92:3d9a:0:0:0:0:0 with SMTP id k26csp1900614ilf; Sat, 18 Apr 2020 09:20:15 -0700 (PDT) X-Google-Smtp-Source: APiQypJd9NHU4rdd4qY5lwhM7+dmESK20qBqd7GunId1CPP3ljBlvCmeJUqWouJD2UDy13tJhpz3 X-Received: by 2002:a37:8781:: with SMTP id j123mr8619765qkd.308.1587226814992; Sat, 18 Apr 2020 09:20:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587226814; cv=none; d=google.com; s=arc-20160816; b=rKXQ6RHNmH6I2SBHMdNaghcpUFbXChCVyxG//cKclL8LpNsfsnyTRDtIFt8R8Nl5Kp w61RfS8czRGOH6BOYLbrBwsDkayikxS+RCDRna92O9PrnatoOGPn9TWJ6cdSSiGnoAih m2RLzglS9nsS6jcbCuhO/dkYsEpi5Qf5OEszLpbtSsTacPzJBJoDOtmhXswUV4423H3H PdMYUH7w2C+ErN9OkqAR08WmK5xydSxLPNtlVBeIsSw4JRnJG4GVeqP2vr4M7hxI7lQJ JxSxp02/svpfIG/qerdeJKRZ/SmCynPUIrGLXR1JPJrK4VCR7gAiEfH/jql5+4pKXKYi eHNA== 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:to:from :dkim-signature; bh=/fduq7+z5S6wjChMKi9oJb/vmTzyRgenbcyuQtF0AWE=; b=R0tFEvJIre4gqUG57mVIb4wMrEpEg4sn94nC4OMmFT5z/M+EedFUJfWYz4134J7LnC Bcg53qzTIKpwY+rSDBycSa6JB95enTzWymysKF1YF+RB9v+R2NbVRFuhTmzJDp3xTr0t hyE5w3xpIhYjHx6JHE4+jry/m0svzpcG+37frcLdOtAcN7ed9gkwG5iVn4Y2nsMNIVJC OGAiRx3UByflc+zKyu8Jxx5BZavGJZTkOhTNH21gi1INZ3+T27LytOJ3YKU8VGmkMq4r rc6J7xU1zJoH8ei72K86hXLT4xU/D3/k6gFaOtMbgn2i1pW1jWVKd5YGntmWtV6Mhzai XZOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kpu9n7i1; 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 y5si9070395qty.313.2020.04.18.09.20.14 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 18 Apr 2020 09:20:14 -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=kpu9n7i1; 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]:59512 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jPqCU-00049O-GV for patch@linaro.org; Sat, 18 Apr 2020 12:20:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48114) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jPqBg-00046r-JC for qemu-devel@nongnu.org; Sat, 18 Apr 2020 12:19:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jPqBe-0004uO-FZ for qemu-devel@nongnu.org; Sat, 18 Apr 2020 12:19:24 -0400 Received: from mail-pj1-x1043.google.com ([2607:f8b0:4864:20::1043]:51723) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jPqBe-0004sR-9Q for qemu-devel@nongnu.org; Sat, 18 Apr 2020 12:19:22 -0400 Received: by mail-pj1-x1043.google.com with SMTP id kb16so2558703pjb.1 for ; Sat, 18 Apr 2020 09:19:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=/fduq7+z5S6wjChMKi9oJb/vmTzyRgenbcyuQtF0AWE=; b=kpu9n7i1gDNQH7fWevb1vvS82BmFoT8ajpqan0W86tzv3rJfWeqtEylutyfS8tydi1 5TWeEs0fpHppawRhv2WPcDexQmT9VIOojjNVVne23o5dQBVyV6pjile3uZEkjmG7FeFW olDsYIpt1h3UCv1PLjlM+exc0Oesr7LuPiD6ejcyXZzCtKnuUYCpsiD57oU1E9LsLq7M 5pLTyUAsa6oAgdAJ/m/h16AxlzDZqagP0LxWvA/x72nS2PvVcrZYL9GRHqGKc675O5gC csAC4Oz7dvBVVG5m1gTgY0H3ZPu+G4ZF4wplZgFTZ879TC+R6s3I+QuqhHu4FLt5P5Vw mIIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/fduq7+z5S6wjChMKi9oJb/vmTzyRgenbcyuQtF0AWE=; b=UEsuqhfB70FRSiCKIUuAXlrCGDEqBrvKHsQV4oE2c9MPscvTL3VEj2UpAOnNkM7PqT xJiKbRVP+N43Pc15DK3PEJaSN1AVbaH8Z//qcYAL5ZiOhQi4jZx9xPY3W2e+JQvCuL89 idf+qg7rqtIjtiwWvLokWYBYxaz4wacIW+GMfx1t1YyTtG6JOwT+ZGxvTKqhSM8De4Cv PYTFWiGgxTbqYHSYjbyi4dh3Ctmyv6asMlD2BZ1JmChq3eQZ0ZvFxj3S4nbvnzDCMz/a o6+/4bCSgyyKH2GO5tOmKLtJ9ZiIJoNS0Wdxa0Zg+wgcaPJOadXhdDojp8/OCzyxxNPO EviQ== X-Gm-Message-State: AGi0PubwPe+68MZqWhAH8jqJ17Nd/czbB8GFnqj16Cz392CjxXYX0FIk zoOYZsYEs4crU6+3X7F9qDNGmYL5Mw8= X-Received: by 2002:a17:90a:2023:: with SMTP id n32mr11250411pjc.150.1587226760981; Sat, 18 Apr 2020 09:19:20 -0700 (PDT) Received: from localhost.localdomain (174-21-149-226.tukw.qwest.net. [174.21.149.226]) by smtp.gmail.com with ESMTPSA id i187sm22398382pfc.112.2020.04.18.09.19.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Apr 2020 09:19:20 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 03/16] tcg: Use tcg_constant_i32 with icount expander Date: Sat, 18 Apr 2020 09:19:01 -0700 Message-Id: <20200418161914.4387-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200418161914.4387-1-richard.henderson@linaro.org> References: <20200418161914.4387-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::1043 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: , 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 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);