From patchwork Sun Oct 10 17:44:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 515597 Delivered-To: patch@linaro.org Received: by 2002:ac0:b5cc:0:0:0:0:0 with SMTP id x12csp3816920ime; Sun, 10 Oct 2021 10:48:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyrqjTJwlFawG8+808v2W7FGRwUke06xW4yioJCki9Z42h4n3VNJSJowK5j5d8ttQFokd15 X-Received: by 2002:a05:622a:112:: with SMTP id u18mr10358723qtw.192.1633888133306; Sun, 10 Oct 2021 10:48:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633888133; cv=none; d=google.com; s=arc-20160816; b=eJ2HSGg0oAKxWoLJzBSK7IF1FTHz+K0CLiN60JAqvsqNLLVvgnOOoHFYNg6OvF2TZ8 KKWCtB0NVee+NEg5eu6B5wiStentZ4dEbWtoAU5bP820hdDdNPJGfFD6LLagNKVbUj7j pKBg3tx4X5Y1/2XqtB5EAC5FaNJuI5lzeBmc63gnGntQl8CMoh2tdUq0GinkQVOHOn38 KioHXXZRUc+NNhJvZn9H7dTJFCudaex8W6+qs1LoxF1vitPvX1t/FfJJ1MRhlHGExsVn UM0tF38wlh6Cqg0E9WLHzD+WO1SVAGgA0vqMZ2ZUqwsVggi9y7ZvNp4fdsyI9ZQqMkxL +wag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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=SlW+IUqmPo07UfsLUjSBetG4k12I6tcttGhU4k9emPg=; b=oP98DH84iTUbwGSeB7EkXE+/CnxP+IkkMtr2bLYc14tPoXsJFjqivKG5Foa4dOG7gA phH+EjFhMGoDV/iy9gMQKW1UE6HWt1rRf+9ru5YZyYIP09nlj8wKxWvU5/nF0aIgoyHU Onq+NwSLEWH0ebS4r2qMoruxJ9GCJYdHHq28jjhRcjLDmB+L+VJYhrOxIVLoV14TkOc8 v/aSRk0py8KIRl/4Xj4o0XYxSq7FqlnybSlRaSNt9bpVOniEvANkiEUG+tnr9s0afMHp jFO+jmG7yrY5/oc1szKPB5/3hSpxyG9pGh1BOGHGA8ZpD1beTiCKpQ0sXvCYafdGnDQD FPDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=M89zMZ5m; 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=fail (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 o19si4334795qtk.33.2021.10.10.10.48.53 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 10 Oct 2021 10:48:53 -0700 (PDT) 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=fail header.i=@linaro.org header.s=google header.b=M89zMZ5m; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:60266 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mZcwO-0003Zx-RI for patch@linaro.org; Sun, 10 Oct 2021 13:48:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50926) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mZcs9-0000aC-RV for qemu-devel@nongnu.org; Sun, 10 Oct 2021 13:44:30 -0400 Received: from mail-pj1-x1033.google.com ([2607:f8b0:4864:20::1033]:37755) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mZcs2-0006Ay-1t for qemu-devel@nongnu.org; Sun, 10 Oct 2021 13:44:29 -0400 Received: by mail-pj1-x1033.google.com with SMTP id oa6-20020a17090b1bc600b0019ffc4b9c51so12957389pjb.2 for ; Sun, 10 Oct 2021 10:44:20 -0700 (PDT) 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=SlW+IUqmPo07UfsLUjSBetG4k12I6tcttGhU4k9emPg=; b=M89zMZ5mN6x1x8O+7HfSa7VatIQ7T4b4DKRP3Z59lPTc9OK8F9692vFF01YtJgODQ7 r0ytrzf6u4yFWdbvAnlU4GkdHcKD4RCzRqraZtix7kGLBPn+Hy4mQxzkIgxbdNF7UQRR dDDcJq1BmNgKQr5Uglk48oet2hFAFCYsmEDbp2R5lLjbd0GINt/a6E+GzjYnBO+H1mql KApP4EcVZegvyYKfDEBvVJbchTeMOlqeMGyuiidjGoqwTVu7W9gkbEeNeDT/rh2q5AP/ nt+1xkuTlpE/hX41VaFyqcUC2e//zoQf5JYKC7zpdFjsbph6tJLJobqHjkPghHA2S9iu xejA== 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=SlW+IUqmPo07UfsLUjSBetG4k12I6tcttGhU4k9emPg=; b=GHlXjfMh/WL9vcIdb96l5xet0lBKTamDUOkezANW2ugmnPZvFM5BzmEq6TP9oEz39L PKq34+GTPKx0L8KS0YzDh1pNuLQOlufdxulWQVremEiwgs8SjAbnz49bwE6HMGWTokVa kzZef86cYlW9VpKFrnLm2jBjKAR9uMQfCngjGTjbAYR6uHs/EHodxqIMciabKIwN35Qg clbgG8A9Ta+bd34AyFnFcNJ0an5bxPmiJiSDED7xNQLa6FzSda/A/XQDkiGWmK13JscL sKFrl34nIPAacb8nj23P5gQ/re3MZaNT/kXnnLb4sXnTrfeTr9kRY/CwwXfBrgKnw9A7 mfIg== X-Gm-Message-State: AOAM532Vq0ufmYRCAexxpwiijBsXHfggeChUhm07yOgl+OCzSPYzcFvd scvFFfi6U0GT7iXepsvOF+Qbtc+Wi+SnfgNf X-Received: by 2002:a17:903:41d0:b0:13f:1bbf:1535 with SMTP id u16-20020a17090341d000b0013f1bbf1535mr11379365ple.52.1633887859637; Sun, 10 Oct 2021 10:44:19 -0700 (PDT) Received: from localhost.localdomain (068-185-026-038.biz.spectrum.com. [68.185.26.38]) by smtp.gmail.com with ESMTPSA id 18sm5095391pfh.115.2021.10.10.10.44.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Oct 2021 10:44:19 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 7/8] target/mips: Support TCG_TARGET_SIGNED_ADDR32 Date: Sun, 10 Oct 2021 10:44:00 -0700 Message-Id: <20211010174401.141339-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211010174401.141339-1-richard.henderson@linaro.org> References: <20211010174401.141339-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1033; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1033.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, T_SPF_TEMPERROR=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: git@xen0n.name, Alistair.Francis@wdc.com, f4bug@amsat.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" All 32-bit mips operations sign-extend the output, so we are easily able to keep TCG_TYPE_I32 values sign-extended in host registers. Signed-off-by: Richard Henderson --- tcg/mips/tcg-target-sa32.h | 8 ++++++++ tcg/mips/tcg-target.c.inc | 13 +++---------- 2 files changed, 11 insertions(+), 10 deletions(-) -- 2.25.1 diff --git a/tcg/mips/tcg-target-sa32.h b/tcg/mips/tcg-target-sa32.h index cb185b1526..51255e7cba 100644 --- a/tcg/mips/tcg-target-sa32.h +++ b/tcg/mips/tcg-target-sa32.h @@ -1 +1,9 @@ +/* + * Do not set TCG_TARGET_SIGNED_ADDR32 for mips32; + * TCG expects this to only be set for 64-bit hosts. + */ +#ifdef __mips64 +#define TCG_TARGET_SIGNED_ADDR32 1 +#else #define TCG_TARGET_SIGNED_ADDR32 0 +#endif diff --git a/tcg/mips/tcg-target.c.inc b/tcg/mips/tcg-target.c.inc index d8f6914f03..cc3b4d5b90 100644 --- a/tcg/mips/tcg-target.c.inc +++ b/tcg/mips/tcg-target.c.inc @@ -1161,20 +1161,13 @@ static void tcg_out_tlb_load(TCGContext *s, TCGReg base, TCGReg addrl, tcg_out_ld(s, TCG_TYPE_I32, TCG_TMP0, TCG_TMP3, cmp_off + LO_OFF); tcg_out_movi(s, TCG_TYPE_I32, TCG_TMP1, mask); } else { - tcg_out_ldst(s, (TARGET_LONG_BITS == 64 ? OPC_LD - : TCG_TARGET_REG_BITS == 64 ? OPC_LWU : OPC_LW), - TCG_TMP0, TCG_TMP3, cmp_off); + tcg_out_ld(s, TCG_TYPE_TL, TCG_TMP0, TCG_TMP3, cmp_off); tcg_out_movi(s, TCG_TYPE_TL, TCG_TMP1, mask); /* No second compare is required here; load the tlb addend for the fast path. */ tcg_out_ld(s, TCG_TYPE_PTR, TCG_TMP2, TCG_TMP3, add_off); } - /* Zero extend a 32-bit guest address for a 64-bit host. */ - if (TCG_TARGET_REG_BITS > TARGET_LONG_BITS) { - tcg_out_ext32u(s, base, addrl); - addrl = base; - } tcg_out_opc_reg(s, OPC_AND, TCG_TMP1, TCG_TMP1, addrl); label_ptr[0] = s->code_ptr; @@ -1456,7 +1449,7 @@ static void tcg_out_qemu_ld(TCGContext *s, const TCGArg *args, bool is_64) data_regl, data_regh, addr_regl, addr_regh, s->code_ptr, label_ptr); #else - if (TCG_TARGET_REG_BITS > TARGET_LONG_BITS) { + if (TCG_TARGET_REG_BITS > TARGET_LONG_BITS && !guest_base_signed_addr32) { tcg_out_ext32u(s, base, addr_regl); addr_regl = base; } @@ -1559,7 +1552,7 @@ static void tcg_out_qemu_st(TCGContext *s, const TCGArg *args, bool is_64) s->code_ptr, label_ptr); #else base = TCG_REG_A0; - if (TCG_TARGET_REG_BITS > TARGET_LONG_BITS) { + if (TCG_TARGET_REG_BITS > TARGET_LONG_BITS && !guest_base_signed_addr32) { tcg_out_ext32u(s, base, addr_regl); addr_regl = base; }