From patchwork Wed Aug 18 20:19:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 498998 Delivered-To: patch@linaro.org Received: by 2002:a02:6f15:0:0:0:0:0 with SMTP id x21csp1018491jab; Wed, 18 Aug 2021 13:38:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyvVk4tKKjCPnW9qSp5RBwRULulLmbtnDT4lMT3IcY7bGloanUkxB6/0YPCiGqU8No1quMB X-Received: by 2002:a05:6638:1905:: with SMTP id p5mr9677320jal.25.1629319113355; Wed, 18 Aug 2021 13:38:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629319113; cv=none; d=google.com; s=arc-20160816; b=oa5RanROG674ATTajt82Pprzk4HOAzlJYFJo+knc5khC67tCykmesR+LQFO5JCVkgQ 2nSZd2zZKMFk6aaCltjZjb8vgELMbybgkfh+90nO8SfPC/EPzU+SqlABvAOfQO3Fe0Oq FcNo18sQBCCrucDskK3X9O3sUsTbj1bc+boDv2Hy3xLRntmvORp0W8xnGTsky0/Qobpv zSiTxqWOfRrW/JVhhKvbp5fBkySqpJyRvSYhcUseAOAuNZ1NpFD23J2v7zKT2/3V2qLP HrT0c/zNsqDTZZhU9fafbjtPGW9jBJgEGQAAHsBZRSm4bCeXgR2PTedrWE+UqcM9jjtk UNeg== 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=aRM/aV1nNd+z0X6JLDx3kBkYbHw3rVDD5maGh4N4GXM=; b=IbZpPwmembJPSYSLVFIZa51VY9T5lwrQzq5QKZdTS20bZvMk96SJsVCGLBRD1Fru5E OTzWCP5KT9UCDStZy9fzI9KxYfOg6IL/NObRD5GVWzgTYFFSxtTS094Sldtuc8pq4qgW 96bR/Bb6AN8CIilTx5AtaIDLKRHu7nn06BpqpDww44VOh82qauV2xXxWKUbzmWjZ0e7v aWPI7R3exEIh+8bNEnMn/h7M3jquYNq3tHlu2Zb3o0Yn5GiWxmqQnNdJ0hzs01J9z/eB JvblFbaPMyv1EbwtTMV8Vj7DRvYKqA4LHJLJg3UEW+kKMFlSbhvV82gIT6HUPqeEComB h6SQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AheVb+eF; 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 o3si665519jah.81.2021.08.18.13.38.33 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 18 Aug 2021 13:38:33 -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=AheVb+eF; 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]:33548 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mGSKW-00016O-RA for patch@linaro.org; Wed, 18 Aug 2021 16:38:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40372) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mGS2Q-0008GL-FO for qemu-devel@nongnu.org; Wed, 18 Aug 2021 16:19:53 -0400 Received: from mail-pg1-x52c.google.com ([2607:f8b0:4864:20::52c]:41834) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mGS2P-0006LF-31 for qemu-devel@nongnu.org; Wed, 18 Aug 2021 16:19:50 -0400 Received: by mail-pg1-x52c.google.com with SMTP id k24so3485409pgh.8 for ; Wed, 18 Aug 2021 13:19:48 -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=aRM/aV1nNd+z0X6JLDx3kBkYbHw3rVDD5maGh4N4GXM=; b=AheVb+eFo+YD6nig9aY/StyGg0faymC1Y43Tm1T2UlqrTz5E5O066z7qQIHUuWkZ6a I1A2FgFeXVsnpT3kEuD6CcwHAosJChJu2VwlcDuJxhUqDb8oGpsd17imv6yQmzNO8aan 2JQk/B/3pZQ4aWqMC0CDv4pvkX3abQN5QxM+1driwdhaem26HgMEHjLy8xpCN58aATBQ QBAU3t1Xk0rU39tIVEg6uAABTdnBeutKrwjH4OwIXVVPHZTfGUh669soXfYgCyggWqSg yxKKjmaq2Rh2b1lidsdZMdf6h5zhzuIl1K3tQeAvMkA4Yh/7+iRbhUmAeMGW0KXdEe3X /zBQ== 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=aRM/aV1nNd+z0X6JLDx3kBkYbHw3rVDD5maGh4N4GXM=; b=VCzN+PBMZ11kK5DERROBtFcOP8nM7tNpWClP6zFxR4qSduTLkc7tNlWWHVCilhW4s5 C8xNOMcXTgxUemzRGBeu1cHnqkfembUR9c8Y8ntmF9K+4EbSSE7r4jQWTQtraEC7QTMG PGmntiB2KcnmmoJadjXFSexTAXnSylsGj38J3Q1wuVzJ3nW2PyeBBQmvvL+hKb8ygVs5 RQinsLfqyZ7eULHekyDbYLaLVAmAwsEy6jsRJ1IvoKfCd2yNsRn+bY7j8hqSnVZIBNNl CmoHLJENLOFBvPbCPGFKQPKq6/w0Kuhb/HBKxNCPGTyYzffs664VI/HzxShDd0oud4IO 9q6g== X-Gm-Message-State: AOAM5311jTpniqTgEGz/Q7RRO7XFMfoyZl2ngnnwgQkvg9sawYB9Cn88 9EfjwtRNsZAY8wZ08nXoCghoDydwoO/mMw== X-Received: by 2002:a05:6a00:1ace:b0:3e2:2a73:e0a4 with SMTP id f14-20020a056a001ace00b003e22a73e0a4mr11357832pfv.73.1629317987782; Wed, 18 Aug 2021 13:19:47 -0700 (PDT) Received: from localhost.localdomain ([173.197.107.15]) by smtp.gmail.com with ESMTPSA id x13sm619621pjh.30.2021.08.18.13.19.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Aug 2021 13:19:47 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 14/16] tcg/mips: Aggressively use the constant pool for n64 calls Date: Wed, 18 Aug 2021 10:19:29 -1000 Message-Id: <20210818201931.393394-15-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210818201931.393394-1-richard.henderson@linaro.org> References: <20210818201931.393394-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::52c; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52c.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" 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(-) -- 2.25.1 diff --git a/tcg/mips/tcg-target.c.inc b/tcg/mips/tcg-target.c.inc index 2ab37ac7c0..f641d86561 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) {