From patchwork Sat Jan 8 06:36:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 530688 Delivered-To: patch@linaro.org Received: by 2002:ad5:544f:0:0:0:0:0 with SMTP id a15csp973421imp; Fri, 7 Jan 2022 23:02:12 -0800 (PST) X-Google-Smtp-Source: ABdhPJxZIpTOFnzsGtb5yTeX53J8z2RMg9JPxpIyIGF7gwXtOK00tL1Kg5v1AN/IQrPcEfB6FmXC X-Received: by 2002:a05:6902:124a:: with SMTP id t10mr63406288ybu.287.1641625332670; Fri, 07 Jan 2022 23:02:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1641625332; cv=none; d=google.com; s=arc-20160816; b=hlQO7oqN3h46PTZdaI98aWHH/1LcmoWtqokYrldj/XpqdhznWRGrAUSWxdoNnkQJ27 vggVwZtRKwsyaPfbnG9MJK+Nf+T112yES6l8U7BqwAjuV2CV/pv9QhtYbyycWWY07dSn Ejiz/OlVN0OMc9xJyXP9dp5+D3Iy1EZfOlVKgOqVGubaCE3rJPnV0r1AergtD0FxWxVG uU7oQ0dkCZa81mHG+fDLCN6Bmsjem2jRJf0rHE1RkmgB7d5/VvHgAY+6HkbrxPfj7Qrp CKwvsmbPDAKBBBVj0RhU9ASHURMBO0F4ezqC/HX8pi1zSFGOe2RraABnyoGezXX1Lkdw ojpw== 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=/LG8DOHxYfb1kWl3G1waKqt5lQyEB1CM556IjrEgvw4=; b=v/Rbi/Pjp7viZ7EcxOkrYoTGVLZCYFb2pI+hwpdgy24jq402qk9uWejlXlDe/VI80f +l0np7rssnnIQ4gtUeujRc0U8ahTbNB/CjKsY2c6qef2OA7sUQJhMia6K+oogdB7Lznl GkALxsIRYd6Iqk+uiJGS8bfRCe9EEkMYMRlaGI8H4Btb5S8uX7ECjuY+/LYsr7uscx7O Z7DiQ5XzbrQbRM0Fpx+xlMez/Ariucjp2BaTodPYyDWViZd6+LS9tjZuBzE+0O7Zsv6H NTgIBOFaSaeVjl9L6WaXQqjE1ZDIFQP4gNgcOWUKJYoJ+M4MpLT8/6qhPICnUnKkPbdc 0Plw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=TBf0jrt0; 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=fail (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 i7si556642ybj.817.2022.01.07.23.02.12 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Jan 2022 23:02:12 -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=fail header.i=@linaro.org header.s=google header.b=TBf0jrt0; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:48286 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n65jw-00025V-1O for patch@linaro.org; Sat, 08 Jan 2022 02:02:12 -0500 Received: from eggs.gnu.org ([209.51.188.92]:58162) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n65Le-0005i6-9y for qemu-devel@nongnu.org; Sat, 08 Jan 2022 01:37:09 -0500 Received: from [2607:f8b0:4864:20::62f] (port=34490 helo=mail-pl1-x62f.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n65Lc-000497-3h for qemu-devel@nongnu.org; Sat, 08 Jan 2022 01:37:06 -0500 Received: by mail-pl1-x62f.google.com with SMTP id x15so6721549plg.1 for ; Fri, 07 Jan 2022 22:37:02 -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=/LG8DOHxYfb1kWl3G1waKqt5lQyEB1CM556IjrEgvw4=; b=TBf0jrt081oDxr5ry+y0WZY1I7Dl3FcHsjEY/Hftnyn+RQpiXu+c1IAWI3IP8YMBFW uLWgVNUmtaXcPNn+5aqgNYMiM6l9MA/kISRoBvfvQ2e9wm7cJG18+hjiJTShtCMlIvQO 7hcthTm0ta8sITjVy5VTIKRjOc9eJfa/HJSy6uxPEHVuvTpHTiqk9oln/Yek2Y48AzCH raFcplFDKSjXscfKy8D9b/TdMyDH7/+932fj0nRBFB74IcwItG6D5iJXOa55UY3S/i6x 54wqZi34gFKVnyJIjneLI12uwV/yjfob6TvPnyN/pKOxhNEcxIEpaP8PVY+YQsnV+BPM 35PQ== 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=/LG8DOHxYfb1kWl3G1waKqt5lQyEB1CM556IjrEgvw4=; b=KFM25Fg1f1M1uxRUvDELsoSc0C8cqK1VPTQP2lYh7YUkIcZn6VzJp2EGAOyzmQxYsn cPuOJikQAe1ESb0hJMk0tm7HPw31JZaeaBhiWfktKzoX5vlK9n0qTLs9MbxuEUay/xJw tnuPIrOiLUxye6ZksdetgnweeYtY6k/ApRC5r35u15atDcrPCP9Rp3BWFarugq7JPS6q JaO7iQnbz/fp/GRBwJv32KFpQNCik8nZYWab6RX3TnV75/2afjC4/aSRi01Q74aJAnEO dAMokCg/4LTT7W33kT7Tzyyz3FLUaik++3ET59hqwL086DUwQ9gpFVpY1gxXy9CGJHAA 545g== X-Gm-Message-State: AOAM532p8T6qgrvwRbiV/Ad91dupC46UkpMeCTrFMohlsINmefZXqRuw /PTfXdVD3EQ9OndoE7x2hWbJ80x38k3Mug== X-Received: by 2002:a17:902:e5c2:b0:149:3cd:ebf5 with SMTP id u2-20020a170902e5c200b0014903cdebf5mr66215001plf.1.1641623822095; Fri, 07 Jan 2022 22:37:02 -0800 (PST) Received: from localhost.localdomain (174-21-75-75.tukw.qwest.net. [174.21.75.75]) by smtp.gmail.com with ESMTPSA id z4sm840954pfh.215.2022.01.07.22.37.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jan 2022 22:37:00 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v4 10/12] tcg/mips: Aggressively use the constant pool for n64 calls Date: Fri, 7 Jan 2022 22:36:42 -0800 Message-Id: <20220108063644.478043-11-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220108063644.478043-1-richard.henderson@linaro.org> References: <20220108063644.478043-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::62f (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::62f; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62f.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, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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: f4bug@amsat.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Repeated calls to a single helper are common -- especially the ones for softmmu memory access. Prefer the constant pool to longer sequences to increase sharing. Signed-off-by: Richard Henderson --- tcg/mips/tcg-target.c.inc | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/tcg/mips/tcg-target.c.inc b/tcg/mips/tcg-target.c.inc index 41cb155eb0..e967f62869 100644 --- a/tcg/mips/tcg-target.c.inc +++ b/tcg/mips/tcg-target.c.inc @@ -1057,9 +1057,19 @@ static void tcg_out_movcond(TCGContext *s, TCGCond cond, TCGReg ret, static void tcg_out_call_int(TCGContext *s, const tcg_insn_unit *arg, bool tail) { - /* Note that the ABI requires the called function's address to be - loaded into T9, even if a direct branch is in range. */ - tcg_out_movi(s, TCG_TYPE_PTR, TCG_REG_T9, (uintptr_t)arg); + /* + * Note that __mips_abicalls requires the called function's address + * to be loaded into $25 (t9), even if a direct branch is in range. + * + * For n64, always drop the pointer into the constant pool. + * We can re-use helper addresses often and do not want any + * of the longer sequences tcg_out_movi may try. + */ + if (sizeof(uintptr_t) == 8) { + tcg_out_movi_pool(s, TCG_REG_T9, (uintptr_t)arg, TCG_REG_TB); + } else { + tcg_out_movi(s, TCG_TYPE_PTR, TCG_REG_T9, (uintptr_t)arg); + } /* But do try a direct branch, allowing the cpu better insn prefetch. */ if (tail) {