From patchwork Tue Nov 21 21:25:23 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 119424 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp5826445qgn; Tue, 21 Nov 2017 13:44:47 -0800 (PST) X-Google-Smtp-Source: AGs4zMaIQCXaF0r4sg1MaMS3jcQAmxcCryQIi/CODAH5ywJSYYXYr9PkLzuBWBrTD0q+1+YjXoVJ X-Received: by 10.129.76.132 with SMTP id z126mr11775090ywa.67.1511300687539; Tue, 21 Nov 2017 13:44:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511300687; cv=none; d=google.com; s=arc-20160816; b=PqxvcurJ5cGNiiXn9Y0SwCCoJExBxOLxNzpXvi7pxK1jTFGFb7DLUQVy7VPE6ETaob dJdh6is28b8gHgxT976XBMvQ4SyVnyWkk9RWzXBQRIB2W0LcbVp8uV0YRstQz8sPCWsl kiP/V8DlGqPwhdL/dXJxVqNK3bgGVTimGRYDmSmXziOYirTW4zLmWWql9zdIXLK4muid 1xw3BdH53d6wBRRRTQ7X3V4Smir0dYVP/LVnuEFlvwt+i6H7xb7DWXEcm7mAKf9pi2x2 9V+ZU1MBez2uYHJh+HeCkpZzlBKiZzTVHvbkKK5mtITgAH3E9Q/KRrhxTDkvgGf3eCGE KtnA== 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:arc-authentication-results; bh=QuBWrKgNGFu9gomUQwOFUeI255DsQ+2ZZs3Ag3qWXg8=; b=xgw3d1XFNFmvGbwlMEJgm5V5Mmz7zBIrgDl4IykRmUm9V6Wy0BuYW30qJwOV9pajAO k48FVPSiYMq2vA2hzGFnNRaGipVskmTwQgvjoNBvFmOX7fR8ZZjSe/FsoFduRvSQ9IEV mEdJTWxKfYxVebot796vLO/ATlqg7fvTokRsWK4hh6TUNvwov29Q/ifK8HWpw6ux+rVt zI1h08OCw2aa9pV0cpAjrvMSy6qI6RRK/My3cMAL7hSo+rkgE2aRjDJVjiQP1zrFpi75 r57nHWix6ED8+BWBmWUINGfBtZRwnaFKt0gzuKedsN720GN42FEvRCd/7xHtwkK5GBUw jpJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=g3e15Va0; 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 64si2935644ybw.344.2017.11.21.13.44.47 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 21 Nov 2017 13:44:47 -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=g3e15Va0; 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]:36668 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eHGLW-0002sK-Tp for patch@linaro.org; Tue, 21 Nov 2017 16:44:46 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54114) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eHG5H-0004Vb-Gi for qemu-devel@nongnu.org; Tue, 21 Nov 2017 16:28:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eHG5E-0007lC-Nv for qemu-devel@nongnu.org; Tue, 21 Nov 2017 16:27:59 -0500 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:44107) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eHG5E-0007kl-Fh for qemu-devel@nongnu.org; Tue, 21 Nov 2017 16:27:56 -0500 Received: by mail-wm0-x242.google.com with SMTP id r68so6353176wmr.3 for ; Tue, 21 Nov 2017 13:27:56 -0800 (PST) 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=QuBWrKgNGFu9gomUQwOFUeI255DsQ+2ZZs3Ag3qWXg8=; b=g3e15Va0sqQlal7Y1aZXsc5T2qCh+1NdEVN5xtsiizacWtTOGlc4SFD1XjN0dX0HKP v05AgQlM9vX2JYI/Gt1f8H5IuKo1HXqd6xjgY7OHpx7CH/S/A5+j26JbYUBKLwmYKm6X dVcn8TG8tr9YWT6fh9zaWFuiJLgLZd8vXZhwc= 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=QuBWrKgNGFu9gomUQwOFUeI255DsQ+2ZZs3Ag3qWXg8=; b=JonH5iumkig1oTkt7qJhd6so8P6XmYvTQ/WfyWayRYBZDOleoxyBVs54VL1Y96bQxn De+9Z/aAtlf1Q7Riw1KgnR5rBBy8qZZrvdA75W7Vo5MmxLYY+UxZTrmApn/T0jr40t9o JhBHxtlWfNtZrTPqDA9+ELF2Fjmr5YL6qAtpEnt947eSZrEey+JldLGDAvE+gqiQUW1S D7oljLcx2S9hQ7PbUWYkWet3mE4STg98kCczj2wDIHSaD7FS4X8jxHkVLes3S67pRuuL QOD6pCylMagoI5wN+p/G85sbNFdhDZxL95xiyJg4fMA4RDyGR7XpbGFmMOIYzmilo23e kv6A== X-Gm-Message-State: AJaThX7Z8TYjJfgWlPMOf6okwfAQ8lINx+e0TPOBcawsQH2XZpoEocAL GYsHfRDm+Np4kGSwDIL+yrdJY0uA78M= X-Received: by 10.28.127.22 with SMTP id a22mr2260239wmd.12.1511299675300; Tue, 21 Nov 2017 13:27:55 -0800 (PST) Received: from cloudburst.twiddle.net (70.red-37-158-60.dynamicip.rima-tde.net. [37.158.60.70]) by smtp.gmail.com with ESMTPSA id e124sm706517wmg.34.2017.11.21.13.27.54 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 21 Nov 2017 13:27:54 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Tue, 21 Nov 2017 22:25:23 +0100 Message-Id: <20171121212534.5177-16-richard.henderson@linaro.org> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20171121212534.5177-1-richard.henderson@linaro.org> References: <20171121212534.5177-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::242 Subject: [Qemu-devel] [PATCH v6 15/26] target/arm: Use vector infrastructure for aa64 zip/uzp/trn/xtn 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 --- target/arm/translate-a64.c | 103 +++++++++++++++------------------------------ 1 file changed, 35 insertions(+), 68 deletions(-) -- 2.13.6 diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index 55a4902fc2..8769b4505a 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -5576,11 +5576,7 @@ static void disas_simd_zip_trn(DisasContext *s, uint32_t insn) int opcode = extract32(insn, 12, 2); bool part = extract32(insn, 14, 1); bool is_q = extract32(insn, 30, 1); - int esize = 8 << size; - int i, ofs; - int datasize = is_q ? 128 : 64; - int elements = datasize / esize; - TCGv_i64 tcg_res, tcg_resl, tcg_resh; + GVecGen3Fn *gvec_fn; if (opcode == 0 || (size == 3 && !is_q)) { unallocated_encoding(s); @@ -5591,60 +5587,24 @@ static void disas_simd_zip_trn(DisasContext *s, uint32_t insn) return; } - tcg_resl = tcg_const_i64(0); - tcg_resh = tcg_const_i64(0); - tcg_res = tcg_temp_new_i64(); - - for (i = 0; i < elements; i++) { - switch (opcode) { - case 1: /* UZP1/2 */ - { - int midpoint = elements / 2; - if (i < midpoint) { - read_vec_element(s, tcg_res, rn, 2 * i + part, size); - } else { - read_vec_element(s, tcg_res, rm, - 2 * (i - midpoint) + part, size); - } - break; - } - case 2: /* TRN1/2 */ - if (i & 1) { - read_vec_element(s, tcg_res, rm, (i & ~1) + part, size); - } else { - read_vec_element(s, tcg_res, rn, (i & ~1) + part, size); - } - break; - case 3: /* ZIP1/2 */ - { - int base = part * elements / 2; - if (i & 1) { - read_vec_element(s, tcg_res, rm, base + (i >> 1), size); - } else { - read_vec_element(s, tcg_res, rn, base + (i >> 1), size); - } - break; - } - default: - g_assert_not_reached(); - } - - ofs = i * esize; - if (ofs < 64) { - tcg_gen_shli_i64(tcg_res, tcg_res, ofs); - tcg_gen_or_i64(tcg_resl, tcg_resl, tcg_res); - } else { - tcg_gen_shli_i64(tcg_res, tcg_res, ofs - 64); - tcg_gen_or_i64(tcg_resh, tcg_resh, tcg_res); - } + switch (opcode) { + case 1: /* UZP1/2 */ + gvec_fn = part ? tcg_gen_gvec_uzpo : tcg_gen_gvec_uzpe; + break; + case 2: /* TRN1/2 */ + gvec_fn = part ? tcg_gen_gvec_trno : tcg_gen_gvec_trne; + break; + case 3: /* ZIP1/2 */ + gvec_fn = part ? tcg_gen_gvec_ziph : tcg_gen_gvec_zipl; + break; + default: + g_assert_not_reached(); } - tcg_temp_free_i64(tcg_res); - - write_vec_element(s, tcg_resl, rd, 0, MO_64); - tcg_temp_free_i64(tcg_resl); - write_vec_element(s, tcg_resh, rd, 1, MO_64); - tcg_temp_free_i64(tcg_resh); + gvec_fn(size, vec_full_reg_offset(s, rd), + vec_full_reg_offset(s, rn), + vec_full_reg_offset(s, rm), + is_q ? 16 : 8, vec_full_reg_size(s)); } static void do_minmaxop(DisasContext *s, TCGv_i32 tcg_elt1, TCGv_i32 tcg_elt2, @@ -7922,6 +7882,22 @@ static void handle_2misc_narrow(DisasContext *s, bool scalar, int destelt = is_q ? 2 : 0; int passes = scalar ? 1 : 2; + if (opcode == 0x12 && !u) { /* XTN, XTN2 */ + tcg_debug_assert(!scalar); + if (is_q) { /* XTN2 */ + tcg_gen_gvec_uzpe(size, vec_reg_offset(s, rd, 1, MO_64), + vec_reg_offset(s, rn, 0, MO_64), + vec_reg_offset(s, rn, 1, MO_64), + 8, vec_full_reg_size(s) - 8); + } else { + tcg_gen_gvec_uzpe(size, vec_reg_offset(s, rd, 0, MO_64), + vec_reg_offset(s, rn, 0, MO_64), + vec_reg_offset(s, rn, 1, MO_64), + 8, vec_full_reg_size(s)); + } + return; + } + if (scalar) { tcg_res[1] = tcg_const_i32(0); } @@ -7939,23 +7915,14 @@ static void handle_2misc_narrow(DisasContext *s, bool scalar, tcg_res[pass] = tcg_temp_new_i32(); switch (opcode) { - case 0x12: /* XTN, SQXTUN */ + case 0x12: /* , SQXTUN */ { - static NeonGenNarrowFn * const xtnfns[3] = { - gen_helper_neon_narrow_u8, - gen_helper_neon_narrow_u16, - tcg_gen_extrl_i64_i32, - }; static NeonGenNarrowEnvFn * const sqxtunfns[3] = { gen_helper_neon_unarrow_sat8, gen_helper_neon_unarrow_sat16, gen_helper_neon_unarrow_sat32, }; - if (u) { - genenvfn = sqxtunfns[size]; - } else { - genfn = xtnfns[size]; - } + genenvfn = sqxtunfns[size]; break; } case 0x14: /* SQXTN, UQXTN */