From patchwork Wed Jan 18 01:11:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 643670 Delivered-To: patch@linaro.org Received: by 2002:a17:522:b9de:b0:4b9:b062:db3b with SMTP id fj30csp1489978pvb; Tue, 17 Jan 2023 17:13:15 -0800 (PST) X-Google-Smtp-Source: AMrXdXsOKDZEhx/VTyfS8IzPgVql/go/BsvaIGnuQnAI9PDzpbhbQWR5SCBIGlNxRNwBVlO4jBlg X-Received: by 2002:a05:6214:5f8a:b0:534:ba67:47c5 with SMTP id ls10-20020a0562145f8a00b00534ba6747c5mr8468593qvb.48.1674004395426; Tue, 17 Jan 2023 17:13:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674004395; cv=none; d=google.com; s=arc-20160816; b=uXT8A41QTvXe+2dDJEFJdVZ61AloLDBVFEIwO8sPJn9JJhDBIZHnvykuRIcs+JyG6l rNSe4RMDnAbQyD7RtXmycpsAJUNwoqtDmh24OOB43n+iBOnytIVcrMaPOeRUMUEK1sCM QQ3IZ2YkKou1e28nFGD3aC+g7vsWy8Y71Jt3rZ/B8J8m0rEkGPWZbcPTtoiSi4JeLr/c vVa93lYNRIJTILqgWPFxI8oqs5jWkEStpS75YGdaxzwId3LjnxeoFvMlScaEyhjxG1Th DLKJM4m6TZ7fH6q92/3JNJOwka+VOyodtCaazMzeugGsaiu68UeynIehAtqskdDj2HOD 6TBg== 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=oe653jAwb+trclLqO5xizolsekcbMLByW/eiNLY2YMk=; b=eWloowgwxc4zribkDy9LA+jyrvvwfZDpyrB3mKKuvH8zGPFFYABpRRhnlF+lPyhvjS XDKVlup2t5uioQhteYaeQFYm0Mg65y6NcrH8xBnV9UkmkN0Xo7Rpvh1cxv9Oy2Um+bHB Vu4+c2m4X/9iY86ars2X1norLCsIgEmR/PvB7DPU/xvlY+oVijakMDpVvBEI43a9ftXN QL5IGgo+uBcte5Kl4dg9kHZaTo0Plwmbu5pG1L6/QQFSJxxe8ckScrYfKgRGRiP2z9p0 w2/ZFUSgyvAMt/yocQKbTp5nIaV0sRCfi2WmMjxWWnX2ubS6F2/Hx7I2YNMdZGM6BkrF ByUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=T8Ni+FSx; 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 h13-20020a05620a284d00b006ee8f3ec6e3si19992346qkp.90.2023.01.17.17.13.15 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 17 Jan 2023 17:13:15 -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=T8Ni+FSx; 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 1pHwzR-0002BN-Fn; Tue, 17 Jan 2023 20:11:45 -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 1pHwzP-00028I-14 for qemu-devel@nongnu.org; Tue, 17 Jan 2023 20:11:43 -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 1pHwzN-0002Fl-B4 for qemu-devel@nongnu.org; Tue, 17 Jan 2023 20:11:42 -0500 Received: by mail-pl1-x630.google.com with SMTP id r21so3249119plg.13 for ; Tue, 17 Jan 2023 17:11:40 -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=oe653jAwb+trclLqO5xizolsekcbMLByW/eiNLY2YMk=; b=T8Ni+FSxd8awv/RgOySrM1axkRtVYW3VxzPhJ6km9unzqRLP1T/q8JqS7I19wG+r0Q zZe92g1lSnpPjTREUrx5g+azQXSZVBHVXgoMMlCAmtn2P5I1HycPvTBEXASuIQFBWou8 BTSRaFENSLVADRfZleKt1kNsKkRXzKrki+ZIuq9yv88OvEvGBx0brYPEy8ctHKJvC9Vh d8vz9sSS1NEWw40xk5ofZN1Q8jrdbc5JWL2AL52I2ai6fBnkAs6l1dpC3dIcQdR/JfT+ /lxiB1bVwH9e00DLDYXyHuZ0QUYwWdQZZP/ynRRC9bXAV7+dn0MwqDYVwbb7sh4UVAmQ iKAg== 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=oe653jAwb+trclLqO5xizolsekcbMLByW/eiNLY2YMk=; b=dfOcnMRGq5ilMBk2pgDzFD824riwxizanvNiszXd2IXasyl2IsWOoXbhdQbSDbpJ1j MJ73pdG+VobxDaL6btGJlKVn3bLZ2biXxIXNdxtqqUsYoRnf0eKyYzG5peqoCb0q7Oyh QF4CV12nlbEQhHMYZKki17g7J49az/hoyuEsfCbo5LuQt3UpjZzOb0axBfZw57QRvg87 9A0N9VBcEQKutVpdhMQTximCyC2236jxjwA5X798P5m5o09v72iL4OdS2Lfhn//C75M6 VSooa+YlHO/rj82eIEtXcz2sHIH/jKH7XGAeAQz2y+ae9z3h1/NdhPmzCh1NSUOrTlwp 4xxA== X-Gm-Message-State: AFqh2kpZB2zNHDpS2cvx/9rMiEasRLT0O5jk3UlOQjeZ1cl3csUBF30P Xxe/Eo20bD06iIzASfGpdFLKwLQqG8DOcxq3 X-Received: by 2002:a17:902:ab94:b0:194:62d9:9a86 with SMTP id f20-20020a170902ab9400b0019462d99a86mr5490670plr.59.1674004299900; Tue, 17 Jan 2023 17:11:39 -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 s7-20020a170902988700b0017ec1b1bf9fsm21660259plp.217.2023.01.17.17.11.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Jan 2023 17:11:39 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: git@xen0n.name Subject: [PATCH v2 09/10] tcg/loongarch64: Use tcg_pcrel_diff in tcg_out_ldst Date: Tue, 17 Jan 2023 15:11:22 -1000 Message-Id: <20230118011123.392823-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230118011123.392823-1-richard.henderson@linaro.org> References: <20230118011123.392823-1-richard.henderson@linaro.org> MIME-Version: 1.0 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=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: WANG Xuerui 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 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);