From nobody Tue Feb 10 16:21:34 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1542985135699378.5459017671187; Fri, 23 Nov 2018 06:58:55 -0800 (PST) Received: from localhost ([::1]:52819 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gQCv0-0004Od-6S for importer@patchew.org; Fri, 23 Nov 2018 09:58:54 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44027) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gQCis-0008GY-35 for qemu-devel@nongnu.org; Fri, 23 Nov 2018 09:46:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gQCin-0003Mi-5G for qemu-devel@nongnu.org; Fri, 23 Nov 2018 09:46:20 -0500 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]:45075) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gQCim-0003LE-Ph for qemu-devel@nongnu.org; Fri, 23 Nov 2018 09:46:17 -0500 Received: by mail-wr1-x443.google.com with SMTP id v6so12573029wrr.12 for ; Fri, 23 Nov 2018 06:46:16 -0800 (PST) Received: from cloudburst.twiddle.net ([195.77.246.50]) by smtp.gmail.com with ESMTPSA id p74sm10339630wmd.29.2018.11.23.06.46.14 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 23 Nov 2018 06:46:14 -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; bh=8t7gEiP0UljdZGOq63+3IiIupXpsvdWUor96eMaww/U=; b=Mqq7XUuC0JQsXv+tyGQoxIx/uCgeohv6aUAGqdRPkOcMZN661/wj4kZmbLrlFYsz0t WNa+A9x6hlbLgzsEYD1pJxoH/Kt6h8u2H4pnDhUKPKFIsEt7CInyKcjXHIb1/N+WE1fZ nqoa/IjYEXqMXmo9gxHy3sTRdR6gXkQMzaU0g= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=8t7gEiP0UljdZGOq63+3IiIupXpsvdWUor96eMaww/U=; b=ULz0sbO/YmE3g2LrVrPGLGR/onJtg1Ek5G+DsRaILDmgpjCoL3Awa0U0aiEKveBKa5 KDL0VK/8rYLIW1J7Otql2aOabTox1NdboAAJCnW7VtRhMWUEDNxLF8JgQARB5SACap7m 7EBdmX+LCpnYGbVDLTXLCXRPfCexScMB1i0/BkFMi5bVm3DKilKRfd8dLmDC7PpESIy5 v61dGOTKorJ7aYXhAiJLFmBpUfzTU8rEruH9nfle5qIxZ5aJX0MmhJ4OiVJN78MqHIVi wyoJkDE+TN9mAearY3ZDsLTH4PQ/g+ptx1miNIycDZgw89HluMbpjrZWKxfQME8itqTT SMKw== X-Gm-Message-State: AA+aEWZfqR0uA0Qwi8FZURFNDwtx1Fft8EevGzgsBmIMGpYG+3wiLPol 1fyOD5MR0tf9VWBnmzsXwoN0jpznXP4BbQ== X-Google-Smtp-Source: AFSGD/VTFjayYkaXIU45MVrUi0o0jQDw/SPCEMj7bRx70wvmDvZDK8XTx19/6MBbu4nmmxOQqI5LJA== X-Received: by 2002:adf:ef50:: with SMTP id c16mr13861349wrp.198.1542984375308; Fri, 23 Nov 2018 06:46:15 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Fri, 23 Nov 2018 15:45:36 +0100 Message-Id: <20181123144558.5048-16-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181123144558.5048-1-richard.henderson@linaro.org> References: <20181123144558.5048-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::443 Subject: [Qemu-devel] [PATCH for-4.0 v2 15/37] tcg/arm: Parameterize the temps for tcg_out_tlb_read X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alistair.Francis@wdc.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" When moving the qemu_ld/st arguments to the right place for a function call, we'll need to move the temps out of the way. Signed-off-by: Richard Henderson --- tcg/arm/tcg-target.inc.c | 89 +++++++++++++++++++++------------------- 1 file changed, 46 insertions(+), 43 deletions(-) diff --git a/tcg/arm/tcg-target.inc.c b/tcg/arm/tcg-target.inc.c index 80d174ef44..414c91c9ea 100644 --- a/tcg/arm/tcg-target.inc.c +++ b/tcg/arm/tcg-target.inc.c @@ -1245,11 +1245,14 @@ static TCGReg tcg_out_arg_reg64(TCGContext *s, TCGR= eg argreg, /* We're expecting to use an 8-bit immediate and to mask. */ QEMU_BUILD_BUG_ON(CPU_TLB_BITS > 8); =20 -/* Load and compare a TLB entry, leaving the flags set. Returns the regis= ter - containing the addend of the tlb entry. Clobbers R0, R1, R2, TMP. */ - +/* + *Load and compare a TLB entry, leaving the flags set. Returns the regist= er + * containing the addend of the tlb entry. Clobbers t0, t1, t2, t3. + * T0 and T1 must be consecutive for LDRD. + */ static TCGReg tcg_out_tlb_read(TCGContext *s, TCGReg addrlo, TCGReg addrhi, - TCGMemOp opc, int mem_index, bool is_load) + TCGMemOp opc, int mem_index, bool is_load, + TCGReg t0, TCGReg t1, TCGReg t2, TCGReg t3) { TCGReg base =3D TCG_AREG0; int cmp_off =3D @@ -1262,36 +1265,37 @@ static TCGReg tcg_out_tlb_read(TCGContext *s, TCGRe= g addrlo, TCGReg addrhi, unsigned a_bits =3D get_alignment_bits(opc); =20 /* V7 generates the following: - * ubfx r0, addrlo, #TARGET_PAGE_BITS, #CPU_TLB_BITS - * add r2, env, #high - * add r2, r2, r0, lsl #CPU_TLB_ENTRY_BITS - * ldr r0, [r2, #cmp] - * ldr r2, [r2, #add] - * movw tmp, #page_align_mask - * bic tmp, addrlo, tmp - * cmp r0, tmp + * ubfx t0, addrlo, #TARGET_PAGE_BITS, #CPU_TLB_BITS + * add t2, env, #high + * add t2, t2, r0, lsl #CPU_TLB_ENTRY_BITS + * ldr t0, [t2, #cmp] (and t1 w/ldrd) + * ldr t2, [t2, #add] + * movw t3, #page_align_mask + * bic t3, addrlo, t3 + * cmp t0, t3 * * Otherwise we generate: - * shr tmp, addrlo, #TARGET_PAGE_BITS - * add r2, env, #high - * and r0, tmp, #(CPU_TLB_SIZE - 1) - * add r2, r2, r0, lsl #CPU_TLB_ENTRY_BITS - * ldr r0, [r2, #cmp] - * ldr r2, [r2, #add] + * shr t3, addrlo, #TARGET_PAGE_BITS + * add t2, env, #high + * and t0, t3, #(CPU_TLB_SIZE - 1) + * add t2, t2, t0, lsl #CPU_TLB_ENTRY_BITS + * ldr t0, [t2, #cmp] (and t1 w/ldrd) + * ldr t2, [t2, #add] * tst addrlo, #s_mask - * cmpeq r0, tmp, lsl #TARGET_PAGE_BITS + * cmpeq t0, t3, lsl #TARGET_PAGE_BITS */ if (use_armv7_instructions) { - tcg_out_extract(s, COND_AL, TCG_REG_R0, addrlo, + tcg_out_extract(s, COND_AL, t0, addrlo, TARGET_PAGE_BITS, CPU_TLB_BITS); } else { - tcg_out_dat_reg(s, COND_AL, ARITH_MOV, TCG_REG_TMP, + tcg_out_dat_reg(s, COND_AL, ARITH_MOV, t3, 0, addrlo, SHIFT_IMM_LSR(TARGET_PAGE_BITS)); } =20 /* Add portions of the offset until the memory access is in range. * If we plan on using ldrd, reduce to an 8-bit offset; otherwise - * we can use a 12-bit offset. */ + * we can use a 12-bit offset. + */ if (use_armv6_instructions && TARGET_LONG_BITS =3D=3D 64) { mask_off =3D 0xff; } else { @@ -1301,34 +1305,33 @@ static TCGReg tcg_out_tlb_read(TCGContext *s, TCGRe= g addrlo, TCGReg addrhi, int shift =3D ctz32(cmp_off & ~mask_off) & ~1; int rot =3D ((32 - shift) << 7) & 0xf00; int addend =3D cmp_off & (0xff << shift); - tcg_out_dat_imm(s, COND_AL, ARITH_ADD, TCG_REG_R2, base, + tcg_out_dat_imm(s, COND_AL, ARITH_ADD, t2, base, rot | ((cmp_off >> shift) & 0xff)); - base =3D TCG_REG_R2; + base =3D t2; add_off -=3D addend; cmp_off -=3D addend; } =20 if (!use_armv7_instructions) { - tcg_out_dat_imm(s, COND_AL, ARITH_AND, - TCG_REG_R0, TCG_REG_TMP, CPU_TLB_SIZE - 1); + tcg_out_dat_imm(s, COND_AL, ARITH_AND, t0, t3, CPU_TLB_SIZE - 1); } - tcg_out_dat_reg(s, COND_AL, ARITH_ADD, TCG_REG_R2, base, - TCG_REG_R0, SHIFT_IMM_LSL(CPU_TLB_ENTRY_BITS)); + tcg_out_dat_reg(s, COND_AL, ARITH_ADD, t2, base, t0, + SHIFT_IMM_LSL(CPU_TLB_ENTRY_BITS)); =20 /* Load the tlb comparator. Use ldrd if needed and available, but due to how the pointer needs setting up, ldm isn't useful. Base arm5 doesn't have ldrd, but armv5te does. */ if (use_armv6_instructions && TARGET_LONG_BITS =3D=3D 64) { - tcg_out_ldrd_8(s, COND_AL, TCG_REG_R0, TCG_REG_R2, cmp_off); + tcg_out_ldrd_8(s, COND_AL, t0, t2, cmp_off); } else { - tcg_out_ld32_12(s, COND_AL, TCG_REG_R0, TCG_REG_R2, cmp_off); + tcg_out_ld32_12(s, COND_AL, t0, t2, cmp_off); if (TARGET_LONG_BITS =3D=3D 64) { - tcg_out_ld32_12(s, COND_AL, TCG_REG_R1, TCG_REG_R2, cmp_off + = 4); + tcg_out_ld32_12(s, COND_AL, t1, t2, cmp_off + 4); } } =20 /* Load the tlb addend. */ - tcg_out_ld32_12(s, COND_AL, TCG_REG_R2, TCG_REG_R2, add_off); + tcg_out_ld32_12(s, COND_AL, t2, t2, add_off); =20 /* Check alignment. We don't support inline unaligned acceses, but we can easily support overalignment checks. */ @@ -1341,29 +1344,27 @@ static TCGReg tcg_out_tlb_read(TCGContext *s, TCGRe= g addrlo, TCGReg addrhi, int rot =3D encode_imm(mask); =20 if (rot >=3D 0) {=20 - tcg_out_dat_imm(s, COND_AL, ARITH_BIC, TCG_REG_TMP, addrlo, + tcg_out_dat_imm(s, COND_AL, ARITH_BIC, t3, addrlo, rotl(mask, rot) | (rot << 7)); } else { - tcg_out_movi32(s, COND_AL, TCG_REG_TMP, mask); - tcg_out_dat_reg(s, COND_AL, ARITH_BIC, TCG_REG_TMP, - addrlo, TCG_REG_TMP, 0); + tcg_out_movi32(s, COND_AL, t3, mask); + tcg_out_dat_reg(s, COND_AL, ARITH_BIC, t3, addrlo, t3, 0); } - tcg_out_dat_reg(s, COND_AL, ARITH_CMP, 0, TCG_REG_R0, TCG_REG_TMP,= 0); + tcg_out_dat_reg(s, COND_AL, ARITH_CMP, 0, t0, t3, 0); } else { if (a_bits) { tcg_out_dat_imm(s, COND_AL, ARITH_TST, 0, addrlo, (1 << a_bits) - 1); } tcg_out_dat_reg(s, (a_bits ? COND_EQ : COND_AL), ARITH_CMP, - 0, TCG_REG_R0, TCG_REG_TMP, - SHIFT_IMM_LSL(TARGET_PAGE_BITS)); + 0, t0, t3, SHIFT_IMM_LSL(TARGET_PAGE_BITS)); } =20 if (TARGET_LONG_BITS =3D=3D 64) { - tcg_out_dat_reg(s, COND_EQ, ARITH_CMP, 0, TCG_REG_R1, addrhi, 0); + tcg_out_dat_reg(s, COND_EQ, ARITH_CMP, 0, t1, addrhi, 0); } =20 - return TCG_REG_R2; + return t2; } =20 /* Record the context of a call to the out of line helper code for the slow @@ -1629,7 +1630,8 @@ static void tcg_out_qemu_ld(TCGContext *s, const TCGA= rg *args, bool is64) =20 #ifdef CONFIG_SOFTMMU mem_index =3D get_mmuidx(oi); - addend =3D tcg_out_tlb_read(s, addrlo, addrhi, opc, mem_index, 1); + addend =3D tcg_out_tlb_read(s, addrlo, addrhi, opc, mem_index, 1, + TCG_REG_R0, TCG_REG_R1, TCG_REG_R2, TCG_REG_= R14); =20 /* This a conditional BL only to load a pointer within this opcode int= o LR for the slow path. We will not be using the value for a tail call.= */ @@ -1760,7 +1762,8 @@ static void tcg_out_qemu_st(TCGContext *s, const TCGA= rg *args, bool is64) =20 #ifdef CONFIG_SOFTMMU mem_index =3D get_mmuidx(oi); - addend =3D tcg_out_tlb_read(s, addrlo, addrhi, opc, mem_index, 0); + addend =3D tcg_out_tlb_read(s, addrlo, addrhi, opc, mem_index, 0, + TCG_REG_R0, TCG_REG_R1, TCG_REG_R2, TCG_REG_= R14); =20 tcg_out_qemu_st_index(s, COND_EQ, opc, datalo, datahi, addrlo, addend); =20 --=20 2.17.2