From patchwork Thu Oct 11 20:51:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 148680 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp2601526lji; Thu, 11 Oct 2018 14:01:03 -0700 (PDT) X-Google-Smtp-Source: ACcGV63mDmaAFLPtWYYUgVRKCwc1PQs9ktasKkPJ+MNOk/CS07z7YltQ9CYk2Z1x5whryNOaS/pf X-Received: by 2002:a37:9442:: with SMTP id w63-v6mr3200328qkd.304.1539291663330; Thu, 11 Oct 2018 14:01:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539291663; cv=none; d=google.com; s=arc-20160816; b=B2Jn9R2s/r/TdpWss1GRfh+qvCUxkThsPd1fv304wFZpwbaf44mGXO7s0l+T+KOJZZ 2SLDtZVa0MpnFAnAU4v7EK+/GBDXPSDfemjupBfVjdqupASbLdAWQML62jH+C9so8ECw OajZ1fqAMgZYgmbO57/8UxzMgR3w6ne/qFBdgRPFMJhwKoMOv62RZHtY76nGdvvKDcqI 57SdR8Re1ktHeH9Saoojd3gS1Mz4wRR/taPjm+ujmB5zx5nRlbp8wKaLzDcM+OPJk29X SmKg+J2vpEfsCVHK+GoJ1YEG5Wkn4gXge+hC3K4QnQu+eA3Jgi2252JDoGtnfgrbPzEa 9MxQ== 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=YFQr/JNTa/QXkvyuZtso9GlnKeUMjxXJ1Iso8ke3tsU=; b=vw431VOI5/ocT/zL7+Gqk2nRMVwrHPN00VvDQLdQQdS/cUh1j7rgXoWQrvIskiQKd8 G53bBhhD3+VAGueujGzpM4tSyVICZD7aHtwslgdrynlERUt+sNGFhET6zeJTPfnWdSJt AgPgrAKExNynch5RHKbEaYhDtBmrdaHd6+4yzV0kXiflMvLBmCOVmdcVvLaYvegHEFKL eOLcby/941S5WyuV/wtNJ5dac5w1tkKha4zVa1b/ADKdsFVns4UMJLXbbHSsLiR1sgAa PHrkRPLegUG346WNWMe95EOoOvbQ/Vl0F6Hho0h6dZuU8gey42+/u1PMBJnr6r/Fvubk HH2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=JvtRdgCE; 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 p24-v6si1473538qtq.4.2018.10.11.14.01.03 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 11 Oct 2018 14:01:03 -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=JvtRdgCE; 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]:37116 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gAi4r-0005A8-Th for patch@linaro.org; Thu, 11 Oct 2018 17:01:01 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45145) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gAhwo-0006qV-Aw for qemu-devel@nongnu.org; Thu, 11 Oct 2018 16:52:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gAhwl-0005wg-LH for qemu-devel@nongnu.org; Thu, 11 Oct 2018 16:52:42 -0400 Received: from mail-pf1-x444.google.com ([2607:f8b0:4864:20::444]:43825) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gAhwl-0003kq-7R for qemu-devel@nongnu.org; Thu, 11 Oct 2018 16:52:39 -0400 Received: by mail-pf1-x444.google.com with SMTP id p24-v6so4994676pff.10 for ; Thu, 11 Oct 2018 13:52:18 -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=YFQr/JNTa/QXkvyuZtso9GlnKeUMjxXJ1Iso8ke3tsU=; b=JvtRdgCEb6EhrzFeGlHZS40h4ZrJ+ZIi43MZHg0ggFMa+YdlPdVDrcxyjpD9KebvA1 MAg8Fl/PPMQPbIl8r7nyk5e6uPaSU1fNygB5lVDyhLu6ujOeCFaLgwm3KLRUKvA60iDl FzCHnODx9ulbKuZVg7fBaZCBDjRUmIWhvysGI= 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=YFQr/JNTa/QXkvyuZtso9GlnKeUMjxXJ1Iso8ke3tsU=; b=tOw8eXBoU7CQVHU72ZZYyfGyxwX0qYAIm9oBF5wg/C8j8lOPmmIpFYhvyP0Y1g7mmJ c3M/qnkDjs46xOO+5v3YcTl40BcvA4xPDzTVGRSshsN/ONjihZmcPj3t4r5MNrKngXcU NpLNZsrNEiYVy4i+ZvBAtjX0HPQs0n7bb7iWzGeusI/qg0Gag87pI+hwSdLSxNCeNb4Z tfH17VclMnXoutCv2/wMSBkjseQghqeYCajfai8MJL3ezQS4YYm/OeMt0XLVL/JMRuq0 l66DTA9PKcMlFBWIm/gDXGBfUqtlOUWZtLVWBIHmKOgd9FyjL5zE8JBzouKL5wX36Bs/ 1lnA== X-Gm-Message-State: ABuFfoiJSGpjiGvvp6/IjHuUDrH9dLoqAt+0mR4ASabl3IpszJGb3uIq XDcSe/B0WdPLu1q+QFp7gpfG73eojzg= X-Received: by 2002:a62:5251:: with SMTP id g78-v6mr3100667pfb.256.1539291137435; Thu, 11 Oct 2018 13:52:17 -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.16 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 11 Oct 2018 13:52:16 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 11 Oct 2018 13:51:52 -0700 Message-Id: <20181011205206.3552-7-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::444 Subject: [Qemu-devel] [PATCH 06/20] target/arm: Use gvec for NEON VDUP 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" Also introduces neon_element_offset to find the env offset of a specific element within a neon register. Signed-off-by: Richard Henderson --- target/arm/translate.c | 63 ++++++++++++++++++++++++------------------ 1 file changed, 36 insertions(+), 27 deletions(-) -- 2.17.1 diff --git a/target/arm/translate.c b/target/arm/translate.c index d59ffa1c67..4ac526e298 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -1585,6 +1585,25 @@ neon_reg_offset (int reg, int n) return vfp_reg_offset(0, sreg); } +/* Return the offset of a 2**SIZE piece of a NEON register, at index ELE, + * where 0 is the least significant end of the register. + */ +static inline long +neon_element_offset(int reg, int element, TCGMemOp size) +{ + int element_size = 1 << size; + int ofs = element * element_size; +#ifdef HOST_WORDS_BIGENDIAN + /* Calculate the offset assuming fully little-endian, + * then XOR to account for the order of the 8-byte units. + */ + if (element_size < 8) { + ofs ^= 8 - element_size; + } +#endif + return neon_reg_offset(reg, 0) + ofs; +} + static TCGv_i32 neon_load_reg(int reg, int pass) { TCGv_i32 tmp = tcg_temp_new_i32(); @@ -3432,17 +3451,10 @@ static int disas_vfp_insn(DisasContext *s, uint32_t insn) tmp = load_reg(s, rd); if (insn & (1 << 23)) { /* VDUP */ - if (size == 0) { - gen_neon_dup_u8(tmp, 0); - } else if (size == 1) { - gen_neon_dup_low16(tmp); - } - for (n = 0; n <= pass * 2; n++) { - tmp2 = tcg_temp_new_i32(); - tcg_gen_mov_i32(tmp2, tmp); - neon_store_reg(rn, n, tmp2); - } - neon_store_reg(rn, n, tmp); + int vec_size = pass ? 16 : 8; + tcg_gen_gvec_dup_i32(size, neon_reg_offset(rn, 0), + vec_size, vec_size, tmp); + tcg_temp_free_i32(tmp); } else { /* VMOV */ switch (size) { @@ -7755,28 +7767,25 @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) tcg_temp_free_i32(tmp); } else if ((insn & 0x380) == 0) { /* VDUP */ + int element; + TCGMemOp size; + if ((insn & (7 << 16)) == 0 || (q && (rd & 1))) { return 1; } - if (insn & (1 << 19)) { - tmp = neon_load_reg(rm, 1); - } else { - tmp = neon_load_reg(rm, 0); - } if (insn & (1 << 16)) { - gen_neon_dup_u8(tmp, ((insn >> 17) & 3) * 8); + size = MO_8; + element = (insn >> 17) & 7; } else if (insn & (1 << 17)) { - if ((insn >> 18) & 1) - gen_neon_dup_high16(tmp); - else - gen_neon_dup_low16(tmp); + size = MO_16; + element = (insn >> 18) & 3; + } else { + size = MO_32; + element = (insn >> 19) & 1; } - for (pass = 0; pass < (q ? 4 : 2); pass++) { - tmp2 = tcg_temp_new_i32(); - tcg_gen_mov_i32(tmp2, tmp); - neon_store_reg(rd, pass, tmp2); - } - tcg_temp_free_i32(tmp); + tcg_gen_gvec_dup_mem(size, neon_reg_offset(rd, 0), + neon_element_offset(rm, element, size), + q ? 16 : 8, q ? 16 : 8); } else { return 1; }