From patchwork Fri Feb 4 07:00:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 539863 Delivered-To: patch@linaro.org Received: by 2002:ac0:f7d2:0:0:0:0:0 with SMTP id i18csp3039055imr; Thu, 3 Feb 2022 23:39:40 -0800 (PST) X-Google-Smtp-Source: ABdhPJxCIiaMPYoyHNxwFlxBKuGLJ8jZ0+RaWXuROc600SF2IXcunnfKsCF2ctBAIow/dBU53y49 X-Received: by 2002:ac8:4e48:: with SMTP id e8mr1190661qtw.64.1643960380074; Thu, 03 Feb 2022 23:39:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643960380; cv=none; d=google.com; s=arc-20160816; b=K4gMhcay+yrsYkmqth9ZZBG6q3FLfCldca3l5ctynRDGRcvzwEUYqG57RqrdIT2ZZC STtD63+ERhNfAJX0zUfxT2f8ed3q7Oe0EEeKjgDLkqNb7Zr3k8hcku8TIfMxdec/MkOq Flm4wag1KXfStbMLaFSFObNV2n/rLfXzGeyRUeM6B/L+mg9u1EZFRqcexZuwvvu6mJzd rUF7FPdY72oZro0Zo/dz8ckleqNGnrPBEMPsUDbvrYU7QpkuCSQ0tVflpy1xbSOCM+c+ pZ3XhaLFtqZ/TlOnkEKAKSm9w/kRk6dAxxd7JW7YSPKgugqKxdk4Qj/10Lr8myULd5H1 bojA== 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=l5/xMg5JmnQhX3P7JdxIT0db5qBXvDtWPFnoD+IGj8I=; b=muKga/otFuLw13/Q6DVy5eK/vwDg7pFBsVN7dgjtY9if/e+vOOnq+4Rc3FWb84OiY5 IY6CecQRSrcdJfWhq5LOV3n//j3jW2brUxOBkYeUwbXhWv94XhsAEMa0p+375Hdqi2o2 CScDp0bfUgw/eRGkduf/PloHohP5+hTnDzkyYj/6BZGMmJOhi4+IMjOnrAdkvR37tDfc KxAGF6xovwzqUfWLNybtwl2tVBT95UfR8sIsiqq2cCockP2nHwHFew/TWwOfEx0RLjPh cezItEty0KOXCgboi54Z9ugyJCPOmNCSjP98+b7dKbBAC8WK6aKfJeZLM4xhUfyTW0Mn 0x3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="bXJQ/8IB"; 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 a16si223731qtx.786.2022.02.03.23.39.40 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 03 Feb 2022 23:39:40 -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="bXJQ/8IB"; 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]:33282 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nFtBz-00066u-KE for patch@linaro.org; Fri, 04 Feb 2022 02:39:39 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35440) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nFsa3-0006c9-KV for qemu-devel@nongnu.org; Fri, 04 Feb 2022 02:00:27 -0500 Received: from [2607:f8b0:4864:20::102e] (port=41596 helo=mail-pj1-x102e.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nFsa2-0006TO-39 for qemu-devel@nongnu.org; Fri, 04 Feb 2022 02:00:27 -0500 Received: by mail-pj1-x102e.google.com with SMTP id p12-20020a17090a2d8c00b001b833dec394so5392593pjd.0 for ; Thu, 03 Feb 2022 23:00:25 -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=l5/xMg5JmnQhX3P7JdxIT0db5qBXvDtWPFnoD+IGj8I=; b=bXJQ/8IB8f2eItNjAmaictFyZ3hbsmvtOLBwaRSvHSVNnVFH7SGPqlXJwuFeXrLSc/ 5zcGx7MzYyoc5dS4cDfKXxtF/S8Z6/kNay5Wvv3HqWMb0Ik7h07sXGzdXpQBXHRW521W LJtRcNY8rfStopif+gNOF3B4+Np4JfFcfCjfmxrZQpAq/Cemz+0yee6P2bVDb+VgYgSa 6irHUf8QGEHqeCUV+9z8nQMpBR0VfX6Imhu4SZGIOUaZ0vnsCBcBLPOY9yunOWwlCyzv VqDI8kewZ/KB0X6c5+4Ezz7i4i/w+xtj4wA/LFtUg/NyBt/JF592PPIRaYbAmcu1NkGd vgwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=l5/xMg5JmnQhX3P7JdxIT0db5qBXvDtWPFnoD+IGj8I=; b=bejpC5vWmTi7pnSiWwMUdvjy5WDe29xpofHwYiadPMPw/0biA+CMDl+rOpqY7Z67Tn uleWekg6JfPrwbObrqaS2svTvotjXwBVcwnF6FePAHEraNqoZYvXBF/oRIM3ogPaA+YF 45VPQM6fNfIJE7kCeSwezkyxyovdxpx3NcjD9vjHgXtoe3+eI0Zx2hMSICqLBT6PgneX M6mdqrGlfc9QqFBlgv/cc1MJfFLkwFAkoYwIKsxl8rF594i+5PSPxCzC/xMW695kA669 r1W0nir6cf3TDL+BV7gRaaimWYQ0JLUCI4+qc2IYSMP5dd7crK6ztH9n29aHQTxwlPhS 0Tog== X-Gm-Message-State: AOAM530CAjCtriseih+sPFDzxM2m4/tRYpKGMWowFplVRwdzNVSMuS8d fNTEUxmuQchDgqYhrlmz347PIYLbsC1mLTcF X-Received: by 2002:a17:902:e849:: with SMTP id t9mr1656207plg.106.1643958024563; Thu, 03 Feb 2022 23:00:24 -0800 (PST) Received: from stoup.modem ([2001:8003:3a49:fd00:ed23:b22a:8415:8857]) by smtp.gmail.com with ESMTPSA id 9sm11808619pjg.50.2022.02.03.23.00.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Feb 2022 23:00:24 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v4 3/5] tcg/sparc: Use the constant pool for 64-bit constants Date: Fri, 4 Feb 2022 18:00:09 +1100 Message-Id: <20220204070011.573941-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220204070011.573941-1-richard.henderson@linaro.org> References: <20220204070011.573941-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::102e (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::102e; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102e.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 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, PDS_HP_HELO_NORDNS=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 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" Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- tcg/sparc/tcg-target.c.inc | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tcg/sparc/tcg-target.c.inc b/tcg/sparc/tcg-target.c.inc index 6349f750cc..47bdf314a0 100644 --- a/tcg/sparc/tcg-target.c.inc +++ b/tcg/sparc/tcg-target.c.inc @@ -332,6 +332,13 @@ static bool patch_reloc(tcg_insn_unit *src_rw, int type, insn &= ~INSN_OFF19(-1); insn |= INSN_OFF19(pcrel); break; + case R_SPARC_13: + if (!check_fit_ptr(value, 13)) { + return false; + } + insn &= ~INSN_IMM13(-1); + insn |= INSN_IMM13(value); + break; default: g_assert_not_reached(); } @@ -469,6 +476,14 @@ static void tcg_out_movi_int(TCGContext *s, TCGType type, TCGReg ret, return; } + /* Use the constant pool, if possible. */ + if (!in_prologue && USE_REG_TB) { + new_pool_label(s, arg, R_SPARC_13, s->code_ptr, + tcg_tbrel_diff(s, NULL)); + tcg_out32(s, LDX | INSN_RD(ret) | INSN_RS1(TCG_REG_TB)); + return; + } + /* A 64-bit constant decomposed into 2 32-bit pieces. */ if (check_fit_i32(lo, 13)) { hi = (arg - lo) >> 32;