From patchwork Wed Jan 17 16:14:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 124881 Delivered-To: patch@linaro.org Received: by 10.46.62.1 with SMTP id l1csp112820lja; Wed, 17 Jan 2018 08:57:19 -0800 (PST) X-Google-Smtp-Source: ACJfBotXoSLWbCDdSxkdEhPa0w6HWFOwEoQ0PgRwamB7tn1vwsxeFudiXTh6fiIy0YdXiDezaaxd X-Received: by 10.37.233.7 with SMTP id n7mr20767689ybd.522.1516208239017; Wed, 17 Jan 2018 08:57:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516208239; cv=none; d=google.com; s=arc-20160816; b=K4OEOvfcwnW4mL2AaZmEVyCOUK26Gg7A0f6Ydj+KKwv+xUF6Nt1w/k/Rdg5enxjg+2 6kUyhfHJosr2eFRURRDaJ8cdudfc2XN6RgI0JPmjseEqvs+SG6azx5Yx/3qr+QJtYWXW MK76QeTFezCBv3JzlgsUwg2rs4ibg1tbpdFvTyYgilgkbSp2I5CDpM+cUr7s0vLsdb+3 hIY7kc4ekuRwThIcJ3zX49hHEt0WnRm2CxPj3dUSVGaLZPRWVtJx1pZp77uFVwBUKk49 CgS6tGigyxkqzVEBhR3TzbYRG9BCPzdHs4pIUf+0eS9TLjMMu4AtT59/GRbHQH6MRGGG A7Sg== 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:arc-authentication-results; bh=N1hEH1s5n+TxiokhwB/QpVBZ7vOCQFWqYn1+trLGhG0=; b=uTrVls3VoOZQqxgmHbNzojz8Bh2dnVM17VTK76w55Gq2Ou/qZvMM3HZgPZwbQ6+Rd/ xvY0Fr6niGj/FciqtLC4nff3oq5A35nNrs4D2iQ7MV0KphmXfmcccwj6MBPFhHA/6xXe in6l2KAjBgR7KsmC8LAGAVHpUxTpWskcIwyPpGeVY9OSoNPLkMeLa4CNFkWhv9gTkvSs lXy0R9iFDKLzf7xzuVRtgpPUN0pmHo35SWzPoG/scg4yYwOlCdWYrKR7QO4uuM6dDxOi 7nZ6yIr6hKki/htUlKcewshROqwOJNB0mcw+eMZDr136hDvAGLbVZWgZecueMWpgKKjh yfaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=S5KHQq5Z; 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 a25si766257ybj.744.2018.01.17.08.57.18 for (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 17 Jan 2018 08:57:19 -0800 (PST) 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=S5KHQq5Z; 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]:47014 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ebr1a-0002Ss-BZ for patch@linaro.org; Wed, 17 Jan 2018 11:57:18 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39244) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ebqNE-00071C-Tn for qemu-devel@nongnu.org; Wed, 17 Jan 2018 11:15:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ebqND-0003su-Qx for qemu-devel@nongnu.org; Wed, 17 Jan 2018 11:15:36 -0500 Received: from mail-pf0-x242.google.com ([2607:f8b0:400e:c00::242]:44253) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ebqND-0003sZ-JU for qemu-devel@nongnu.org; Wed, 17 Jan 2018 11:15:35 -0500 Received: by mail-pf0-x242.google.com with SMTP id m26so11804371pfj.11 for ; Wed, 17 Jan 2018 08:15:35 -0800 (PST) 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=N1hEH1s5n+TxiokhwB/QpVBZ7vOCQFWqYn1+trLGhG0=; b=S5KHQq5ZC5PZVWGrySQHOZbAwLxNU9W+Ly/EHjuYBDegWAWLa1LOw7zZ3DEqG1sv0m FyBt4lOTzcLG78NjPaDaTuSIXoKkWN/p0ueS22AW7EKuIuaHYHR3t0xWXP/16io3187F GAzzRahIob1u+NEs7M4P3duiGqk+YKJDqJAA8= 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=N1hEH1s5n+TxiokhwB/QpVBZ7vOCQFWqYn1+trLGhG0=; b=YW3K3gmoPwCJB53uv+32t5HOSD79MsZRXPtcGoDKLr5mgdLJCI/WMTQAjS2dO3EDzc U+NBzJ4vM7Tl5WlCYImsmFQqTqUa97/wtKkmwiyro3WPnuo36R56utKRExn2nLO8nqo2 rwDwHNcUvj0xlxpVY3AkI1mGxLKio43G0+2Oe4JQld6pXJ7k1KeFWLRtcJMq/SRgZhXs vDIQGMaFo2lEot7c8/vmJXp2OpSuS4/1vAfgWtQWv8SG/nm6wrzTBgwAHiwgYY6LKZYl ywQVqaRMZcBHwHTxRSsU62XOQ/k9sexU5kk8gZc1UcqRdmZXBgQIzqOTGJNxxLCyFNot K9Dw== X-Gm-Message-State: AKwxytdoTcs11J3D0SRF3ySx/PqTRYMV0yhQcCm8+OelQgGvxQbtGzcj YLn80fThuVrUSj/7RQ0PAR52zbMUNQ0= X-Received: by 10.98.34.27 with SMTP id i27mr4973460pfi.43.1516205734158; Wed, 17 Jan 2018 08:15:34 -0800 (PST) Received: from cloudburst.twiddle.net.com (24-181-135-57.dhcp.knwc.wa.charter.com. [24.181.135.57]) by smtp.gmail.com with ESMTPSA id l10sm1099311pff.64.2018.01.17.08.15.32 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 17 Jan 2018 08:15:33 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 17 Jan 2018 08:14:29 -0800 Message-Id: <20180117161435.28981-15-richard.henderson@linaro.org> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180117161435.28981-1-richard.henderson@linaro.org> References: <20180117161435.28981-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c00::242 Subject: [Qemu-devel] [PATCH v10.5 14/20] target/arm: Use vector infrastructure for aa64 dup/movi 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" Signed-off-by: Richard Henderson --- target/arm/translate-a64.c | 83 +++++++++++++++++++--------------------------- 1 file changed, 34 insertions(+), 49 deletions(-) -- 2.14.3 Reviewed-by: Peter Maydell diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index 219cc1e19d..2495414603 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -5863,38 +5863,24 @@ static void disas_simd_across_lanes(DisasContext *s, uint32_t insn) * * size: encoded in imm5 (see ARM ARM LowestSetBit()) */ + static void handle_simd_dupe(DisasContext *s, int is_q, int rd, int rn, int imm5) { int size = ctz32(imm5); - int esize = 8 << size; - int elements = (is_q ? 128 : 64) / esize; - int index, i; - TCGv_i64 tmp; + int index = imm5 >> (size + 1); if (size > 3 || (size == 3 && !is_q)) { unallocated_encoding(s); return; } - if (!fp_access_check(s)) { return; } - index = imm5 >> (size + 1); - - tmp = tcg_temp_new_i64(); - read_vec_element(s, tmp, rn, index, size); - - for (i = 0; i < elements; i++) { - write_vec_element(s, tmp, rd, i, size); - } - - if (!is_q) { - clear_vec_high(s, rd); - } - - tcg_temp_free_i64(tmp); + tcg_gen_gvec_dup_mem(size, vec_full_reg_offset(s, rd), + vec_reg_offset(s, rn, index, size), + is_q ? 16 : 8, vec_full_reg_size(s)); } /* DUP (element, scalar) @@ -5943,9 +5929,7 @@ static void handle_simd_dupg(DisasContext *s, int is_q, int rd, int rn, int imm5) { int size = ctz32(imm5); - int esize = 8 << size; - int elements = (is_q ? 128 : 64)/esize; - int i = 0; + uint32_t dofs, oprsz, maxsz; if (size > 3 || ((size == 3) && !is_q)) { unallocated_encoding(s); @@ -5956,12 +5940,11 @@ static void handle_simd_dupg(DisasContext *s, int is_q, int rd, int rn, return; } - for (i = 0; i < elements; i++) { - write_vec_element(s, cpu_reg(s, rn), rd, i, size); - } - if (!is_q) { - clear_vec_high(s, rd); - } + dofs = vec_full_reg_offset(s, rd); + oprsz = is_q ? 16 : 8; + maxsz = vec_full_reg_size(s); + + tcg_gen_gvec_dup_i64(size, dofs, oprsz, maxsz, cpu_reg(s, rn)); } /* INS (Element) @@ -6152,7 +6135,6 @@ static void disas_simd_mod_imm(DisasContext *s, uint32_t insn) bool is_neg = extract32(insn, 29, 1); bool is_q = extract32(insn, 30, 1); uint64_t imm = 0; - TCGv_i64 tcg_rd, tcg_imm; int i; if (o2 != 0 || ((cmode == 0xf) && is_neg && !is_q)) { @@ -6234,32 +6216,35 @@ static void disas_simd_mod_imm(DisasContext *s, uint32_t insn) imm = ~imm; } - tcg_imm = tcg_const_i64(imm); - tcg_rd = new_tmp_a64(s); + if (!((cmode & 0x9) == 0x1 || (cmode & 0xd) == 0x9)) { + /* MOVI or MVNI, with MVNI negation handled above. */ + tcg_gen_gvec_dup64i(vec_full_reg_offset(s, rd), is_q ? 16 : 8, + vec_full_reg_size(s), imm); + } else { + TCGv_i64 tcg_imm = tcg_const_i64(imm); + TCGv_i64 tcg_rd = new_tmp_a64(s); - for (i = 0; i < 2; i++) { - int foffs = i ? fp_reg_hi_offset(s, rd) : fp_reg_offset(s, rd, MO_64); + for (i = 0; i < 2; i++) { + int foffs = vec_reg_offset(s, rd, i, MO_64); - if (i == 1 && !is_q) { - /* non-quad ops clear high half of vector */ - tcg_gen_movi_i64(tcg_rd, 0); - } else if ((cmode & 0x9) == 0x1 || (cmode & 0xd) == 0x9) { - tcg_gen_ld_i64(tcg_rd, cpu_env, foffs); - if (is_neg) { - /* AND (BIC) */ - tcg_gen_and_i64(tcg_rd, tcg_rd, tcg_imm); + if (i == 1 && !is_q) { + /* non-quad ops clear high half of vector */ + tcg_gen_movi_i64(tcg_rd, 0); } else { - /* ORR */ - tcg_gen_or_i64(tcg_rd, tcg_rd, tcg_imm); + tcg_gen_ld_i64(tcg_rd, cpu_env, foffs); + if (is_neg) { + /* AND (BIC) */ + tcg_gen_and_i64(tcg_rd, tcg_rd, tcg_imm); + } else { + /* ORR */ + tcg_gen_or_i64(tcg_rd, tcg_rd, tcg_imm); + } } - } else { - /* MOVI */ - tcg_gen_mov_i64(tcg_rd, tcg_imm); + tcg_gen_st_i64(tcg_rd, cpu_env, foffs); } - tcg_gen_st_i64(tcg_rd, cpu_env, foffs); - } - tcg_temp_free_i64(tcg_imm); + tcg_temp_free_i64(tcg_imm); + } } /* AdvSIMD scalar copy