From patchwork Sat Apr 8 02:43:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 671489 Delivered-To: patch@linaro.org Received: by 2002:a5d:4d08:0:0:0:0:0 with SMTP id z8csp608635wrt; Fri, 7 Apr 2023 19:52:18 -0700 (PDT) X-Google-Smtp-Source: AKy350apouqXP+5el9Ax8lLlO33zYKZkpzboMarOav8wjoC+81wpX3PHLlhp/kSDZRqXmxTp1UNP X-Received: by 2002:ad4:5b84:0:b0:5a4:98df:5fec with SMTP id 4-20020ad45b84000000b005a498df5fecmr7613879qvp.41.1680922338426; Fri, 07 Apr 2023 19:52:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680922338; cv=none; d=google.com; s=arc-20160816; b=bu9/dUqxQefGuyBRrQjw5diGiIaKhZxjMKmvKvtxjrX2Sevwqqe+RHxXRMp66mr3/C nWPomUZXNG15kWRkEzLKW9g76xvwrEOO/4Yu2rHQOvD8lgFfvrrMMjLCobto9vqVkmVq ZP6AZQyZnJfZ9cBqnxnfOVXNdPtYJeWJE3hBpiKYwc5SZ3sSiRXH5DsnW2B+UAkVa+Yj 3WgIhDz4C8hYKDHeZXb+u5IkHuWmLfsm5ir49kalBgzZCYTUBbFdn72gTJht0EGxqcq5 57s/X1K9vBPdVc6wP1lyW4wOmykn0O3D686I55rBsc8e3QyHBNKawtPqyJavZFJO/4hS Rw7g== 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=U3GgpyquLQob+XRXyWgnv31s/PrsIm2aDbl8H8cAcdI=; b=ZuqKPxhE8SchIMjgckpci036JKq8lSdmArUxWX41sKfoDFGVqx+aF5M9D3MORkvaSf aAE/a/8vDt/tDGF6J3Ub5R59P/7vh+B+7AseLRHgy7X995JwY4ONNuWPzsl9pVGB+8N2 tI4keEkcHfAuAVxDVm6w+uAyfT4YGn5SGCYM+3M8eXhkvoo040Us4z3+smocx6x3/UK1 vbBbK/JSgSDoh01SaXU32Ydun29RmmY4I2JqaTQ9cSaTZQKEc3CFutPgQE7wJai1iqA1 zE/SH+oxiM082PL5ezvx5y1kYRyXBLtCM1y41GTaGANMS0XrNicY57UDwIw7Xre/RAF4 k3kQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="l63T0M/V"; 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 d9-20020ac85ac9000000b003bd161e1e8dsi3737439qtd.549.2023.04.07.19.52.18 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Apr 2023 19:52:18 -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=pass header.i=@linaro.org header.s=google header.b="l63T0M/V"; 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 1pkybV-0003eY-GN; Fri, 07 Apr 2023 22:47:01 -0400 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 1pkybQ-00034c-Ln for qemu-devel@nongnu.org; Fri, 07 Apr 2023 22:46:56 -0400 Received: from mail-pl1-x631.google.com ([2607:f8b0:4864:20::631]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pkybN-0007mW-1H for qemu-devel@nongnu.org; Fri, 07 Apr 2023 22:46:56 -0400 Received: by mail-pl1-x631.google.com with SMTP id la3so205459plb.11 for ; Fri, 07 Apr 2023 19:46:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1680922011; 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=U3GgpyquLQob+XRXyWgnv31s/PrsIm2aDbl8H8cAcdI=; b=l63T0M/V0iYGfYGWtNcXzE4Gt1VySSif84TJXZrITNNiJd49pcV85U/uX6922iUN4M UkFVfZhx9NZrohCaUZERwV3RS7A8ELtiPWt8TuSg1/JxnCIcs3dXzlpg1vQxR1A0cY3O MEHvia/+AMIRsE3NCQp2F/6YAXQA92LEVXIIAAA+QvnFa1nOlguuZYagIJF2UEb2ElK/ BO3uiV0KDg79C8vS+OHABK7G9NjlMVuviqbOV1FcMIOG+OY0kItBs2A1l5Mo3JrCkTyc 9rvuM/is0LPtqE95FzfUlzpPN2In8XjHpbt4PgznB698mN1hpv8SHLOn+pfZkbJcrtc3 lYLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680922011; 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=U3GgpyquLQob+XRXyWgnv31s/PrsIm2aDbl8H8cAcdI=; b=2dVUNut88PNiTVeTxMwovFvyC2TSBEx7njIOLQMqNqV2KLwg54rn536g2VibSRKWke AN8UpUwAf8pKgGZVtw8aUD5vHKDDkKTQ2Y0HAqB73TbIpaMP0LBEv5DS3xk9QJPg3CVE 19me8vlbL8uXRX2P62u+an3NgrlCy97roN/2acsC9z8Jl1vnUMURQPHNTJwlYWl1P170 UhR4iNPLsoSwEDfgBOeEHz8zLdrfhwosayTQwyRifwvlLbFpiNTiLp2XRt2bhnJYJC0k rUeh4UluIfFHGCq4//EqWipKMD+f6mYsunztXjJiIGour94rZrXoMFeIRzQPGuRf/J1X vOLg== X-Gm-Message-State: AAQBX9c8QLln2whY7PrgQ1b+iQMXhNBqRaYKuYdLj/aLEy4Z+OtT2DK2 8WzMwkyRIekIVO8KZHAVld1gyC0gnhaNvh6cqMQ= X-Received: by 2002:a17:902:e0d4:b0:1a1:d655:1ce4 with SMTP id e20-20020a170902e0d400b001a1d6551ce4mr3891401pla.38.1680922011406; Fri, 07 Apr 2023 19:46:51 -0700 (PDT) Received: from stoup.. ([2602:ae:1541:f901:8bb4:5a9d:7ab7:b4b8]) by smtp.gmail.com with ESMTPSA id k16-20020a170902761000b0019aa8149cc9sm3551981pll.35.2023.04.07.19.46.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Apr 2023 19:46:51 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, qemu-s390x@nongnu.org, qemu-riscv@nongnu.org, qemu-ppc@nongnu.org Subject: [PATCH 39/42] tcg/s390x: Use ALGFR in constructing host address for qemu_ld/st Date: Fri, 7 Apr 2023 19:43:11 -0700 Message-Id: <20230408024314.3357414-41-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230408024314.3357414-1-richard.henderson@linaro.org> References: <20230408024314.3357414-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::631; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x631.google.com X-Spam_score_int: 4 X-Spam_score: 0.4 X-Spam_bar: / X-Spam_report: (0.4 / 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, SUSPICIOUS_RECIPS=2.51 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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Rather than zero-extend the guest address into a register, use an add instruction which zero-extends the second input. Signed-off-by: Richard Henderson --- tcg/s390x/tcg-target.c.inc | 38 ++++++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/tcg/s390x/tcg-target.c.inc b/tcg/s390x/tcg-target.c.inc index 7d6cb30a06..b53eb70f24 100644 --- a/tcg/s390x/tcg-target.c.inc +++ b/tcg/s390x/tcg-target.c.inc @@ -149,6 +149,7 @@ typedef enum S390Opcode { RRE_ALGR = 0xb90a, RRE_ALCR = 0xb998, RRE_ALCGR = 0xb988, + RRE_ALGFR = 0xb91a, RRE_CGR = 0xb920, RRE_CLGR = 0xb921, RRE_DLGR = 0xb987, @@ -1716,8 +1717,10 @@ static void tcg_out_qemu_st_direct(TCGContext *s, MemOp opc, TCGReg data, QEMU_BUILD_BUG_ON(TLB_MASK_TABLE_OFS(0) > 0); QEMU_BUILD_BUG_ON(TLB_MASK_TABLE_OFS(0) < -(1 << 19)); -/* Load and compare a TLB entry, leaving the flags set. Loads the TLB - addend into R2. Returns a register with the santitized guest address. */ +/* + * Load and compare a TLB entry, leaving the flags set. + * Loads the TLB addend and returns the register. + */ static TCGReg tcg_out_tlb_read(TCGContext *s, TCGReg addr_reg, MemOp opc, int mem_index, bool is_ld) { @@ -1761,12 +1764,7 @@ static TCGReg tcg_out_tlb_read(TCGContext *s, TCGReg addr_reg, MemOp opc, tcg_out_insn(s, RXY, LG, TCG_REG_R2, TCG_REG_R2, TCG_REG_NONE, offsetof(CPUTLBEntry, addend)); - - if (TARGET_LONG_BITS == 32) { - tcg_out_ext32u(s, TCG_REG_R3, addr_reg); - return TCG_REG_R3; - } - return addr_reg; + return TCG_REG_R2; } static void add_qemu_ldst_label(TCGContext *s, bool is_ld, MemOpIdx oi, @@ -1888,16 +1886,20 @@ static void tcg_out_qemu_ld(TCGContext* s, TCGReg data_reg, TCGReg addr_reg, #ifdef CONFIG_SOFTMMU unsigned mem_index = get_mmuidx(oi); tcg_insn_unit *label_ptr; - TCGReg base_reg; + TCGReg addend; - base_reg = tcg_out_tlb_read(s, addr_reg, opc, mem_index, 1); + addend = tcg_out_tlb_read(s, addr_reg, opc, mem_index, 1); tcg_out16(s, RI_BRC | (S390_CC_NE << 4)); label_ptr = s->code_ptr; s->code_ptr += 1; - tcg_out_qemu_ld_direct(s, opc, data_reg, base_reg, TCG_REG_R2, 0); - + if (TARGET_LONG_BITS == 32) { + tcg_out_insn(s, RRE, ALGFR, addend, addr_reg); + tcg_out_qemu_ld_direct(s, opc, data_reg, addend, TCG_REG_NONE, 0); + } else { + tcg_out_qemu_ld_direct(s, opc, data_reg, addend, addr_reg, 0); + } add_qemu_ldst_label(s, 1, oi, d_type, data_reg, addr_reg, s->code_ptr, label_ptr); #else @@ -1920,16 +1922,20 @@ static void tcg_out_qemu_st(TCGContext* s, TCGReg data_reg, TCGReg addr_reg, #ifdef CONFIG_SOFTMMU unsigned mem_index = get_mmuidx(oi); tcg_insn_unit *label_ptr; - TCGReg base_reg; + TCGReg addend; - base_reg = tcg_out_tlb_read(s, addr_reg, opc, mem_index, 0); + addend = tcg_out_tlb_read(s, addr_reg, opc, mem_index, 0); tcg_out16(s, RI_BRC | (S390_CC_NE << 4)); label_ptr = s->code_ptr; s->code_ptr += 1; - tcg_out_qemu_st_direct(s, opc, data_reg, base_reg, TCG_REG_R2, 0); - + if (TARGET_LONG_BITS == 32) { + tcg_out_insn(s, RRE, ALGFR, addend, addr_reg); + tcg_out_qemu_st_direct(s, opc, data_reg, addend, TCG_REG_NONE, 0); + } else { + tcg_out_qemu_st_direct(s, opc, data_reg, addend, addr_reg, 0); + } add_qemu_ldst_label(s, 0, oi, d_type, data_reg, addr_reg, s->code_ptr, label_ptr); #else