From patchwork Tue Feb 8 07:17:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 540748 Delivered-To: patch@linaro.org Received: by 2002:ad5:420f:0:0:0:0:0 with SMTP id e15csp308022imo; Tue, 8 Feb 2022 00:22:52 -0800 (PST) X-Google-Smtp-Source: ABdhPJxLk0uPBGW4jCZwMmj2sNfPLlm/wnUNooNcVAx2gNWejUB7hgxHVEPS2Sa/6VVIl9IMcIuK X-Received: by 2002:a05:620a:16a7:: with SMTP id s7mr1943415qkj.700.1644308571892; Tue, 08 Feb 2022 00:22:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644308571; cv=none; d=google.com; s=arc-20160816; b=NFSR9tDRndU0T85JjpRhg95LkpmSxRlW/0PYGEFRa10vyoH6EoXIc9eMf/5QmRamJR Cgu57vauhjHc2V5bF4bTiKDFhG5vodrOMv4yqUvIUGvnxfrRyT0nwl4JiAFpPzM8GJLB x6e2VbVxvWcF4QSSzemlaOhVjgaBET/l7O52xrxa5aPiutmpvW/zYOR6pn/mAbcolOCZ Dq+anuCGPF/AkC2T/PRxSQzLI3DmPZCXQunD9BRHs0XAsC7JOaNI5yY/crGNx9ubKuMG bUCsIZ6Z7JPvB27zSxCCd1y/B6qoQ5A3q58uOrZb4jg3A7O0nG9qZqfncTqyeIvJpV9m 0FJw== 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=EzinD8/kPioX6Z6jBf7AkBmyvisWOi+WtFsuBRSv8ks=; b=uJL/RY7bY+ZzUGi1XBWv1TVGZ7iZ6M+6kHYY4IUQyUcnihl6a4KxHbDISLdcVeNGTw PM8QxA4UO/knbQ5sLPMQDEaZzDXGBPt5d7DIp1sZgvqY7dagAQ/1zOx65uAxrvAT2tuM 6RhESNJJEJNft8Drkve+6VYgjbUw85/GUPZrAMSZSz0MWRaOf3k0HDs4/0YiYbiIwWXw pLtfhQylx7I49BTstCCmBWupBMvnOzHPtJu7aeHeNI/WdF961z7WTlDcheXZlFm0QCq9 ttZfajsWAk5DJZVai5fBabd5CP57ntXoS/ht+qzEcjm8eXoFbIn6vsXygRuDHIpJ8Q96 xmpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="JBzMq8E/"; 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 v12si2882894qkl.253.2022.02.08.00.22.51 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 08 Feb 2022 00:22:51 -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="JBzMq8E/"; 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]:56758 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nHLlz-0003Vl-EO for patch@linaro.org; Tue, 08 Feb 2022 03:22:51 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52898) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nHKkn-0000Pc-BC for qemu-devel@nongnu.org; Tue, 08 Feb 2022 02:17:35 -0500 Received: from [2607:f8b0:4864:20::429] (port=45864 helo=mail-pf1-x429.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nHKkl-00018o-8c for qemu-devel@nongnu.org; Tue, 08 Feb 2022 02:17:32 -0500 Received: by mail-pf1-x429.google.com with SMTP id x65so2860148pfx.12 for ; Mon, 07 Feb 2022 23:17:29 -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=EzinD8/kPioX6Z6jBf7AkBmyvisWOi+WtFsuBRSv8ks=; b=JBzMq8E/+9abiygCT9Wr9gbuvta9xKLADFxQ25n5mb+YgGDo7wCFFM+TDtg86St8cM RYlQb0lVYyxgjLhesHBKSr/1PFwD3opr/iySzwtdvsfqtM8NBBA6RgOmDGwYZlpaXAgU x0ocFXn0DbbPcTgXigsU0hVKe8YAOjEVHoPnZ+xSQKxCWgIolmUIh138Y+Uk47YzqeQW +chH1IIbS+0fIk1rR+F5uaKqIFzmfJXiZUeKCJNBXLOlPbWCPS+6wNEZI6LAPEZyUBq2 mCuc9MpE6AG6iM9bogsP4w/6wdXmJHNRlplpQ5g+CpwI8SwNb0T/N3v+wCp0yg727tax ak6w== 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=EzinD8/kPioX6Z6jBf7AkBmyvisWOi+WtFsuBRSv8ks=; b=sIidDOfA0KXFSzYsuOsgaG/Fx8me64F/ol3PX3Jlu7F9oIcBjp1VnG6m4V2O/ccLFu YexJe72JrijMeR//t/N3KfiZOpagcpbJdG/i9wtZFLoBwJgt+QlgwhTDafYnVw3kJEGB uD8Djz09CGZuU/7f72ACly77DbqqkZ0v+F0QE6O471HHgfNpL8cXF3/GZTjNf5oXllGk VOQ6lmy2rqJTsJljrQgglsVD1FGqdHQVu7qOkMAzCqBMaakPWYvRBX8R30nlSzg1bX+P NnttSgfkJ1hC0HESEO9ErTAQ8nkAo2owscyeA4PiQnGQRrlyLdAOzlLqGUsT82U4vYLp E8zg== X-Gm-Message-State: AOAM532b9OtJoAf0xwI9EP+Wwcm0Hvvq0hMAz9bV2n2pqS/FtMV15shx 1e4qqmAJvTXg0/u3CzOASCSwyQxmsNSJhg== X-Received: by 2002:a63:2c54:: with SMTP id s81mr2473814pgs.197.1644304649004; Mon, 07 Feb 2022 23:17:29 -0800 (PST) Received: from localhost.localdomain (121-45-127-8.tpgi.com.au. [121.45.127.8]) by smtp.gmail.com with ESMTPSA id mi11sm1543422pjb.37.2022.02.07.23.17.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Feb 2022 23:17:28 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v6 6/8] tcg/sparc: Use the constant pool for 64-bit constants Date: Tue, 8 Feb 2022 18:17:08 +1100 Message-Id: <20220208071710.320122-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220208071710.320122-1-richard.henderson@linaro.org> References: <20220208071710.320122-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::429 (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::429; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x429.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: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- 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 ae809c9941..21b0dd6734 100644 --- a/tcg/sparc/tcg-target.c.inc +++ b/tcg/sparc/tcg-target.c.inc @@ -336,6 +336,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(); } @@ -479,6 +486,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;