From patchwork Mon Jun 10 02:02:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 166278 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp486508ilk; Sun, 9 Jun 2019 19:41:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqwJtiU9yKJvFYF0V+p08C/n0u5BpJEi5flNZqOnaEGxhGYLhzljgoqlM4A4ZUva/Phvu6te X-Received: by 2002:ac8:17c1:: with SMTP id r1mr56429501qtk.41.1560134503718; Sun, 09 Jun 2019 19:41:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560134503; cv=none; d=google.com; s=arc-20160816; b=JmEY3vnaZ1RUabYuglbt6YwNTwZMDmi4B0JjbMpDNmco1ixKNfewhQCan66E6KoDdy DT+ygpiajLK0gi1iY7/0H5/KT7POPuiJe2leFK9Aofzm27DivAODlRF9SxRNyCdkP9/R hPoujuKJCmO2u5QZ7mWFRVkSjNngQT8e+G1FBZtl4WQesT4laskz/h9XV88Z9MCNQ39r H71BB0YAUOOOcsOJcr/gNoLVmrT3TXcbbWPsHi3y1GfMSatJnCg0KHxSA204qV+rnIN8 zpp/WqjT10UaaHhZANiLA44IYxOraYIGvtObsfwWVzN10olwmPQ0htJOnKoko2hiQPWJ 0Lew== 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=2m2+rpL1xWjB5db+GO//3xJA4pzKyCYCkFox2ZrQZRk=; b=tuOlinbF5Cw+kHjGk9dwaP+UQwgLb5HNmzuuh+QbA7WnE84WoZ5YNUB9qUOhqcZWy5 rsfraM2H99YRv/tXz+paJaXPnwSeJGq7MrJYSRfbSf3iOtrLgmekH5IleAvzZymWB+UM 5iW5wlEa4p+wAzrvlC7CFsJWiSWeakz8Y4N204yvWWf40V3puROnazpl4IysVF096WvD PMjCga27bfFGtPHQokdeHysCdxMrEKFxS/BXDI5oiKo7d8a4QAK1+wTZjslg1L5qz35/ HJXxuq6HLuV0akEzK/YI/nwe3m23hY3gDrmwvRn6LI2mr2i9JlEgCR2eKEqU9OoFFqBX fwUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=xFE67NzH; 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 n2si5246024qkd.208.2019.06.09.19.41.43 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 09 Jun 2019 19:41:43 -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=xFE67NzH; 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]:39896 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haAFf-0004Uk-Lm for patch@linaro.org; Sun, 09 Jun 2019 22:41:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53443) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1ha9eT-0006yw-Eh for qemu-devel@nongnu.org; Sun, 09 Jun 2019 22:03:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ha9eR-000286-H3 for qemu-devel@nongnu.org; Sun, 09 Jun 2019 22:03:13 -0400 Received: from mail-pg1-x542.google.com ([2607:f8b0:4864:20::542]:37252) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ha9eP-00024S-Dn for qemu-devel@nongnu.org; Sun, 09 Jun 2019 22:03:11 -0400 Received: by mail-pg1-x542.google.com with SMTP id 20so4159989pgr.4 for ; Sun, 09 Jun 2019 19:03:06 -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; bh=2m2+rpL1xWjB5db+GO//3xJA4pzKyCYCkFox2ZrQZRk=; b=xFE67NzHxiUppK2yJCIC6/JnaqnLlAIWX7Q+pn4RmNDqRvQL8vYPcJv7XHfNe8ae9R bXsbnoeygiuECEGt1dwUpo5RjFE5mVHfxh0XuOYatmSGh9vWbRs1GBKR4ApYJRDXgc1l SBA7fIW9WQ6JqIbojSLhgg4fG4HWWQkoHpJ7CYZD6a73IlFTByj8JoZ4dj6IvQ+LLVf5 Y1+hP1V9mJjClbgbtpCf9JYK+0i/k/4T8Qx8m7NnEz+KaO/Wf9lN6sG1bsVMh1pIUkfV eGjq8CRykofmwJ/wfvddCve9CgwVmHcQe4ceywSOjesZIg6mwYlTCE/qo+wDDnV03iOB jnrg== 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=2m2+rpL1xWjB5db+GO//3xJA4pzKyCYCkFox2ZrQZRk=; b=n/eXltuTogjF8EgSdKByJi7IuJ5t6BvoKApxk6PoVuIAUqzXKJbO0iHBwbnagDCLQu aME4CDqHj8ACl/yNsQztIbdhWhr83+7/v9U/dvsoebki3nwSQgPMiI/3DcZtZFQDp05T QF/s/NZpIkcY16eUIQUmPkgJLtTkAAIokqOm5aqqHkq8ja/6b1PlNSNUV/sMa0ADOfgB mlwDCqY2yWgKZ1dpBuo3FlJ+WgWT3wBqjoq7i4Qe3T9Gx383Pkdir4nDmqXAdrqLyfmB d8Il26Phi4dESWUTYGq4ry+BtKSHjlxr/N9Sg8fqpRz0mUtqXZLOA8y+oWEmGQfKop6v eF5w== X-Gm-Message-State: APjAAAUGQFQEyUyWbEmMK2C1DnvnR+LCDsNh6mizMVDHstwL1oyAxcTE ZbC3HLpzIH312WiRrRV/5dNZh9Y0UKg= X-Received: by 2002:a63:f10e:: with SMTP id f14mr13497066pgi.226.1560132184817; Sun, 09 Jun 2019 19:03:04 -0700 (PDT) Received: from localhost.localdomain (97-113-13-231.tukw.qwest.net. [97.113.13.231]) by smtp.gmail.com with ESMTPSA id l63sm9749013pfl.181.2019.06.09.19.03.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 09 Jun 2019 19:03:03 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Sun, 9 Jun 2019 19:02:16 -0700 Message-Id: <20190610020218.9228-38-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190610020218.9228-1-richard.henderson@linaro.org> References: <20190610020218.9228-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::542 Subject: [Qemu-devel] [PULL 37/39] tcg/aarch64: Use LDP to load tlb mask+table 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: peter.maydell@linaro.org 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] Acked-by: Alistair Francis Signed-off-by: Richard Henderson --- tcg/aarch64/tcg-target.inc.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) -- 2.17.1 diff --git a/tcg/aarch64/tcg-target.inc.c b/tcg/aarch64/tcg-target.inc.c index 57c297f9d7..b0f8106642 100644 --- a/tcg/aarch64/tcg-target.inc.c +++ b/tcg/aarch64/tcg-target.inc.c @@ -1641,6 +1641,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, @@ -1649,23 +1653,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,