From patchwork Tue Jan 24 02:05:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 646016 Delivered-To: patch@linaro.org Received: by 2002:a17:522:b9de:b0:4b9:b062:db3b with SMTP id fj30csp2512368pvb; Mon, 23 Jan 2023 18:07:04 -0800 (PST) X-Google-Smtp-Source: AMrXdXsVMV8lOUxyyU2tHSe7jPhRsSqDFlTIrqNJ2R9IU9ijcyhGFQGV8ZEY7hSrE4tlmA8dY+g3 X-Received: by 2002:a0c:fe46:0:b0:534:939f:2066 with SMTP id u6-20020a0cfe46000000b00534939f2066mr36365340qvs.19.1674526024486; Mon, 23 Jan 2023 18:07:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674526024; cv=none; d=google.com; s=arc-20160816; b=XCQukUmyDER4NANk1FRCB44csLoc+cy9niFOF/+2vRYQbi8mmc6qjVzRw/QOWfpPIE l/ufp8mRpmnJkIqvbQ+iLWO7ixt8wMVkDzb9rDPK4N47dtZJmUVl1Dyp6EpSP9oHF3iV I+lXllvVfgLWxGnqe5Eso9kCON9w8hKIhPcvduwqi5qX38nnTu3rzjldinVdWjAASUzc c+YMcQd0qwoRgpjAfSOuDiRl3lSqT7O+IgNhCUt36cHGpVLPBciCmAGfVtqPMihL3dss THRCq3imV2Dc7hQEVjgptB11LmNCrw3qTPwcsjpbHuH0BWNeCf/YNhhIo0FgRZktWlCn ilog== 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:cc:to :from:dkim-signature; bh=OQh7lC/BpzZeduC7Wz+UgP0x9EJv+51vLIbuSepWr2I=; b=D83UZzjpqsK6J7ven/UdKQvBAyd1QiMrifXNzyQY3wuWxVlmDSZLbIvETT9+G3sFbe DmX5XHSdSRXo1qpiJN7/ccQgD/AMVcbkplI3OKIiynXxm17nXAjSMvLVLjZapwpozvnl L6w6oDQtneFUx1su7X+KoPic7TuXfPxn6sdPalmPQWMmG3oEGNoGzBY2YcAdSF2W1aB/ 0mFWpl8T/JDasPyAXIIh+AzgW+LG4KllFEhuSSnGPth21g2VvmHljcyhBmEjgB4++ssR srs8ha/rJHJY8MFbDyIwjDvEQ+5DwBR2o3FcIZhAe+V4O8nbHSY/y122WjEyFlFZXtX1 JCjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kBtJ2Itp; 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 bt20-20020ad455d4000000b0053527d7215asi449633qvb.426.2023.01.23.18.07.04 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Jan 2023 18:07:04 -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=kBtJ2Itp; 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 1pK8gs-0008UM-7Z; Mon, 23 Jan 2023 21:05:38 -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 1pK8gq-0008TD-F7 for qemu-devel@nongnu.org; Mon, 23 Jan 2023 21:05:36 -0500 Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pK8go-0003ve-QD for qemu-devel@nongnu.org; Mon, 23 Jan 2023 21:05:36 -0500 Received: by mail-pl1-x62c.google.com with SMTP id k18so13340827pll.5 for ; Mon, 23 Jan 2023 18:05:34 -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:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=OQh7lC/BpzZeduC7Wz+UgP0x9EJv+51vLIbuSepWr2I=; b=kBtJ2ItpRJJkRUDywV4tlsaWLuP/huDEXcMyXzz5+CsbyeqdAt/k9vPpYGn2uvC+36 41U6SmGVnCVQ/qsG+btcAeHYn+U+7o+nFCIeViLrUGXOer2OaM82hVHFPkFc4jKq8jNB DvHe3aDR/yl4rOtVi8fKUE26ba1Dniej0kqTIfNXJkcO66rabogZY9P8NNpmEVMK+Hzb xQWiMTBWQcNQ7+3j5L8SFvWJVDzqFma34ZmAIpET7xGvRGjnJA8OVvZdip9048Z2BigK 9RM3AydG5tmA8RRDozHakig3P9NmZLM9kPEAR9kdoY631HAEbPtAjgThJTB2I4Ve/v77 RDaQ== 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:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=OQh7lC/BpzZeduC7Wz+UgP0x9EJv+51vLIbuSepWr2I=; b=PfPvOS1SINYlV9d6W3BBnMJNtPDC2EDDjNYvR1w/FcPBdwdnBQm3B2LgVyFCAwMDge D3q2wRSuvMnglWWEffyi7sA19/y/MZpbP+s3i2e9dWBL5HANGpXmUW1Ax2srwdfpIOJ8 80yrujn7xHBlZH13BtfM409vTrVV48kyrF2c5+gUZ9r4YzVDa7biV5y0tlYc8J4umqbm niRQOc7sLR4L1jZxUR4eiwoVjhMeFaO2LcmAleCy6XidcT6OEwJKqn6gFW5unIgp0bxb +Zf93NvKh0HwrgPqH7PGduAOCSBOxil01DzwENiSIRs0he6Da98e57Tjwn6jeyVrQDcZ sLug== X-Gm-Message-State: AO0yUKWFAsyn8+O5T8bXgz2camkKTQLZYdUuC9SvugsZKZH0nZ+wxWLt hvdSQ++vWMnAcLxl7TvNOBlvO3LV/7Qh0+98 X-Received: by 2002:a17:90a:46:b0:22b:ecbc:8113 with SMTP id 6-20020a17090a004600b0022becbc8113mr863864pjb.12.1674525934072; Mon, 23 Jan 2023 18:05:34 -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 fh3-20020a17090b034300b00228e56d375asm283936pjb.33.2023.01.23.18.05.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Jan 2023 18:05:33 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, WANG Xuerui , =?utf-8?q?Philip?= =?utf-8?q?pe_Mathieu-Daud=C3=A9?= Subject: [PULL v2 14/15] tcg/loongarch64: Use tcg_pcrel_diff in tcg_out_ldst Date: Mon, 23 Jan 2023 16:05:06 -1000 Message-Id: <20230124020507.3732200-15-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230124020507.3732200-1-richard.henderson@linaro.org> References: <20230124020507.3732200-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62c; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62c.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. Reviewed-by: WANG Xuerui Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- 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 29d75c80eb..d6926bdb83 100644 --- a/tcg/loongarch64/tcg-target.c.inc +++ b/tcg/loongarch64/tcg-target.c.inc @@ -702,7 +702,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);