From patchwork Thu Mar 28 23:04:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 161335 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp1326847jan; Thu, 28 Mar 2019 16:24:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqwx3nGWZ+79R8CQZcVpQ02WE+QK3wct1wn1DWIwhwSC+iW6f6a4Xewsooi+qzsbv3rMoVN7 X-Received: by 2002:a6b:720c:: with SMTP id n12mr28678083ioc.110.1553815459731; Thu, 28 Mar 2019 16:24:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553815459; cv=none; d=google.com; s=arc-20160816; b=i6ntH3EIJOG4qW8pZj8QcvZ/IVN1TPbrBtXjeoTyKpTkQ7KsSGxDM2UfsHn2JmN7DY 8B/m/qcpokqU+AIuD/u6HzQ1py+34px8TN3+1Uywr6ZleBVrKMo/H2JNdaYP73iJK1fq nl53OK5hZVhF62UuVirdWU9ZTLICLzXPQkZyTKVM7vpywilPGTlF/agc4KxXWr32WiFB UnYw6N3Goi90AX0jr62b0Ut9Q99fnIUwOfHa+n2LO8FBe2hUj3HTMD6utNUi2CZAjk/4 GCCTvLLlY0Ia/Luoula7oXooAsdZdbJEnHq+wEEpOeQahtebCB6bESvI4LDnxpr7fG/z 3EVw== 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=XaNl4ahENHN5Sb8SVrJWySXNC/hJzvTC42FKHC/WZc8=; b=RW8p68urkOpmo4vRShDNHfCDhY/E2xL2u1VpRlxhVG2r/g2+6q7iQJzLbeH0bBi46N RxulPVL8QP2JXXRm9lx59O6Hyo9/PVm9qxtMsoL3L4K5yyC+PGFc5xFtF2dWhiMb0tvs Q5TFTJlDq9BTkSrrZDGrxTRlnxwtIl5Vu7ZXAHurGTKExY/7TveHAVfiP19GFPh2YO7j DPEiIBQhWGx6IUbc2yR5ffmiU1nZ8QrHwSsvJEyk8PIvf8Pez2WZK7sMW6aH7W76eiwF aGAVr0SkG1k7n2ma3hNEcgeRwKx7xcxwL4KsjqA0bgCYaz4Wnlc2OE/ry2sF3032S20e 2yzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=NIPXXTsL; 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 e142si204207itc.32.2019.03.28.16.24.19 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 28 Mar 2019 16:24:19 -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=NIPXXTsL; 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]:43201 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h9eNe-00056a-Ua for patch@linaro.org; Thu, 28 Mar 2019 19:24:18 -0400 Received: from eggs.gnu.org ([209.51.188.92]:42412) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h9eKk-0001km-6C for qemu-devel@nongnu.org; Thu, 28 Mar 2019 19:21:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h9e5D-0003J9-5c for qemu-devel@nongnu.org; Thu, 28 Mar 2019 19:05:16 -0400 Received: from mail-pl1-x642.google.com ([2607:f8b0:4864:20::642]:37594) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h9e5B-0003G7-P9 for qemu-devel@nongnu.org; Thu, 28 Mar 2019 19:05:14 -0400 Received: by mail-pl1-x642.google.com with SMTP id q6so67838pll.4 for ; Thu, 28 Mar 2019 16:05:08 -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=XaNl4ahENHN5Sb8SVrJWySXNC/hJzvTC42FKHC/WZc8=; b=NIPXXTsLeBwqsJYllVzytWLGehdtvj/aux+o00TJFTr6KLRzmDy1AJWXeKxo+opmWN TmERVnC+B+udeKUNWHa20gB9EqgyF6lavHlRq6UUW5VSpfX+sblZ6RJSCY0TTU/ErSJt jQnoBj+9pBATl2xPCn9hc1NjWhOwU4uzTpqgUQxLHE+AFKwV5sbPkIQ3cy8ZggvJaVJD +Sbb0XBHtqW0Iq7axGzOLVTrxctmdflvA3BWA0AkWVD4kjljdUmvVimaP4H3BUILAQvW oP3ddC8hEseT3cR0BdXzCPYi0hhnaB3b74LYyjKkmfn9sR+fuPtD0icAgTpXDYabevsE 7edg== 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=XaNl4ahENHN5Sb8SVrJWySXNC/hJzvTC42FKHC/WZc8=; b=LOafDuCzgemZqC9Aqum0iVKddKJ+JcFBCjNhkKWaUMkKqGAPS4I0PI3C1/Pj8WIeLk d1lE40Q/LWbvKi6sDY1RLD+mzrI/Lnz1ncetdSVPW1VUY7PyGgO4iP/M8uMsaOhBEZWu 0WiGJpLV+KGMxKEQN6fLfdhZ+mGve7yJViKb/xQG0SNEvbX+2KZRbRKJ9Z0R/Fw/Gfa6 7UQOC2W+MU6TdlJpvodVTfNzPFY400s8G6f+DFznVfQnam3Ha+Twty6i/VoejnGDtSZ4 LBMu/l+ySjduJhUjE2+GsgPg58Vyp8AGpRdsu560xeAIuhgvYSVBU2eHUMfSRkW5oTiw iv8g== X-Gm-Message-State: APjAAAXSwj5IHYZ6YkoJEf5o42DyWBuNhBbxqjVxaCo1aGU+u7aE6XIq Fj4vzNodOyE9XItlcIC63ibD5MQky9s= X-Received: by 2002:a17:902:87:: with SMTP id a7mr45017514pla.295.1553814306932; Thu, 28 Mar 2019 16:05:06 -0700 (PDT) Received: from cloudburst.ASUS (cpe-66-75-72-255.hawaii.res.rr.com. [66.75.72.255]) by smtp.gmail.com with ESMTPSA id f1sm280911pgl.35.2019.03.28.16.05.05 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 Mar 2019 16:05:06 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 28 Mar 2019 13:04:04 -1000 Message-Id: <20190328230404.12909-37-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190328230404.12909-1-richard.henderson@linaro.org> References: <20190328230404.12909-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::642 Subject: [Qemu-devel] [PATCH for-4.1 v2 36/36] tcg/arm: Use LDRD 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" Signed-off-by: Richard Henderson --- tcg/arm/tcg-target.inc.c | 109 +++++++++++++++++++-------------------- 1 file changed, 52 insertions(+), 57 deletions(-) -- 2.17.1 diff --git a/tcg/arm/tcg-target.inc.c b/tcg/arm/tcg-target.inc.c index 4a8c12e9a4..7601eff16e 100644 --- a/tcg/arm/tcg-target.inc.c +++ b/tcg/arm/tcg-target.inc.c @@ -278,6 +278,7 @@ static const char *target_parse_constraint(TCGArgConstraint *ct, tcg_regset_reset_reg(ct->u.regs, TCG_REG_R0); tcg_regset_reset_reg(ct->u.regs, TCG_REG_R1); tcg_regset_reset_reg(ct->u.regs, TCG_REG_R2); + tcg_regset_reset_reg(ct->u.regs, TCG_REG_R3); tcg_regset_reset_reg(ct->u.regs, TCG_REG_R14); #endif break; @@ -1253,75 +1254,69 @@ static TCGReg tcg_out_tlb_read(TCGContext *s, TCGReg addrlo, TCGReg addrhi, unsigned s_bits = opc & MO_SIZE; unsigned a_bits = get_alignment_bits(opc); - /* Load tlb_mask[mmu_idx] and tlb_table[mmu_idx]. */ - tcg_out_ld(s, TCG_TYPE_I32, TCG_REG_TMP, TCG_AREG0, mask_off); - tcg_out_ld(s, TCG_TYPE_I32, TCG_REG_R2, TCG_AREG0, table_off); - - /* Extract the tlb index from the address into TMP. */ - tcg_out_dat_reg(s, COND_AL, ARITH_AND, TCG_REG_TMP, TCG_REG_TMP, addrlo, - SHIFT_IMM_LSR(TARGET_PAGE_BITS - CPU_TLB_ENTRY_BITS)); - /* - * Add the tlb_table pointer, creating the CPUTLBEntry address in R2. - * Load the tlb comparator into R0/R1 and the fast path addend into R2. + * We don't support inline unaligned acceses, but we can easily + * support overalignment checks. */ - if (cmp_off == 0) { - if (use_armv6_instructions && TARGET_LONG_BITS == 64) { - tcg_out_ldrd_rwb(s, COND_AL, TCG_REG_R0, TCG_REG_R2, TCG_REG_TMP); - } else { - tcg_out_ld32_rwb(s, COND_AL, TCG_REG_R0, TCG_REG_R2, TCG_REG_TMP); - } - } else { - tcg_out_dat_reg(s, COND_AL, ARITH_ADD, - TCG_REG_R2, TCG_REG_R2, TCG_REG_TMP, 0); - if (use_armv6_instructions && TARGET_LONG_BITS == 64) { - tcg_out_ldrd_8(s, COND_AL, TCG_REG_R0, TCG_REG_R2, cmp_off); - } else { - tcg_out_ld32_12(s, COND_AL, TCG_REG_R0, TCG_REG_R2, cmp_off); - } - } - if (!use_armv6_instructions && TARGET_LONG_BITS == 64) { - tcg_out_ld32_12(s, COND_AL, TCG_REG_R1, TCG_REG_R2, cmp_off + 4); - } - - /* Load the tlb addend. */ - tcg_out_ld32_12(s, COND_AL, TCG_REG_R2, TCG_REG_R2, - offsetof(CPUTLBEntry, addend)); - - /* Check alignment. We don't support inline unaligned acceses, - but we can easily support overalignment checks. */ if (a_bits < s_bits) { a_bits = s_bits; } - if (use_armv7_instructions) { - tcg_target_ulong mask = ~(TARGET_PAGE_MASK | ((1 << a_bits) - 1)); - int rot = encode_imm(mask); - - if (rot >= 0) { - tcg_out_dat_imm(s, COND_AL, ARITH_BIC, TCG_REG_TMP, 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_dat_reg(s, COND_AL, ARITH_CMP, 0, TCG_REG_R0, TCG_REG_TMP, 0); + /* Load tlb_mask[mmu_idx] and tlb_table[mmu_idx]. */ + if (use_armv6_instructions) { + tcg_out_ldrd_8(s, COND_AL, TCG_REG_R0, TCG_AREG0, fast_off); } 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)); + tcg_out_ld(s, TCG_TYPE_I32, TCG_REG_R0, TCG_AREG0, mask_off); + tcg_out_ld(s, TCG_TYPE_I32, TCG_REG_R1, TCG_AREG0, table_off); } + /* Extract the tlb index from the address into R0. */ + tcg_out_dat_reg(s, COND_AL, ARITH_AND, TCG_REG_R0, TCG_REG_R0, addrlo, + SHIFT_IMM_LSR(TARGET_PAGE_BITS - CPU_TLB_ENTRY_BITS)); + + /* + * Add the tlb_table pointer, creating the CPUTLBEntry address in R1. + * Load the tlb comparator into R2/R3 and the fast path addend into R1. + */ + if (cmp_off == 0) { + if (use_armv6_instructions && TARGET_LONG_BITS == 64) { + tcg_out_ldrd_rwb(s, COND_AL, TCG_REG_R2, TCG_REG_R1, TCG_REG_R0); + } else { + tcg_out_ld32_rwb(s, COND_AL, TCG_REG_R2, TCG_REG_R1, TCG_REG_R0); + } + } else { + tcg_out_dat_reg(s, COND_AL, ARITH_ADD, + TCG_REG_R1, TCG_REG_R1, TCG_REG_R0, 0); + if (use_armv6_instructions && TARGET_LONG_BITS == 64) { + tcg_out_ldrd_8(s, COND_AL, TCG_REG_R2, TCG_REG_R1, cmp_off); + } else { + tcg_out_ld32_12(s, COND_AL, TCG_REG_R2, TCG_REG_R1, cmp_off); + } + } + if (!use_armv6_instructions && TARGET_LONG_BITS == 64) { + tcg_out_ld32_12(s, COND_AL, TCG_REG_R3, TCG_REG_R1, cmp_off + 4); + } + + /* Shift the non-page bits out. */ + tcg_out_dat_reg(s, COND_AL, ARITH_MOV, TCG_REG_R0, 0, addrlo, + SHIFT_IMM_LSR(TARGET_PAGE_BITS)); + + /* Load the tlb addend. */ + tcg_out_ld32_12(s, COND_AL, TCG_REG_R1, TCG_REG_R1, + offsetof(CPUTLBEntry, addend)); + + /* Check alignment, check comparators. */ + 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_R2, TCG_REG_R0, SHIFT_IMM_LSL(TARGET_PAGE_BITS)); + if (TARGET_LONG_BITS == 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, TCG_REG_R3, addrhi, 0); } - return TCG_REG_R2; + return TCG_REG_R1; } /* Record the context of a call to the out of line helper code for the slow