From nobody Sun May 19 07:31:40 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1673996708; cv=none; d=zohomail.com; s=zohoarc; b=MLDjTUMIM5lrUFzBvpEZTUskELWMkWD+G1iPnMNK2b0lc6Y+Oo/vWZMJa760h+biv6M9cBLoAqI+54EkuKWFPeKElv1c5427t8YuTlWgN2M/ykvf863u/tfBNnC7Frubrevwryez1XISdDJjVApkxwUlIgeWWH5bcqWeWqoARm4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1673996708; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=b0RaJxHriq3Te1EB6P00dNqAISsg79vtZKWwbbnq+Yk=; b=gAFw6ysZSriqAqNvt91KcP5zf8KBCEsZ8rvWMtgBZglFW4sdJBXX4x6H5f8a4TofoI2C8qlU4qAIrqCn6l46cBDhbDp5WKfGSH8QyEYn3pksYzDGT8Ad5AhKhUt8STiKt7HKjgWDi5CzP/G7gpWNnZ6vVDreKKu+sqcBC6KH3us= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1673996708460480.82589139906315; Tue, 17 Jan 2023 15:05:08 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pHv0E-00015P-Rg; Tue, 17 Jan 2023 18:04:28 -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 1pHv0C-000157-87 for qemu-devel@nongnu.org; Tue, 17 Jan 2023 18:04:24 -0500 Received: from mail-pl1-x630.google.com ([2607:f8b0:4864:20::630]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pHv0A-0008PQ-0R for qemu-devel@nongnu.org; Tue, 17 Jan 2023 18:04:23 -0500 Received: by mail-pl1-x630.google.com with SMTP id jl3so20221plb.8 for ; Tue, 17 Jan 2023 15:04:20 -0800 (PST) Received: from stoup.. (rrcs-173-198-77-218.west.biz.rr.com. [173.198.77.218]) by smtp.gmail.com with ESMTPSA id y13-20020a63e24d000000b00478eb777d18sm17996936pgj.72.2023.01.17.15.04.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Jan 2023 15:04:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=b0RaJxHriq3Te1EB6P00dNqAISsg79vtZKWwbbnq+Yk=; b=WGlollt1g4CKFpfPYo2emR9kAiDj7nchGDk/FRN/y8gLAzGtk+4z6Xa0yVzZcb7O/m PQFUSmrfb8frmwjBQrTG9yNYxMKoVOTo8E9bkugBW82N53oiLbL8sRVSBnzsXInpERUc EDjKaZNPBYO46B/eWrrQ/exn0pGMDko1NX20P2WrV1oEjHrxweVpWjG6dCFMzkwvfUTv nWFT1H+lNJyHvDkjiqmCCZX8Wjtp9xZTsJuCPGjPJlI2YXkiAFhvbNwE1NyKevrtRpFe HQRmPQ+PvBtImm7CE8wZKArqpTlWCZ3ZqEWufm7sdjYsqs73hAsQ9+dxTJMMUDZQOvu5 jUzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=b0RaJxHriq3Te1EB6P00dNqAISsg79vtZKWwbbnq+Yk=; b=NV4YpvbanIsxYcny5Y6JT9/32KW9xPfN8VQfwRxrpMXbAU9/GgbHugw408UeFddFe5 S9bqm2s2ukCLw2NHGDcqgJdxVZNOzgThezrpPaR70zo2MeTf69IwCIo6i5KIVXndXNDc xfSO4qI+QyyudLh+b4lMzdZSTJNTa/yn6+DEJpKCDHEwuu+zDQ/0Qb1/hxZOAVrZnzLK wSGbykWRd7ZBVHxUQWbbdI+la5dcxnnbxYAeyxhEH4gMLYOJjphfus0nB0gUnjK1QuoW 2d2TBec1HE3YBeRbOhM1C3uKat8R9+a1eag6oOyoTqdRvQQdUc99EBcbtZjxGLmJ04IG Mkhw== X-Gm-Message-State: AFqh2krtLKx5VaFel34ar/B6sQJ0tXuk/tCR1PAWH8sLGA3P3pKwCRyf KfVxfN5Ub45C9V8xPputajK0VZoW5/nhz+h5 X-Google-Smtp-Source: AMrXdXv+rod9RRDt00JJK4cjUHTk68MqtlVo0xjW96Ngz20atc5z7KTG6iav+PpI/J+lQxoYA5vJcA== X-Received: by 2002:a05:6a21:3282:b0:b8:c29f:1c01 with SMTP id yt2-20020a056a21328200b000b8c29f1c01mr5809347pzb.27.1673996659490; Tue, 17 Jan 2023 15:04:19 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-riscv@nongnu.org, Alistair.Francis@wdc.com Subject: [PATCH] tcg/riscv: Use tcg_pcrel_diff in tcg_out_ldst Date: Tue, 17 Jan 2023 13:04:15 -1000 Message-Id: <20230117230415.354239-1-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::630; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x630.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=unavailable 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1673996710515100001 Content-Type: text/plain; charset="utf-8" We failed to update this with the w^x split, so misses the fact that true pc-relative offsets are usually small. Signed-off-by: Richard Henderson Reviewed-by: Alistair Francis --- tcg/riscv/tcg-target.c.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tcg/riscv/tcg-target.c.inc b/tcg/riscv/tcg-target.c.inc index fc0edd811f..01cb67ef7b 100644 --- a/tcg/riscv/tcg-target.c.inc +++ b/tcg/riscv/tcg-target.c.inc @@ -599,7 +599,7 @@ static void tcg_out_ldst(TCGContext *s, RISCVInsn opc, = TCGReg data, intptr_t imm12 =3D sextreg(offset, 0, 12); =20 if (offset !=3D imm12) { - intptr_t diff =3D offset - (uintptr_t)s->code_ptr; + intptr_t diff =3D tcg_pcrel_diff(s, (void *)offset); =20 if (addr =3D=3D TCG_REG_ZERO && diff =3D=3D (int32_t)diff) { imm12 =3D sextreg(diff, 0, 12); --=20 2.34.1