From patchwork Tue Dec 6 04:40:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 631323 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp2940332pvb; Mon, 5 Dec 2022 20:41:50 -0800 (PST) X-Google-Smtp-Source: AA0mqf59JNKcclFga/e/3kotx7NMnq3r4jOuDYQTD8TUhYAebP6FefKDH8MutCFnDKf0A9RvbjSc X-Received: by 2002:a05:6214:3c9a:b0:4c6:141f:819c with SMTP id ok26-20020a0562143c9a00b004c6141f819cmr60855800qvb.76.1670301710606; Mon, 05 Dec 2022 20:41:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670301710; cv=none; d=google.com; s=arc-20160816; b=dyYoZ/tn62MpH+EQb60S8OD1P/4vd/5KHjALIW/nHlMOqn45Fl+r9fK292OvsA4bPc C8bzHfDSTqVl4KUtHB1lwsspdiOiaUQdwvp7ydSAoTud2MQf1pghtE69bnrHwXLb6h2V tmlnVDi8yVVEKcmi5kCqScrRhaqQmyolrVlB0Gjsq0yJ1AV41uhXMYpBDA+2fFDNSNpC UoNH6mBkcloOTPVA+Lgf1nIkoVB3QPTAcx87kYYhBZdsvTKyMk6niBzbe5r5S41qCajs UoKfEoNz8SFa/PVPU+3V9fvsXkkcOpngQlQ/W64dIzYYiwmfB3RhQ2wJMeZMXeYLfV67 1w0w== 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=6ULKeVCes+WuSNJ4/pJViKOQPocE7eOLpKgygf6uSqE=; b=gCnZj1X8isp3GhGjRXjhvk2Ox8lmSiT3n2TPWHuYTt5TKWf3cEhAUwFIZKBGkEvAnf IzWXiLxNISbLZJR/spvEp2zohqk7SmjAXUaLhWFe01u+nI5lLivk5wpfMrcRLoxjC7h1 alVS+N0J0kSsSxsZRLXZoT/w2z9zADENk3IjXxTttog0+8P5cDsK23HthaJRCD+TOqAz 2uY0WnRmTgBWKWZHOz02lh/oJwuyZEJiHG0330WQ0qguFVd3Gcz+mlJNKSxImSfdEaEq nOJ9tAB8R3wOo8a+3Km7HB/4vvOmbpwB5heXiAawbbGWVete8ko/Pc3RUL40p6IC3mfj OEtA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pdShluGo; 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 o72-20020a37414b000000b006fc1db7643bsi8278785qka.520.2022.12.05.20.41.50 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 05 Dec 2022 20:41:50 -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=pdShluGo; 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 1p2PlT-0003DC-59; Mon, 05 Dec 2022 23:41:07 -0500 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 1p2PlS-0003Ce-0V for qemu-devel@nongnu.org; Mon, 05 Dec 2022 23:41:06 -0500 Received: from mail-oa1-x33.google.com ([2001:4860:4864:20::33]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p2PlQ-000365-J6 for qemu-devel@nongnu.org; Mon, 05 Dec 2022 23:41:05 -0500 Received: by mail-oa1-x33.google.com with SMTP id 586e51a60fabf-1447c7aa004so7976874fac.11 for ; Mon, 05 Dec 2022 20:41:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=6ULKeVCes+WuSNJ4/pJViKOQPocE7eOLpKgygf6uSqE=; b=pdShluGobBcpiKcHz1sJqXvuiPV24huQMteZeEVcHWxek0DgL2B6wIRXc683thhTqp wf9jbzWhybQq7k9NcUEcocZk9A6L1WTMDgZeFptjj3SlHX0VABfYc46WzO4z0L1WlOlf 2ZZLjIpwVtm7AZYjN4UhA40CTI1kqb63xUonxR+Qg8RrQyeCMt6KGHblufS82948fwAU akqmAjv9jBDRlc+nLW5rSkYSlHGrGlDFS+mxhshFXg7C9tMdwlZcJWdM8c2lkcTcnbhj SWpq2/8OKtv50Qf4rXYAP2OpqYV6It3hybvzxeaqlPp/A+wWCB6tKX+iPj4mvjH4tbxJ /VDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=6ULKeVCes+WuSNJ4/pJViKOQPocE7eOLpKgygf6uSqE=; b=4EZEh7E6JYR+rISDw68InRsuut2eG6Wpd/zcAXR1OMXOdg6XITjszzt8Gf94JlEikq P/KW/EnloxPaufOAhHPJrjbKbewojVP8a+glZ7vqFrfrXGA0oHjAuqJKoXSecAwq/zV9 r0jttHkItM95smWowCXsOYisv3nl9L8O1ZtkfSSGWeJKnMtGevr8UmqeE5f2lozU/fWf BXLHZdGgnhCLwk6lZVZJPJO3HLVOlqqh1bt/LoKruR235Po9X4OQvuj4JcIoDl3z/UZx L9vPwvlSgQmStqpANm0pIMq+JINbeCEoXLG9zxkwcs7U0M3xw9zHdq1lyVTKtCupFWS7 inWA== X-Gm-Message-State: ANoB5pl+e8bv/LOaBITJv/tMAyZc4saUs8mDXjlbwrVRRoMWwtWWDhhZ An/0ZFYwc+7093SFjec9tuQIgBSW6opy/tq61Sg= X-Received: by 2002:a05:6870:ab17:b0:143:d6b3:558a with SMTP id gu23-20020a056870ab1700b00143d6b3558amr20008073oab.206.1670301662330; Mon, 05 Dec 2022 20:41:02 -0800 (PST) Received: from stoup.. ([2806:102e:18:70b5:d104:21c2:8c7e:77e6]) by smtp.gmail.com with ESMTPSA id z6-20020a05687041c600b001442fada152sm7561864oac.46.2022.12.05.20.41.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Dec 2022 20:41:01 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 7/8] tcg/loongarch64: Use tcg_pcrel_diff in tcg_out_ldst Date: Mon, 5 Dec 2022 22:40:50 -0600 Message-Id: <20221206044051.322543-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221206044051.322543-1-richard.henderson@linaro.org> References: <20221206044051.322543-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2001:4860:4864:20::33; envelope-from=richard.henderson@linaro.org; helo=mail-oa1-x33.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.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 Take the w^x split into account when computing the pc-relative distance to an absolute pointer. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé --- tcg/loongarch64/tcg-target.c.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tcg/loongarch64/tcg-target.c.inc b/tcg/loongarch64/tcg-target.c.inc index 2044897e36..47465b8c20 100644 --- a/tcg/loongarch64/tcg-target.c.inc +++ b/tcg/loongarch64/tcg-target.c.inc @@ -701,7 +701,7 @@ static void tcg_out_ldst(TCGContext *s, LoongArchInsn opc, TCGReg data, intptr_t imm12 = sextreg(offset, 0, 12); if (offset != imm12) { - intptr_t diff = offset - (uintptr_t)s->code_ptr; + intptr_t diff = tcg_pcrel_diff(s, (void *)offset); if (addr == TCG_REG_ZERO && diff == (int32_t)diff) { imm12 = sextreg(diff, 0, 12);