From patchwork Fri Nov 23 14:45:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 151909 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp2239826ljp; Fri, 23 Nov 2018 07:11:41 -0800 (PST) X-Google-Smtp-Source: AJdET5dQ1GlPkRLpv6yC/Cbe6pI5XSIdLPI/hRwNbJ+iJX21muoEZri16rBYKUUxPCsAWaTIkGYy X-Received: by 2002:a81:33c4:: with SMTP id z187mr16994156ywz.294.1542985901634; Fri, 23 Nov 2018 07:11:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542985901; cv=none; d=google.com; s=arc-20160816; b=qfPwiaW9e20VqDu4siAzxcBq6rYebXevX7DQPRCmiCP+W8DFdFGGOkC9kEhE9b4Gxy jS1abKcNwoRU6joO2YD9TVtM/H4NwdI0SzxUjoxa+M4qepIk1iYkiBuSVDtG3hIFPjT8 oKmCOcNu41RDPjpzhtiP2SI7YR1xN9W0Cfgfud4h3uChaKQ99+BQGtHp29QtUnYF36c9 B5KCQ6ImNJsZeEpOW5mjV2IrKw+Jd+Y9P23P6rjKaMi7USd4BByw8UL42xThqojha+I4 xP2F50XM0oKaQe1fT1DnzTOgR0MM8iL69t0/2KEWaYnvhs82t7YFmRWXT3RSfYkBfomT hV4g== 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:subject:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=E5nUlX178Yhhbrid2SVbDu1cU354OJxLXoIiQ6IH5Bw=; b=GhYhFU92Ig4khO9is1en4Jtj3o2x2VHIRxNi3RPHsasc9ZkMnvPyjVIuXT8esgoVFQ 2hORLvcGFyNj4pLGk/ph+UxvXdDKe6OauNWE3x+mjH2slGi5UESmdRCaj9Vt4cltTLCL TCS0ZkIgKV1/YJL/5JxgTlWvT506PZYlyhg9MFjU/FiVkNgfalVhOo4hEgjyb8R9fiW5 En4q9ZUHn0QJ54kP46O4xhaQaQGbzwMoJ9+dKsEk2lXw1LzpnvxJklg8v681PvrLRjDt zihjehHLt09sIs+shBorZWAn89w9JMHrNi1EP9EYMQaTIAbgSomj38YsCF9wTzMEFzF+ SlZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Wn7I2EsK; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 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. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id 79si8249672ywp.372.2018.11.23.07.11.41 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 23 Nov 2018 07:11:41 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Wn7I2EsK; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 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]:52899 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gQD7M-0007vp-VJ for patch@linaro.org; Fri, 23 Nov 2018 10:11:41 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44140) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gQCj1-0000ED-MO for qemu-devel@nongnu.org; Fri, 23 Nov 2018 09:46:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gQCiv-0003X5-W9 for qemu-devel@nongnu.org; Fri, 23 Nov 2018 09:46:30 -0500 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]:44383) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gQCis-0003Qq-4p for qemu-devel@nongnu.org; Fri, 23 Nov 2018 09:46:24 -0500 Received: by mail-wr1-x443.google.com with SMTP id z5so8281117wrt.11 for ; Fri, 23 Nov 2018 06:46:21 -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=E5nUlX178Yhhbrid2SVbDu1cU354OJxLXoIiQ6IH5Bw=; b=Wn7I2EsK0YnWSCm+2BbOr5Ioz0epVFkuFBwlgLTsmEEvoBOUrkl4QCYzbwiQXydhgu h2lYwQ5Or0rFOF0O31MPnLr4LYybvD+wKcPW2jrXaJIJsnuvClsJZZebST39NKHPAfMJ pAEppo0x82wzbHi1KX9QE1dUjaUsh10DquD58= 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=E5nUlX178Yhhbrid2SVbDu1cU354OJxLXoIiQ6IH5Bw=; b=HQXe61rSRHZ846hGwn0T+G9TlzKkTEQoV6hWkpTu1qIuXwlqNXNkm5wOaF+LC8dGNh ylBNlhkWvq1VMfrkwty5GvY3x23mVq+HLyTRmxMRvkbFNL/yhwgXLn4wiXJp0SY5o8lr YPRc+CtuWGzCMKu6hh057vRqw1B1MbFUlsGwLeR4Xoyr/hN3Md+DRoaGVAAZ/xxUWywn bG2wIQ0w3NfiGbq/AymTMNNruHqan2g3/OPTovxLdEZ1qRR8yE2A6xf1x4yTUpEcJqw9 Z7SgoC9C0eOQFJ6n7xgkBO9gjyl8wDU2xXnAqaEHQtyVVusbQvYKvQjipOGhtqw1UcZZ uvVg== X-Gm-Message-State: AA+aEWbkxsW0cBRSCRtaqS3Zulx1yC+/PX6Xt7rZzei++riUC5gyYywr JqwY3NNheJK18aIoS3be5mG5iNj7QBDUGQ== X-Received: by 2002:adf:fa91:: with SMTP id h17mr15252747wrr.320.1542984380263; Fri, 23 Nov 2018 06:46:20 -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.19 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 23 Nov 2018 06:46:19 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Fri, 23 Nov 2018 15:45:41 +0100 Message-Id: <20181123144558.5048-21-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 20/37] tcg/ppc: 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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/ppc/tcg-target.inc.c | 40 ++++++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 18 deletions(-) -- 2.17.2 diff --git a/tcg/ppc/tcg-target.inc.c b/tcg/ppc/tcg-target.inc.c index 656a9ff603..6e656cd41e 100644 --- a/tcg/ppc/tcg-target.inc.c +++ b/tcg/ppc/tcg-target.inc.c @@ -1516,12 +1516,14 @@ static void * const qemu_st_helpers[16] = { }; /* Perform the TLB load and compare. Places the result of the comparison - in CR7, loads the addend of the TLB into R3, and returns the register - containing the guest address (zero-extended into R4). Clobbers R0 and R2. */ + in CR7, loads the addend of the TLB, and returns the register containing + the guest address, places the addend into T0. + Clobbers t0, t1, TCG_REG_R0, TCG_REG_TMP1. */ static TCGReg tcg_out_tlb_read(TCGContext *s, TCGMemOp opc, TCGReg addrlo, TCGReg addrhi, - int mem_index, bool is_read) + int mem_index, bool is_read, + TCGReg t0, TCGReg t1) { int cmp_off = (is_read @@ -1536,10 +1538,10 @@ static TCGReg tcg_out_tlb_read(TCGContext *s, TCGMemOp opc, if (TCG_TARGET_REG_BITS == 64) { if (TARGET_LONG_BITS == 32) { /* Zero-extend the address into a place helpful for further use. */ - tcg_out_ext32u(s, TCG_REG_R4, addrlo); - addrlo = TCG_REG_R4; + tcg_out_ext32u(s, t1, addrlo); + addrlo = t1; } else { - tcg_out_rld(s, RLDICL, TCG_REG_R3, addrlo, + tcg_out_rld(s, RLDICL, t0, addrlo, 64 - TARGET_PAGE_BITS, 64 - CPU_TLB_BITS); } } @@ -1559,27 +1561,27 @@ static TCGReg tcg_out_tlb_read(TCGContext *s, TCGMemOp opc, /* Extraction and shifting, part 2. */ if (TCG_TARGET_REG_BITS == 32 || TARGET_LONG_BITS == 32) { - tcg_out_rlw(s, RLWINM, TCG_REG_R3, addrlo, + tcg_out_rlw(s, RLWINM, t0, addrlo, 32 - (TARGET_PAGE_BITS - CPU_TLB_ENTRY_BITS), 32 - (CPU_TLB_BITS + CPU_TLB_ENTRY_BITS), 31 - CPU_TLB_ENTRY_BITS); } else { - tcg_out_shli64(s, TCG_REG_R3, TCG_REG_R3, CPU_TLB_ENTRY_BITS); + tcg_out_shli64(s, t0, t0, CPU_TLB_ENTRY_BITS); } - tcg_out32(s, ADD | TAB(TCG_REG_R3, TCG_REG_R3, base)); + tcg_out32(s, ADD | TAB(t0, t0, base)); /* Load the tlb comparator. */ if (TCG_TARGET_REG_BITS < TARGET_LONG_BITS) { - tcg_out_ld(s, TCG_TYPE_I32, TCG_REG_R4, TCG_REG_R3, cmp_off); - tcg_out_ld(s, TCG_TYPE_I32, TCG_REG_TMP1, TCG_REG_R3, cmp_off + 4); + tcg_out_ld(s, TCG_TYPE_I32, t1, t0, cmp_off); + tcg_out_ld(s, TCG_TYPE_I32, TCG_REG_TMP1, t0, cmp_off + 4); } else { - tcg_out_ld(s, TCG_TYPE_TL, TCG_REG_TMP1, TCG_REG_R3, cmp_off); + tcg_out_ld(s, TCG_TYPE_TL, TCG_REG_TMP1, t0, cmp_off); } /* Load the TLB addend for use on the fast path. Do this asap to minimize any load use delay. */ - tcg_out_ld(s, TCG_TYPE_PTR, TCG_REG_R3, TCG_REG_R3, add_off); + tcg_out_ld(s, TCG_TYPE_PTR, t0, t0, add_off); /* Clear the non-page, non-alignment bits from the address */ if (TCG_TARGET_REG_BITS == 32) { @@ -1624,7 +1626,7 @@ static TCGReg tcg_out_tlb_read(TCGContext *s, TCGMemOp opc, if (TCG_TARGET_REG_BITS < TARGET_LONG_BITS) { tcg_out_cmp(s, TCG_COND_EQ, TCG_REG_R0, TCG_REG_TMP1, 0, 7, TCG_TYPE_I32); - tcg_out_cmp(s, TCG_COND_EQ, addrhi, TCG_REG_R4, 0, 6, TCG_TYPE_I32); + tcg_out_cmp(s, TCG_COND_EQ, addrhi, t1, 0, 6, TCG_TYPE_I32); tcg_out32(s, CRAND | BT(7, CR_EQ) | BA(6, CR_EQ) | BB(7, CR_EQ)); } else { tcg_out_cmp(s, TCG_COND_EQ, TCG_REG_R0, TCG_REG_TMP1, @@ -1778,13 +1780,14 @@ static void tcg_out_qemu_ld(TCGContext *s, const TCGArg *args, bool is_64) #ifdef CONFIG_SOFTMMU mem_index = get_mmuidx(oi); - addrlo = tcg_out_tlb_read(s, opc, addrlo, addrhi, mem_index, true); + rbase = TCG_REG_R3; + addrlo = tcg_out_tlb_read(s, opc, addrlo, addrhi, mem_index, true, + rbase, TCG_REG_R4); /* Load a pointer into the current opcode w/conditional branch-link. */ label_ptr = s->code_ptr; tcg_out_bc_noaddr(s, BC | BI(7, CR_EQ) | BO_COND_FALSE | LK); - rbase = TCG_REG_R3; #else /* !CONFIG_SOFTMMU */ rbase = guest_base ? TCG_GUEST_BASE_REG : 0; if (TCG_TARGET_REG_BITS > TARGET_LONG_BITS) { @@ -1853,13 +1856,14 @@ static void tcg_out_qemu_st(TCGContext *s, const TCGArg *args, bool is_64) #ifdef CONFIG_SOFTMMU mem_index = get_mmuidx(oi); - addrlo = tcg_out_tlb_read(s, opc, addrlo, addrhi, mem_index, false); + rbase = TCG_REG_R3; + addrlo = tcg_out_tlb_read(s, opc, addrlo, addrhi, mem_index, false, + rbase, TCG_REG_R4); /* Load a pointer into the current opcode w/conditional branch-link. */ label_ptr = s->code_ptr; tcg_out_bc_noaddr(s, BC | BI(7, CR_EQ) | BO_COND_FALSE | LK); - rbase = TCG_REG_R3; #else /* !CONFIG_SOFTMMU */ rbase = guest_base ? TCG_GUEST_BASE_REG : 0; if (TCG_TARGET_REG_BITS > TARGET_LONG_BITS) {