From patchwork Wed May 8 00:06:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 163586 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:81:0:0:0:0 with SMTP id l1csp2003023ilm; Tue, 7 May 2019 17:29:39 -0700 (PDT) X-Google-Smtp-Source: APXvYqz+2cNcMrS2KmR9Gqg4jsma48yElOSZbrA8GGw/EWbsdsijIcDaB1KysS8/P1AfIjmkpxG5 X-Received: by 2002:a1c:2ecd:: with SMTP id u196mr741551wmu.111.1557275379415; Tue, 07 May 2019 17:29:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557275379; cv=none; d=google.com; s=arc-20160816; b=crWoPX4rX278/Bks4LlZGpxYK/VRPgHtRRHWeDQzSRVxSnpDeiR2Rm0bXrbKNA9Yii TwjqwHGFNJFQ0xi3E9duivNg+jnijKQpAcuXffTMgBWYoZi+hkgUK5StYLKeD0zyGCRD kjU6kYbtly11AuVEoAHB18f9M9Z4K7XHDkD0VfgJ0cLq+a8UP+Z5cYVYti0rr+mqPms9 ktZwizFfPSPdR8Q92vhO4y+WFmh25w9WZZmgL6Bk9i9KEs1SMmGxoj27opIevn3lDj3p fliaYGednh7E9d04Es39OcBDfBAhgOyf1lyfmhjYMUWvyBBicQ3sxzyMGR/xOoXsI00W 632Q== 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:subject:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=Q3wfC3JXPXSD4aTLa6MLu/8aD8LgGGgdxJG1bAJepYk=; b=EcfqZTIhLy++b0Jp08UmABB0zfdMn3TsIP1Dbp2rZ/IL2jw4W8Z86BkQlkAy+Kq88F hddu+jJ9S+hMISBCUJYiXU/Cf96IsR6OkXEwkwrJ753FQJ9yi2zWhk//DE2ek8MeFlDC RH/YkJlDGpq36OX/T9Z/aubBwPsR2qb7PgrA32dBB2VotjuEn3rzI1aDaqdsH4zSD623 C6hUMc+mRBsUrw3Jn/cWolSl9OG0pZaVbDIYaa2TqBchDm/CQPQZwpV8MD6w6IHYesgB OrloM0V/T1o24z/cHEyq+N1hCrK1T55h9vUF/7ec8cmFv2qZq1GjgaCc5GeJuXYTOQF/ r6xg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=UBNKN6cd; 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 t6si11545529wrg.88.2019.05.07.17.29.39 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 07 May 2019 17:29:39 -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=UBNKN6cd; 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 ([127.0.0.1]:56688 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hOASo-0001sV-9w for patch@linaro.org; Tue, 07 May 2019 20:29:38 -0400 Received: from eggs.gnu.org ([209.51.188.92]:39742) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hOA7T-0007vK-7X for qemu-devel@nongnu.org; Tue, 07 May 2019 20:07:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hOA7S-0007xu-7n for qemu-devel@nongnu.org; Tue, 07 May 2019 20:07:35 -0400 Received: from mail-pf1-x444.google.com ([2607:f8b0:4864:20::444]:34515) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hOA7S-0007sm-0m for qemu-devel@nongnu.org; Tue, 07 May 2019 20:07:34 -0400 Received: by mail-pf1-x444.google.com with SMTP id n19so943572pfa.1 for ; Tue, 07 May 2019 17:07:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=Q3wfC3JXPXSD4aTLa6MLu/8aD8LgGGgdxJG1bAJepYk=; b=UBNKN6cd4oN4dhW9dnrZOQyIPXrOHDNF6JieL01oBbc6yLb/HJgcqiWnmE75G333eC +AJt9XWUyeyEnWRos1xpBGY+iYZYic+foPztastGro8PbcqnB+yZhoawtblTTPOyxpWL +6B48bqJ7AXgmUpvSeGK6dM41Do2GH36294f/IqgB6SUNk8pZ580XE2XZDHsFg9c3Wxo 4Z3RabTu4Zfyc1MBOHAEGjlhT+P0oLhk/uTzgjLUEFj4Z/E8aEN+sURFt8tCVt3wvllt naGcED2fpd1vBqQM6zkx6EKfiEUziRCGu+ku5Rg/KfuX6V5RjomJUlkwOtlWqOG8d5YF 01bQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=Q3wfC3JXPXSD4aTLa6MLu/8aD8LgGGgdxJG1bAJepYk=; b=ifSpdC9dB32fg9ddqn8kP1gtOsiwcOFUmzT68FmNnaUt7KFD2+7Sjxn1TInV2KApf/ PskUx/F2N4SzcHn3xqFZT+CCfP6mf5Qi8w1McNDqcrXBlKEes1csXy3Vw90n570IJ3dO U4BnAmpXlALCNbAhSu210meJsu4U5C3pMje/kRoSDfRqgejJQRzAkqM88AsPsWGKoQub E/kT4DcoMNIRHQEoMSyx4tQbKoz5yM5O6/wlUsxXEJPelFMMp240KqaaoqF4heZAOR0Q OZuPxOo9P2qwzwhTm/wFugo0XY8dOj5NVu0QzEbQ2jCYv6VojWeZ1Zf3GaIZq5N9rcCd 7lYQ== X-Gm-Message-State: APjAAAX0UNy2qJvP12MWZr+09sWWs6aSS5cxbMPGhx3IrxREXdz5VK6s oMJtjQgODkPk9tgYkVWBEYb6mLFgBXQ= X-Received: by 2002:a63:e602:: with SMTP id g2mr2858086pgh.172.1557274051785; Tue, 07 May 2019 17:07:31 -0700 (PDT) Received: from localhost.localdomain (97-113-189-189.tukw.qwest.net. [97.113.189.189]) by smtp.gmail.com with ESMTPSA id j1sm15793183pgp.91.2019.05.07.17.07.30 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 May 2019 17:07:30 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Tue, 7 May 2019 17:06:39 -0700 Message-Id: <20190508000641.19090-38-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190508000641.19090-1-richard.henderson@linaro.org> References: <20190508000641.19090-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::444 Subject: [Qemu-devel] [PATCH v3 37/39] tcg/aarch64: Use LDP to load tlb mask+table 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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" This changes the code generation for the tlb from e.g. ldur x0, [x19, #0xffffffffffffffe0] ldur x1, [x19, #0xffffffffffffffe8] and x0, x0, x20, lsr #8 add x1, x1, x0 ldr x0, [x1] ldr x1, [x1, #0x18] to ldp x0, x1, [x19, #-0x20] and x0, x0, x20, lsr #8 add x1, x1, x0 ldr x0, [x1] ldr x1, [x1, #0x18] Signed-off-by: Richard Henderson --- v3: Add QEMU_BUILD_BUG_ON for mask/table ordering; comment fixes. --- tcg/aarch64/tcg-target.inc.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) -- 2.17.1 Acked-by: Alistair Francis diff --git a/tcg/aarch64/tcg-target.inc.c b/tcg/aarch64/tcg-target.inc.c index afac018301..2863a371a0 100644 --- a/tcg/aarch64/tcg-target.inc.c +++ b/tcg/aarch64/tcg-target.inc.c @@ -1459,6 +1459,10 @@ static void add_qemu_ldst_label(TCGContext *s, bool is_ld, TCGMemOpIdx oi, QEMU_BUILD_BUG_ON(TLB_MASK_TABLE_OFS(0) > 0); QEMU_BUILD_BUG_ON(TLB_MASK_TABLE_OFS(0) < -512); +/* These offsets are built into the LDP below. */ +QEMU_BUILD_BUG_ON(offsetof(CPUTLBDescFast, mask) != 0); +QEMU_BUILD_BUG_ON(offsetof(CPUTLBDescFast, table) != 8); + /* Load and compare a TLB entry, emitting the conditional jump to the slow path for the failure case, which will be patched later when finalizing the slow path. Generated code returns the host addend in X1, @@ -1467,23 +1471,20 @@ static void tcg_out_tlb_read(TCGContext *s, TCGReg addr_reg, TCGMemOp opc, tcg_insn_unit **label_ptr, int mem_index, bool is_read) { - int fast_ofs = TLB_MASK_TABLE_OFS(mem_index); - int mask_ofs = fast_ofs + offsetof(CPUTLBDescFast, mask); - int table_ofs = fast_ofs + offsetof(CPUTLBDescFast, table); unsigned a_bits = get_alignment_bits(opc); unsigned s_bits = opc & MO_SIZE; unsigned a_mask = (1u << a_bits) - 1; unsigned s_mask = (1u << s_bits) - 1; - TCGReg mask_base = TCG_AREG0, table_base = TCG_AREG0, x3; + TCGReg x3; TCGType mask_type; uint64_t compare_mask; mask_type = (TARGET_PAGE_BITS + CPU_TLB_DYN_MAX_BITS > 32 ? TCG_TYPE_I64 : TCG_TYPE_I32); - /* Load tlb_mask[mmu_idx] and tlb_table[mmu_idx]. */ - tcg_out_ld(s, mask_type, TCG_REG_X0, mask_base, mask_ofs); - tcg_out_ld(s, TCG_TYPE_PTR, TCG_REG_X1, table_base, table_ofs); + /* Load env_tlb(env)->f[mmu_idx].{mask,table} into {x0,x1}. */ + tcg_out_insn(s, 3314, LDP, TCG_REG_X0, TCG_REG_X1, TCG_AREG0, + TLB_MASK_TABLE_OFS(mem_index), 1, 0); /* Extract the TLB index from the address into X0. */ tcg_out_insn(s, 3502S, AND_LSR, mask_type == TCG_TYPE_I64,