From patchwork Thu May 25 18:10:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 685603 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp500509wrt; Thu, 25 May 2023 11:11:03 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6tgx+Fs8MV8UJSzavkBztgN4WIpawbDrr8gsPf/EEzv0PMqfO3FW1oQG15nZ4ybghqIIT4 X-Received: by 2002:a05:622a:54e:b0:3f5:1f9c:5b28 with SMTP id m14-20020a05622a054e00b003f51f9c5b28mr482754qtx.42.1685038263467; Thu, 25 May 2023 11:11:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685038263; cv=none; d=google.com; s=arc-20160816; b=e9H0WyDburWvae5eZooZq7rGuOMwu5ZzFtT+U9QAoEmmUJS+vshjz8IxbGqwsk7xIS Ym70MyJp3hngzXruysnID6aTzz0ygzD7fcfOmU2FNZdcq4f5WKilSUP1RpGoJove7n0l U7ar3aj1Wncy0+Y7lq8ZaNhqWtdAltHUB2LrXCO7jMCC3njn/3hmlMcX0OsalWmgTu6r kPmKynArLaPavEguGhb0On0ZQc1Uosv5qW2qAH3Vn+sjpKTpc7gPL3NGA7xQeyiYKrar Np08714GeOMY+E9qIRnvdItwjHKGm2ArzuuA+Qfxk2fYy9Vsr9Xr5QAcII3bPbjJASkD Jq1g== 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=hePU+jHoG6kbWcw7O0XVS7iVuAJda7LKF/UytOuYzmY=; b=x8IAaFHnYsxx0zSSI2TZAdaIWVB4qDLHc1qf8LBl6PmBhhvVzp+eEJodI47hvoo8SL oicuGGZhb4Zg6um2/8lcOz+XzbW7OtNgRwW8sxzPpe9plGWyIpY5TEsvG3w+nDdjwkkK aU4fH+jEogDV/m+dStRmFn225TrZeUc3APE3fotoX0xKyF5gGx/HJUIS9djyk2sydskn oVzPXDkcdh0hdnCL+tsqWQKxxOVGqWJjMVGgU9pzJjZUVPJam/NjjMm4VXGeeAhQMMKj zca0EkRYrqgYxaekwEOm31vnW1cE6222xRiAPws6ta9Fabe5HzdECaT0FR4Dnuw2rRxp fqMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BsstyhHC; 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 h5-20020ac87d45000000b003f6b94bdfdbsi681075qtb.40.2023.05.25.11.11.03 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 25 May 2023 11:11:03 -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=BsstyhHC; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q2FQI-0008Pc-Te; Thu, 25 May 2023 14:10:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q2FQG-0008Nu-CJ for qemu-devel@nongnu.org; Thu, 25 May 2023 14:10:48 -0400 Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q2FQE-0005t8-JO for qemu-devel@nongnu.org; Thu, 25 May 2023 14:10:48 -0400 Received: by mail-pf1-x42f.google.com with SMTP id d2e1a72fcca58-64d426e63baso66029b3a.0 for ; Thu, 25 May 2023 11:10:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1685038245; x=1687630245; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=hePU+jHoG6kbWcw7O0XVS7iVuAJda7LKF/UytOuYzmY=; b=BsstyhHCniZz6TbuzNW+mM8wqS/4qEPzQb0vi2uIV8dNbc2mfdHC0KSuq3HhjA6B3o MwXWDZEmxPLwyzlaid4YUMRhWy+1AOOJ0y0Sgz0GxSWe4c4YWaQRgcTQX5f9xWsrn7pv QRFBPu5mU/oG3I/nbhh2L//KVAWOtmwkHsAvnA994s53lOUHFhXB4ykjhBU89GrmC15i m3O9d1QqlsroxckXbFAw6Yz6Deu9boHJ6pF1zhTM68pPeZl16cByC9HBQdLLqalY+/UA uocv3c7T3UJg4HVyGMnjMzLJlkzk9Mu+YG+fvtHTDBjI3zO8WsitIWU1OcVk6U0Coqnv nC3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685038245; x=1687630245; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hePU+jHoG6kbWcw7O0XVS7iVuAJda7LKF/UytOuYzmY=; b=S/LC+TQDsYO008ynfnLVDBpRYW3TDBuAhO5GrNo1ikasX6EXg7EhKPkOVC20Qx8OnJ ZvepcAqN3VIFB+aO+K8xaVVYq8HyI64mf8+rDOJyIOSkeua2RevcW3XPA7O9PWUZE9Un hj3O5zLa2YQ0oyw63kUqZ/8ohoVr37K82V+C+TDrf4Hhm6ZWvzOhnLY6oOHpDNsAsynL vRGE9Wm+6P5iSawNUVEq0nTQ5iXhRBUbPMp9n8SEImThFvw/w9Vi5zgbW1DqFQI5PXqW GqR8A4kiH000i1qklxM+QiFi2Jn+u52goTtZSufLmeHJxV3UG6+EH5c/yGMNgN4yjnh4 uw4Q== X-Gm-Message-State: AC+VfDyypr1TemgWzSBlP4xEPnIomE9N9XEPJmX8Dj6E77ktIZnqnhlR 9fOfnytCiJbA++oXy0rM++hT06tLPBI98pvjer4= X-Received: by 2002:a05:6a20:a12a:b0:104:b7b4:e044 with SMTP id q42-20020a056a20a12a00b00104b7b4e044mr22471041pzk.48.1685038245320; Thu, 25 May 2023 11:10:45 -0700 (PDT) Received: from stoup.. ([2602:ae:1598:4c01:7ac5:31cc:3997:3a16]) by smtp.gmail.com with ESMTPSA id m18-20020a170902db1200b001aae64e9b36sm1710243plx.114.2023.05.25.11.10.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 May 2023 11:10:44 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 09/23] tcg/mips: Try tb-relative addresses in tcg_out_movi Date: Thu, 25 May 2023 11:10:22 -0700 Message-Id: <20230525181036.1559435-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230525181036.1559435-1-richard.henderson@linaro.org> References: <20230525181036.1559435-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42f; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42f.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org These addresses are often loaded by the qemu_ld/st slow path, for loading the retaddr value. Signed-off-by: Richard Henderson --- tcg/mips/tcg-target.c.inc | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tcg/mips/tcg-target.c.inc b/tcg/mips/tcg-target.c.inc index 068deab8c9..9fab424ecc 100644 --- a/tcg/mips/tcg-target.c.inc +++ b/tcg/mips/tcg-target.c.inc @@ -568,6 +568,8 @@ static void tcg_out_movi_pool(TCGContext *s, TCGReg ret, static void tcg_out_movi_int(TCGContext *s, TCGType type, TCGReg ret, tcg_target_long arg, TCGReg tbreg) { + tcg_target_long tmp; + if (TCG_TARGET_REG_BITS == 64 && type == TCG_TYPE_I32) { arg = (int32_t)arg; } @@ -578,6 +580,17 @@ static void tcg_out_movi_int(TCGContext *s, TCGType type, TCGReg ret, } assert(TCG_TARGET_REG_BITS == 64); + /* Load addresses within 2GB of TB with 1 or 3 insns. */ + tmp = tcg_tbrel_diff(s, (void *)arg); + if (tmp == (int16_t)tmp) { + tcg_out_opc_imm(s, OPC_DADDIU, ret, tbreg, tmp); + return; + } + if (tcg_out_movi_two(s, ret, tmp)) { + tcg_out_opc_reg(s, OPC_DADDU, ret, ret, tbreg); + return; + } + /* Otherwise, put 64-bit constants into the constant pool. */ tcg_out_movi_pool(s, ret, arg, tbreg); }