From patchwork Wed Aug 18 20:19:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 498989 Delivered-To: patch@linaro.org Received: by 2002:a02:6f15:0:0:0:0:0 with SMTP id x21csp1011716jab; Wed, 18 Aug 2021 13:28:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw2b9yhwfoF1EvPMKRyC1GZkLTNW3/Ys5yX+3LSascbqY49QJZ7Oq3/xJnDGx1Q8UOXmXMP X-Received: by 2002:a5d:9617:: with SMTP id w23mr8277983iol.115.1629318532069; Wed, 18 Aug 2021 13:28:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629318532; cv=none; d=google.com; s=arc-20160816; b=o8NU0jMQN+wEfTvyNuqyZVCDpXJ23Df1ANdobnD2E8uvSdhdw0uDtYlMLbozJyv27g e1fZ8QF52lqlDwsk0hqH4QKPqg25yr38RiW6Mv4Agzh20RK4ijZXRUjwZnePf/GzKKWY IUBiF8NUZ94JUVKTJi29d9z7QQMLDJKYSw8Rl5IjyEkcH5QtRGvsR/25sGKirLNx+vq4 xLQq02ntgY61rWkJUDpInG5nzgw1YdMMOvB2xRVuD1lUM19jm2joPChGScJ82W4WkFl2 B7DajY6RMcmY49TA2J+vFLMfoY8QiqumcB5baZxQNZraBXMM7H6elmS7hpQiFcU5aNj/ 3MYg== 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=HpQSpkjMY/HVPNmupFN14WCJnZd0Eg9bjbOHuKK4v+k=; b=KZF+yAMF+/RcnVJDx+4uh05s5moYfP6EhrTEC8MuNd/99tqiF8w2vPsxeF+hkgIUAH SBObx2iJs/BUafFWZ0yUlw12ruaQMj6/2rdPVepgycLfdTlsQ9kRkRN08HEJWdamNp4D DFHr+3uJZHhdF1zxvZGAIPGcZMqXVaBfHxHUFdJnw1UmdO/3vegVYwNoqyFu4WI3n9kD ly1FRr1mn3xMqCEVznmgHKIdQLa6/KG3aa1/jontNEYmLEl28x0CnYjQCWruEr7ddonF J9Tc1O9h5XWNzP8pYqQ7jt67324GSZrJS2lKVnX9st2Q4jwia0dkEnqZ4m9RQ1Ixkqft I9zA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jtVxb4cf; 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 q16si826191ioj.19.2021.08.18.13.28.52 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 18 Aug 2021 13:28:52 -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=jtVxb4cf; 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]:36634 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mGSB9-0000Ue-Gd for patch@linaro.org; Wed, 18 Aug 2021 16:28:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40396) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mGS2U-0008HI-0z for qemu-devel@nongnu.org; Wed, 18 Aug 2021 16:19:54 -0400 Received: from mail-pg1-x536.google.com ([2607:f8b0:4864:20::536]:40608) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mGS2Q-0006Lu-3O for qemu-devel@nongnu.org; Wed, 18 Aug 2021 16:19:51 -0400 Received: by mail-pg1-x536.google.com with SMTP id y23so3481434pgi.7 for ; Wed, 18 Aug 2021 13:19:49 -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=HpQSpkjMY/HVPNmupFN14WCJnZd0Eg9bjbOHuKK4v+k=; b=jtVxb4cfisbRGFNexDMxEdL9ceTblFTBKFJkL7HxT6/5rdDnZPJ0WO4r4jrPCaWhKn qdNdwPL0oOB221mKImSJHwxnCVEtlZiY6jOUp7nwSN8YDrn/zWHNhSQFmHSYfw0mFn5R d99AVgoLVVEmsp+EvObCmyUmkOGTqqAHLcPBFoFS29qJo0YuP6Irpxo5FPGn4XhbgNvp d4kZWQFmG0chD8WhYsp/VCvMaVDKXBLzKb4h/oukOWpv3XaE9ahLdUKOQyDw1FGqJLN/ GPaBZoZHrqHWqJi3drj4b+sLyln1qMBce6yrskGIP0vOAw4qplp+ho8o3n4GeIBRLf4z 1aLg== 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=HpQSpkjMY/HVPNmupFN14WCJnZd0Eg9bjbOHuKK4v+k=; b=MTqsQtlcLM7hG3CQSfuPgIW2sZh3cGWlRlFLa8xfmDO/Os1AY/YRe7cG4C2IorkDfx rbw1Nq+yfo9FWZ/3sjF62GNFk7qYwosCa1YE+ufG8aJK2oZHaWgetdPPazktuL/EQxFZ 0VoW92pd3DsR3bj/NwAi9NCdDYEfE6yk5MwKU9wWOHWM4RUvOeFBto/kzR2SjS49D9B4 0auDjTq3BUVZcDhsGapPi/2g+IoDYh/G+meKC4wo2llf0tZB13G21LWL3tkqgHaLluOn vyIN6tW1+MsIDAc8EM8xV/HiRqTghitIdyf4RB3LFXzNu/EP6hqVduCIxXG2rNG4tVxd ygJQ== X-Gm-Message-State: AOAM53126osvbKK6sdCOti1DZzbNjic98RwtS+2E8UChSmM7+KSQsaNe JC6FEIIZjJmSZq1pCvzHm/jG9P6RsJKj6g== X-Received: by 2002:a65:494e:: with SMTP id q14mr10504923pgs.314.1629317988807; Wed, 18 Aug 2021 13:19:48 -0700 (PDT) Received: from localhost.localdomain ([173.197.107.15]) by smtp.gmail.com with ESMTPSA id x13sm619621pjh.30.2021.08.18.13.19.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Aug 2021 13:19:48 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 15/16] tcg/mips: Try tb-relative addresses in tcg_out_movi Date: Wed, 18 Aug 2021 10:19:30 -1000 Message-Id: <20210818201931.393394-16-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::536; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x536.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" 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(+) -- 2.25.1 diff --git a/tcg/mips/tcg-target.c.inc b/tcg/mips/tcg-target.c.inc index f641d86561..27a23662c8 100644 --- a/tcg/mips/tcg-target.c.inc +++ b/tcg/mips/tcg-target.c.inc @@ -582,6 +582,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; } @@ -592,6 +594,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); }