From patchwork Thu Oct 11 20:52:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 148686 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp2607070lji; Thu, 11 Oct 2018 14:06:19 -0700 (PDT) X-Google-Smtp-Source: ACcGV63R6nyZkYWrTyIdRr7TBn44AVf/OdIC5Fps7tib8bGD6n+1uhpZso5+wrpb4Ih0T+385oAR X-Received: by 2002:a37:8706:: with SMTP id j6-v6mr3186751qkd.216.1539291979722; Thu, 11 Oct 2018 14:06:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539291979; cv=none; d=google.com; s=arc-20160816; b=hIzTVU/jnAVqbIIEEwTU5DG3Vw/1EVRTl9sL+SyIFW+2QNlp1LIV456MYUC5VcpYSg VIc9Nf04QjDUJD4d+VUPEx/3UsG30TIHUzo6b8kEamjnYvkyFSMUwDeqk58SZokQAYf8 8IFaCbGwMo0154CwPFKZWrIprrZlwlEBJwlOlyJBkPIDabJ8KTOUg2eTWw8TGNjSWAy+ sWZya8wMVGXIySyT9FuK2LASYkWifUJlJ7Dn4zGkRXXQshDJNvBIEOKPzklPzww9r091 OFqhuNQze3vELdiprIP8alVEPAJFRIkvqMYewFqzuWKtHzDe5ShKbX5f/YVmJ//FegSq W5IA== 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=rDKWSDsHnXKsG+gGOJjJuwO3ik11nLW/phwkZ4yrPio=; b=E3oZqRNy+9uJyoLfD9q18XvRWuR0DoXyBbAJfOXa5ryHk1U4D9kOS61pqkvFTHZCOz YjDFNUOm8vX9dyUe/LESOb9k0EmlEnbYLLA9wwlvifFjPrvMh4LljcXbSnLw8xkOOJC9 RAw0yDmjIFSCOsvlRj9S11YXn/fyX8JscKRSnA4ktbRF34N2rkYSU4b3EjQV0/o7GLbV 8SurJyF3XEnN7iJ1Sa3vRJfZqt6NO2x7l5vmtMBV6tEBFHL7mlj9OsdlzOJwNTpF8Btv iqXMlcmzFNh8r2NsWjjwcpe3nT4+yJ3W3JIW1zhdGzF0sRifQmRhWg5NdqLbH7z3nHhH 7L2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=UNltMMyN; 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 m44-v6si20876872qtb.280.2018.10.11.14.06.19 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 11 Oct 2018 14:06:19 -0700 (PDT) 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=UNltMMyN; 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]:37143 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gAi9z-0000a7-5V for patch@linaro.org; Thu, 11 Oct 2018 17:06:19 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45236) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gAhwr-0006tM-A5 for qemu-devel@nongnu.org; Thu, 11 Oct 2018 16:52:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gAhwn-00066o-2N for qemu-devel@nongnu.org; Thu, 11 Oct 2018 16:52:45 -0400 Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]:37227) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gAhwm-0005u6-MY for qemu-devel@nongnu.org; Thu, 11 Oct 2018 16:52:40 -0400 Received: by mail-pl1-x62f.google.com with SMTP id u6-v6so2053111plz.4 for ; Thu, 11 Oct 2018 13:52:39 -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=rDKWSDsHnXKsG+gGOJjJuwO3ik11nLW/phwkZ4yrPio=; b=UNltMMyNo+CYGstCInQvOCgL05VaYyFB4QdLfgpP2dwRvhrmKXOVAiaQ6W8smhw7jK 71dYfjv56ukT9Dy2qaxUXQACOlzyhz2stH/wP5TAqB53Q/j5i3GE9R6wSpQZ1g5VRDDj qRq6aLQyARgcetqqGZjYWfH21re4tzGI7mjm8= 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=rDKWSDsHnXKsG+gGOJjJuwO3ik11nLW/phwkZ4yrPio=; b=Al1Vfe9aIvCSSKvdh5HV0NqhXmTyq+n1L3u4qOP7/sC0OlUZEeaZvUc+EGsBNkh7kh tMXm4uG7nYzYDlE6UYd+enjCVWltdoQ6rjbq4Aoao1Q/smy/jgRg40mPQnDr3yr1D2iZ tb8A3feCq6pc5qWZjacei4LfDs/G0Qc4sg0B9UsKlaV1YD6S54/OjDA9wXXOcvaiCp8n zFNfrirEVtwVZEvT0P57oiVm1XyJ3gdotG50RfUH7H3EBoeNSqbwt3aq0Dop05IoGszj XRI9MBLOT4H0/WEY1vC90ouSK4a8tmJnOLlhoOtFLzyVwRoklqH29iR2yXq3Ct/o96PJ jsTw== X-Gm-Message-State: ABuFfoiBvQ3lOUt2lbcwMhiutgyNTLx8ZuXTt5CfEBb2Y6bC1ZeSPfkd DUtGL+Lhve1OwO/cZhJZnM5rluSwpzg= X-Received: by 2002:a17:902:30a3:: with SMTP id v32-v6mr2949036plb.277.1539291158398; Thu, 11 Oct 2018 13:52:38 -0700 (PDT) Received: from cloudburst.twiddle.net (97-113-8-179.tukw.qwest.net. [97.113.8.179]) by smtp.gmail.com with ESMTPSA id h87-v6sm34707866pfj.78.2018.10.11.13.52.37 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 11 Oct 2018 13:52:37 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 11 Oct 2018 13:52:06 -0700 Message-Id: <20181011205206.3552-21-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181011205206.3552-1-richard.henderson@linaro.org> References: <20181011205206.3552-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::62f Subject: [Qemu-devel] [PATCH 20/20] target/arm: Reorg NEON VLD/VST single element to one lane 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: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Instead of shifts and masks, use direct loads and stores from the neon register file. Signed-off-by: Richard Henderson --- target/arm/translate.c | 92 +++++++++++++++++++++++------------------- 1 file changed, 50 insertions(+), 42 deletions(-) -- 2.17.1 diff --git a/target/arm/translate.c b/target/arm/translate.c index 09f2d648b7..0b21c2d201 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -1611,6 +1611,25 @@ static TCGv_i32 neon_load_reg(int reg, int pass) return tmp; } +static void neon_load_element(TCGv_i32 var, int reg, int ele, TCGMemOp mop) +{ + long offset = neon_element_offset(reg, ele, mop & MO_SIZE); + + switch (mop) { + case MO_UB: + tcg_gen_ld8u_i32(var, cpu_env, offset); + break; + case MO_UW: + tcg_gen_ld16u_i32(var, cpu_env, offset); + break; + case MO_UL: + tcg_gen_ld_i32(var, cpu_env, offset); + break; + default: + g_assert_not_reached(); + } +} + static void neon_load_element64(TCGv_i64 var, int reg, int ele, TCGMemOp mop) { long offset = neon_element_offset(reg, ele, mop & MO_SIZE); @@ -1639,6 +1658,25 @@ static void neon_store_reg(int reg, int pass, TCGv_i32 var) tcg_temp_free_i32(var); } +static void neon_store_element(int reg, int ele, TCGMemOp size, TCGv_i32 var) +{ + long offset = neon_element_offset(reg, ele, size); + + switch (size) { + case MO_8: + tcg_gen_st8_i32(var, cpu_env, offset); + break; + case MO_16: + tcg_gen_st16_i32(var, cpu_env, offset); + break; + case MO_32: + tcg_gen_st_i32(var, cpu_env, offset); + break; + default: + g_assert_not_reached(); + } +} + static void neon_store_element64(int reg, int ele, TCGMemOp size, TCGv_i64 var) { long offset = neon_element_offset(reg, ele, size); @@ -4954,9 +4992,7 @@ static int disas_neon_ls_insn(DisasContext *s, uint32_t insn) int stride; int size; int reg; - int pass; int load; - int shift; int n; int vec_size; int mmu_idx; @@ -5104,18 +5140,18 @@ static int disas_neon_ls_insn(DisasContext *s, uint32_t insn) } else { /* Single element. */ int idx = (insn >> 4) & 0xf; - pass = (insn >> 7) & 1; + int reg_idx; switch (size) { case 0: - shift = ((insn >> 5) & 3) * 8; + reg_idx = (insn >> 5) & 7; stride = 1; break; case 1: - shift = ((insn >> 6) & 1) * 16; + reg_idx = (insn >> 6) & 3; stride = (insn & (1 << 5)) ? 2 : 1; break; case 2: - shift = 0; + reg_idx = (insn >> 7) & 1; stride = (insn & (1 << 6)) ? 2 : 1; break; default: @@ -5155,52 +5191,24 @@ static int disas_neon_ls_insn(DisasContext *s, uint32_t insn) */ return 1; } + tmp = tcg_temp_new_i32(); addr = tcg_temp_new_i32(); load_reg_var(s, addr, rn); for (reg = 0; reg < nregs; reg++) { if (load) { - tmp = tcg_temp_new_i32(); - switch (size) { - case 0: - gen_aa32_ld8u(s, tmp, addr, get_mem_index(s)); - break; - case 1: - gen_aa32_ld16u(s, tmp, addr, get_mem_index(s)); - break; - case 2: - gen_aa32_ld32u(s, tmp, addr, get_mem_index(s)); - break; - default: /* Avoid compiler warnings. */ - abort(); - } - if (size != 2) { - tmp2 = neon_load_reg(rd, pass); - tcg_gen_deposit_i32(tmp, tmp2, tmp, - shift, size ? 16 : 8); - tcg_temp_free_i32(tmp2); - } - neon_store_reg(rd, pass, tmp); + gen_aa32_ld_i32(s, tmp, addr, get_mem_index(s), + s->be_data | size); + neon_store_element(rd, reg_idx, size, tmp); } else { /* Store */ - tmp = neon_load_reg(rd, pass); - if (shift) - tcg_gen_shri_i32(tmp, tmp, shift); - switch (size) { - case 0: - gen_aa32_st8(s, tmp, addr, get_mem_index(s)); - break; - case 1: - gen_aa32_st16(s, tmp, addr, get_mem_index(s)); - break; - case 2: - gen_aa32_st32(s, tmp, addr, get_mem_index(s)); - break; - } - tcg_temp_free_i32(tmp); + neon_load_element(tmp, rd, reg_idx, size); + gen_aa32_st_i32(s, tmp, addr, get_mem_index(s), + s->be_data | size); } rd += stride; tcg_gen_addi_i32(addr, addr, 1 << size); } tcg_temp_free_i32(addr); + tcg_temp_free_i32(tmp); stride = nregs * (1 << size); } }