From nobody Tue Feb 10 23:14:07 2026 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=1646335168; cv=none; d=zohomail.com; s=zohoarc; b=fmcbGfZ+lxPJnhZ6g9xeAhNIMnG88AZPRHpKP7oBuRe6ry0DkYmaOYrBHocrpg11OK9upayz1tAcOJi8N2yS/y6P6yR1S6mgF2eKNhTBgnUf0XL+wPTXlMXKyQ+7oONOmf7BqjARGvjvXu40veRn2klKfyt24+wjalXboLufhG0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646335168; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=KnojlxdJvLZ10xztEz7NOsevcqMVQEVsVSU9aLxpzTg=; b=B/kxLO2U1EXZJUk79E5jfKfxGArSup6WnLwXn0B9WEzgvA4mbCg6p648h+PnjY0QkXcNoFdTHnBXcbmhz96OD1AFatbSeJY3fqt13MkyOb9Dt3zmDAyuk48374TlRsEcpy2VQ1Kt6rUEJQJMktvyz2ZIl/NQbx6+4MNf+uux0Jg= 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 1646335168167355.92484805380684; Thu, 3 Mar 2022 11:19:28 -0800 (PST) Received: from localhost ([::1]:34872 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nPqz0-0004wh-Ro for importer@patchew.org; Thu, 03 Mar 2022 14:19:26 -0500 Received: from eggs.gnu.org ([209.51.188.92]:60162) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nPqvt-00027g-BJ for qemu-devel@nongnu.org; Thu, 03 Mar 2022 14:16:13 -0500 Received: from [2607:f8b0:4864:20::1035] (port=32911 helo=mail-pj1-x1035.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nPqvo-0007UN-Bd for qemu-devel@nongnu.org; Thu, 03 Mar 2022 14:16:12 -0500 Received: by mail-pj1-x1035.google.com with SMTP id m13-20020a17090aab0d00b001bbe267d4d1so6721437pjq.0 for ; Thu, 03 Mar 2022 11:16:07 -0800 (PST) Received: from localhost.localdomain (2603-800c-1201-c600-119c-490c-a4ee-08e8.res6.spectrum.com. [2603:800c:1201:c600:119c:490c:a4ee:8e8]) by smtp.gmail.com with ESMTPSA id u25-20020a62ed19000000b004f140515d56sm3318043pfh.46.2022.03.03.11.16.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Mar 2022 11:16:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=KnojlxdJvLZ10xztEz7NOsevcqMVQEVsVSU9aLxpzTg=; b=qz6RvfJFMgigWzzM1vRT/5gb9lGxqkQWy6iTWqwlLwVxc4Di62FNOYwztB/Nf83cB5 2d633BfUoHMevCAR2acUejkqcTJQHOHT1wuDl61Nfz9kNJ9YsAjWGga2PC9aNYvf4P3F Dk9a111+jCaDg567I8EeUTjWHzuCGXtgfn51vzenakFOHBGIjXO/IbYVcQjywe0yGSmw keW3rxsMYgKz/3YUdYgb6X7aMGw0AuEs2V7lVH7FGnhrvkkhNym5bg39EYZnj/NZo8Bx fTVPQaG9JgW9coh+Z9Eu5M+jvMCQgMri8kBaxr/HRSnib+TWVagcHBE3UfxtKRofDGMT ZWyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=KnojlxdJvLZ10xztEz7NOsevcqMVQEVsVSU9aLxpzTg=; b=hlywM21ej7xcX/32Uvnv8wI14YRYVy1I8hjxd75onT31VBuwH0N3bUEVT4pbg/pC8I i7ufybW5ScnFFgmQ24gwfpV7dxtS4YQhhWYyTUMaf1Wi4i5tFCv3UFpCPQtBOaiFcQVG HhWH0WPMVwAK+1r4eLgEGBCtW+AHprV+BDA3YYYHO4Tm1lOlyHEXbekfoSGmaTNFz2cp ONDAOpCjCqy7qtX0nqqGQda5Hx2GTYPmq5uWWXFR95fBtv9UbddhGQvaF6Bt9RD+RZ0W LDs8erf0c/LL73OesCLl324Sgrf2MebOJ8bst6CZGKVxlwfoXMKoJINui0ktSN45dqbL gIpQ== X-Gm-Message-State: AOAM530XIaUc1lDH7B13SXQvfSD9DVL7ddiXZKfnN0D8CAPyM7qe0gZB d3imlCv/J3HOC/R6k+TP1mCH8ugRfzaeWQ== X-Google-Smtp-Source: ABdhPJwD5tjnIeiyD16cT49Zxn0ZpH46vFyhdTyyA+O04FkB/VIQbhowFuuOfxd/L0zCnwkkQcw8XA== X-Received: by 2002:a17:902:9348:b0:14f:c715:2a94 with SMTP id g8-20020a170902934800b0014fc7152a94mr38082555plp.66.1646334967036; Thu, 03 Mar 2022 11:16:07 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 9/9] tcg/loongarch64: Support TCG_TARGET_SIGNED_ADDR32 Date: Thu, 3 Mar 2022 09:15:51 -1000 Message-Id: <20220303191551.466631-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220303191551.466631-1-richard.henderson@linaro.org> References: <20220303191551.466631-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::1035 (failed) 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::1035; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1035.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 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, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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: , Cc: WANG Xuerui , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1646335168965100001 All 32-bit LoongArch operations sign-extend the output, so we are easily able to keep TCG_TYPE_I32 values sign-extended in host registers. Cc: WANG Xuerui Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- tcg/loongarch64/tcg-target-sa32.h | 2 +- tcg/loongarch64/tcg-target.c.inc | 15 ++++++--------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/tcg/loongarch64/tcg-target-sa32.h b/tcg/loongarch64/tcg-target= -sa32.h index cb185b1526..aaffd777bf 100644 --- a/tcg/loongarch64/tcg-target-sa32.h +++ b/tcg/loongarch64/tcg-target-sa32.h @@ -1 +1 @@ -#define TCG_TARGET_SIGNED_ADDR32 0 +#define TCG_TARGET_SIGNED_ADDR32 1 diff --git a/tcg/loongarch64/tcg-target.c.inc b/tcg/loongarch64/tcg-target.= c.inc index a3debf6da7..425f6629ca 100644 --- a/tcg/loongarch64/tcg-target.c.inc +++ b/tcg/loongarch64/tcg-target.c.inc @@ -880,8 +880,6 @@ static bool tcg_out_qemu_st_slow_path(TCGContext *s, TC= GLabelQemuLdst *l) return tcg_out_fail_alignment(s, l); } =20 -#endif /* CONFIG_SOFTMMU */ - /* * `ext32u` the address register into the temp register given, * if target is 32-bit, no-op otherwise. @@ -891,12 +889,13 @@ static bool tcg_out_qemu_st_slow_path(TCGContext *s, = TCGLabelQemuLdst *l) static TCGReg tcg_out_zext_addr_if_32_bit(TCGContext *s, TCGReg addr, TCGReg tmp) { - if (TARGET_LONG_BITS =3D=3D 32) { + if (TARGET_LONG_BITS =3D=3D 32 && !guest_base_signed_addr32) { tcg_out_ext32u(s, tmp, addr); return tmp; } return addr; } +#endif /* CONFIG_SOFTMMU */ =20 static void tcg_out_qemu_ld_indexed(TCGContext *s, TCGReg rd, TCGReg rj, TCGReg rk, MemOp opc, TCGType type) @@ -944,8 +943,8 @@ static void tcg_out_qemu_ld(TCGContext *s, const TCGArg= *args, TCGType type) tcg_insn_unit *label_ptr[1]; #else unsigned a_bits; -#endif TCGReg base; +#endif =20 data_regl =3D *args++; addr_regl =3D *args++; @@ -954,8 +953,7 @@ static void tcg_out_qemu_ld(TCGContext *s, const TCGArg= *args, TCGType type) =20 #if defined(CONFIG_SOFTMMU) tcg_out_tlb_load(s, addr_regl, oi, label_ptr, 1); - base =3D tcg_out_zext_addr_if_32_bit(s, addr_regl, TCG_REG_TMP0); - tcg_out_qemu_ld_indexed(s, data_regl, base, TCG_REG_TMP2, opc, type); + tcg_out_qemu_ld_indexed(s, data_regl, addr_regl, TCG_REG_TMP2, opc, ty= pe); add_qemu_ldst_label(s, 1, oi, type, data_regl, addr_regl, s->code_ptr, label_ptr); @@ -1004,8 +1002,8 @@ static void tcg_out_qemu_st(TCGContext *s, const TCGA= rg *args) tcg_insn_unit *label_ptr[1]; #else unsigned a_bits; -#endif TCGReg base; +#endif =20 data_regl =3D *args++; addr_regl =3D *args++; @@ -1014,8 +1012,7 @@ static void tcg_out_qemu_st(TCGContext *s, const TCGA= rg *args) =20 #if defined(CONFIG_SOFTMMU) tcg_out_tlb_load(s, addr_regl, oi, label_ptr, 0); - base =3D tcg_out_zext_addr_if_32_bit(s, addr_regl, TCG_REG_TMP0); - tcg_out_qemu_st_indexed(s, data_regl, base, TCG_REG_TMP2, opc); + tcg_out_qemu_st_indexed(s, data_regl, addr_regl, TCG_REG_TMP2, opc); add_qemu_ldst_label(s, 0, oi, 0, /* type param is unused for stores */ data_regl, addr_regl, --=20 2.25.1