From patchwork Mon Dec 14 14:03: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: 343521 Delivered-To: patch@linaro.org Received: by 2002:a02:85a7:0:0:0:0:0 with SMTP id d36csp3034804jai; Mon, 14 Dec 2020 06:18:40 -0800 (PST) X-Google-Smtp-Source: ABdhPJzb8ciZhTcuje7B9PmJN7pKG6gLWMc6izSdLfDBLu5w2XtHyUOYMbQ64CY2/XEocsK//xW/ X-Received: by 2002:a25:d014:: with SMTP id h20mr38880283ybg.149.1607955520028; Mon, 14 Dec 2020 06:18:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607955520; cv=none; d=google.com; s=arc-20160816; b=zfrC56weP5CdUdzlo2tZJlbubXBTk3uMSLK++iZeljGM7QKbUUfz/oveIKi0REz/xX jid0felnQq95zfuM+qkhOrKitULkJb8tZ4GgO1XMbNnqadfHG0HoDqNzZVMrHwgTOEEC P/eDOd2RBgeWgX+HncOFFaFzQiZIbrqaTcNbLowIOg5SI82iT7wLYPYjAKnz2YRcRSiw 8zMyqSktlwdd2J1oh6cz+oc/DwF+2aW6l6TWJ3UA7Bd67c4dFe6gwzcdmuVoA1ooElGR 0u7wpQ92dqUs8e7ol2rE2xQ3geIb37YF8DZqU3CTw1gdaGU4NC2mqI3U2J3QH4N81e/U nYbQ== 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=mZ7Cv5t9pDHcLwkTAHUkGoZLzbW+EIVJw5j5xRLRZ3w=; b=CeXg8KJDUIztRYY8mmrZ2/vzFjkueb8E2B5GfqhQxFx8OkKQ/vJo2aDajUrmEYV6GV lbtJIad+OiaLK/5+BBpYLhQwKbSaaM28XzKV9PPv8FD0hYOT0+2xmeTpqjyiT15I9Sa0 NN5F9mCigDt3eIc/boccg0OBf40ASibFptKCPQc2FD/f1NahVL86hWrv0F95coMeR/VC dJXz+EDQ1pbHCSf23t6Kskh0JBpgdHjfAYDlKUDUz2F4W9lVkMX4dfGGs2ORlFJpbEzt wI3pfkK9q6gdiN2Vtofv6l6Xu967cx8MUP4uVciBO3OI1kbx7lrHrG6BinqSUyLiVj0i fVWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=llWe3wZt; 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 130si15910935ybt.152.2020.12.14.06.18.39 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 14 Dec 2020 06:18: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=llWe3wZt; 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]:56248 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1koogR-0002SB-Ga for patch@linaro.org; Mon, 14 Dec 2020 09:18:39 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:36586) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kooSS-00026G-E0 for qemu-devel@nongnu.org; Mon, 14 Dec 2020 09:04:12 -0500 Received: from mail-oi1-x244.google.com ([2607:f8b0:4864:20::244]:43597) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kooSN-00040k-OP for qemu-devel@nongnu.org; Mon, 14 Dec 2020 09:04:12 -0500 Received: by mail-oi1-x244.google.com with SMTP id q25so19223073oij.10 for ; Mon, 14 Dec 2020 06:04:06 -0800 (PST) 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=mZ7Cv5t9pDHcLwkTAHUkGoZLzbW+EIVJw5j5xRLRZ3w=; b=llWe3wZt78bposQlakYx4jKASaeOxfGJ3Bv8D+GtjqYFn2n5Q9U5qjtYDEsvUsA+WZ Rfj5WcNvylazl1uwXt66xcx0O1/RUSmCl++TMKZD9lAkhJWDsbLf4vwvVP0jr1G7I9Db VEI5sIYDXEGBEGdVwY9OTqbdA2l9R+V5SUEB3LVhb0g9fbpgHnp4km1wfy23L1i10FRZ g7y8pz5A3pwdENvN/7+wGrbB5GTTXwhUJO4cMnpLRkTdQE+yANpPXCAnsBwhRPYaMmkS UNJxqLUO5l3oPTLLc9bmWqesU1Rw7zfgLpaiOo+sRe7W7YW0a0b03DP1zRryWyq+Ivg2 /YMQ== 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=mZ7Cv5t9pDHcLwkTAHUkGoZLzbW+EIVJw5j5xRLRZ3w=; b=TJN23gjzGHWO16JOIRg5IECm3nYTOYxLAt/5jzBKlflQYiyDWs61BtNec/JeDj58PO x7lin07AZjBC4uQjHiHwcPu0wkbezwAiLEV7Q3y9ntwt58IP77TCwjOsv4jFCJo2LqUT aMSF4ddMP103jyyBAv0F6OG/kWM1ERQdrHuRWbyt3BBWySfCeHxQ5gGtEvjDw2GJghCZ a4eeLWddbtkfbNU4DPtuzScHosesjW+lZe2q54IfvlK/xTw5MfGb9vmiVLwFWAXKFFrl E7QLMrCr35IlKxer9J2tpdp6TZVvyeoYJgw1KonQ7lZFq+3HQIJbWAhxUPKGfqhm3DaI 4SRw== X-Gm-Message-State: AOAM531VWdML0R8Piku3FGZyqhYjGjnClAahFCmHd3VOghiy60ljUzR9 WjaqnZtPvQxsEo244ITN3ytkqjskI4MLle/M X-Received: by 2002:aca:47c2:: with SMTP id u185mr17970978oia.56.1607954645344; Mon, 14 Dec 2020 06:04:05 -0800 (PST) Received: from localhost.localdomain (fixed-187-189-51-144.totalplay.net. [187.189.51.144]) by smtp.gmail.com with ESMTPSA id t24sm3940146oou.4.2020.12.14.06.04.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Dec 2020 06:04:04 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v4 30/43] tcg/sparc: Use tcg_tbrel_diff Date: Mon, 14 Dec 2020 08:03:01 -0600 Message-Id: <20201214140314.18544-31-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201214140314.18544-1-richard.henderson@linaro.org> References: <20201214140314.18544-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::244; envelope-from=richard.henderson@linaro.org; helo=mail-oi1-x244.google.com 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_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no 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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Richard Henderson --- tcg/sparc/tcg-target.c.inc | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) -- 2.25.1 diff --git a/tcg/sparc/tcg-target.c.inc b/tcg/sparc/tcg-target.c.inc index d599ae27b5..8f04fdf981 100644 --- a/tcg/sparc/tcg-target.c.inc +++ b/tcg/sparc/tcg-target.c.inc @@ -440,7 +440,7 @@ static void tcg_out_movi_int(TCGContext *s, TCGType type, TCGReg ret, /* A 13-bit constant relative to the TB. */ if (!in_prologue && USE_REG_TB) { - test = arg - (uintptr_t)s->code_gen_ptr; + test = tcg_tbrel_diff(s, (void *)arg); if (check_fit_ptr(test, 13)) { tcg_out_arithi(s, ret, TCG_REG_TB, test, ARITH_ADD); return; @@ -537,15 +537,15 @@ static inline bool tcg_out_sti(TCGContext *s, TCGType type, TCGArg val, return false; } -static void tcg_out_ld_ptr(TCGContext *s, TCGReg ret, uintptr_t arg) +static void tcg_out_ld_ptr(TCGContext *s, TCGReg ret, const void *arg) { - intptr_t diff = arg - (uintptr_t)s->code_gen_ptr; + intptr_t diff = tcg_tbrel_diff(s, arg); if (USE_REG_TB && check_fit_ptr(diff, 13)) { tcg_out_ld(s, TCG_TYPE_PTR, ret, TCG_REG_TB, diff); return; } - tcg_out_movi(s, TCG_TYPE_PTR, ret, arg & ~0x3ff); - tcg_out_ld(s, TCG_TYPE_PTR, ret, ret, arg & 0x3ff); + tcg_out_movi(s, TCG_TYPE_PTR, ret, (uintptr_t)arg & ~0x3ff); + tcg_out_ld(s, TCG_TYPE_PTR, ret, ret, (uintptr_t)arg & 0x3ff); } static inline void tcg_out_sety(TCGContext *s, TCGReg rs) @@ -1313,7 +1313,7 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, tcg_out_movi_imm13(s, TCG_REG_O0, a0); break; } else if (USE_REG_TB) { - intptr_t tb_diff = a0 - (uintptr_t)s->code_gen_ptr; + intptr_t tb_diff = tcg_tbrel_diff(s, (void *)a0); if (check_fit_ptr(tb_diff, 13)) { tcg_out_arithi(s, TCG_REG_G0, TCG_REG_I7, 8, RETURN); /* Note that TCG_REG_TB has been unwound to O1. */ @@ -1345,8 +1345,7 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, } } else { /* indirect jump method */ - tcg_out_ld_ptr(s, TCG_REG_TB, - (uintptr_t)(s->tb_jmp_target_addr + a0)); + tcg_out_ld_ptr(s, TCG_REG_TB, s->tb_jmp_target_addr + a0); tcg_out_arithi(s, TCG_REG_G0, TCG_REG_TB, 0, JMPL); tcg_out_nop(s); }