From patchwork Mon Dec 18 17:17:43 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 122247 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp3105775qgn; Mon, 18 Dec 2017 09:24:40 -0800 (PST) X-Google-Smtp-Source: ACJfBosUaGD3s6YExOCP9ppGYvsakuuMQWT+R7ZVhrzDrGK9Www7xS+WZmCpY7m+4NLAM/zBNv6O X-Received: by 10.13.199.130 with SMTP id j124mr417594ywd.44.1513617880040; Mon, 18 Dec 2017 09:24:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513617880; cv=none; d=google.com; s=arc-20160816; b=wM/gj9ISFefnNkpSXh/fenNs8YlFKndTa7Ad0Bt6D3gozzrm/Ou2Y6Tw7YLE4BOT2l 1/kMU4L9bhBOuYd22ToZVeGB8OKidsPZoLjnI2DJ4fbWliPLLPazFxEYZaPPtMEmpaOi IEDiWulFTKWrV2JmLt5bI+R/H5LT0+w/JcjIo7OucT0vkU0f6tflrVAuv56drG/xQhDR 0w3c8/vBX58XeUli+BYc82nWcr5LKmX6Zn3OKAuVk8eqPZbarYf1hsVEd1oZ2diMtcPh ge7Y57IPaPBZa59rJx5kevDXqKuO0qWq+AADGyTYpOoUMhKPYMELjlMgkP0oP4go3DYK FKUA== 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=fglbqt0ZZi+UTUzzw2VU5fDhQFOJREmbY828m0tqWIs=; b=AcEO1TH5b630HhRV8j93labuJPCrrGXwOHrxRvuCjy1yjc4WKpUQbVoNDrZQZa3sJB 20EOAiFt4rS5mtmxBlff+B368J4twV+hlOzsJyPtRvfHcuz0plLkQ/B8vi/1YWvharF3 BmbZWtO+NIdidDRXEk7NlD7Mngii81uUj/czx6psnzUTdMsGKaqfpdC/2f0eEgG35lAq oS6XddB7yQxSsot9PdlwNe8E+HEapLGuzzKP7VN9/nHu8l5Qb3ulzidf1E02rUOS2u6F mL9hLI/2cAQYrbHEwe0SoBymqKb8HSyfeb9uVjVzkhNyIGqVUIwFMlIfv1XRtwH5bdo4 vk8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=VdceXt5b; 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 128si2556097ybw.612.2017.12.18.09.24.39 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 18 Dec 2017 09:24:40 -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=VdceXt5b; 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]:58558 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eQz9b-0005aB-Fm for patch@linaro.org; Mon, 18 Dec 2017 12:24:39 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37198) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eQz3a-0000TX-IZ for qemu-devel@nongnu.org; Mon, 18 Dec 2017 12:18:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eQz3T-00015Q-DL for qemu-devel@nongnu.org; Mon, 18 Dec 2017 12:18:26 -0500 Received: from mail-pg0-x241.google.com ([2607:f8b0:400e:c05::241]:36822) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eQz3T-00013s-5S for qemu-devel@nongnu.org; Mon, 18 Dec 2017 12:18:19 -0500 Received: by mail-pg0-x241.google.com with SMTP id k134so9402740pga.3 for ; Mon, 18 Dec 2017 09:18:19 -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=fglbqt0ZZi+UTUzzw2VU5fDhQFOJREmbY828m0tqWIs=; b=VdceXt5bRZDs39SGuw4cgQfOkNHMnDVX4RUXOsKVYQXJ/75ZfvmRQ5TWAZaWnnvi+a eSnlBUOVIJZhx+Kpv41QPgzyiocWu/HVBojfQTeijhIj6ULw9KkOFFZwpfN23kH9Zacg wFb7AWEgQs+KA26+OyB0vOapCN9PJWRHpMfYU= 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=fglbqt0ZZi+UTUzzw2VU5fDhQFOJREmbY828m0tqWIs=; b=Pvuhe/ss1Pq1w39ygeRn7WLZRIGhAfE5Cpy2GyyCDdG94RPaIA0oL8zd+0y3oYxytX 4SiqtaxiDXunqzyN+BXY81SS5tyfJU9wc+wTvSyKLdVBQC4tsuYKPTLTxxEWTpt9yL5X vOquoqLbd4D1GodIeVMJfjfOqn26vhHpR+iHaIruoZj/v7u94WXQW2pLkft4tp+B1GNZ QkowztNou5Ci+flNoaSFeBijoZV3V9WifdApejIG40Q1PEsKYujt6rhx/4IbQbK3dMCL kaCKH/XSUKNf+pZCXltEBxRUIocwSBbCtew6rw9KOQHfxceEOKjS6RQ+nyAbuqVyAu8E 2EUQ== X-Gm-Message-State: AKGB3mIMFhBlA+GLuZobw48lULsSP7ppVLSdAODLtlRpXVdGxBo6ANwq OD+PvZ6UFQXYMDRKNRQcS9bE/zaAu1g= X-Received: by 10.98.89.4 with SMTP id n4mr390119pfb.133.1513617497835; Mon, 18 Dec 2017 09:18:17 -0800 (PST) Received: from cloudburst.twiddle.net (174-21-7-63.tukw.qwest.net. [174.21.7.63]) by smtp.gmail.com with ESMTPSA id y19sm21050272pgv.19.2017.12.18.09.18.16 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 18 Dec 2017 09:18:16 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Mon, 18 Dec 2017 09:17:43 -0800 Message-Id: <20171218171758.16964-12-richard.henderson@linaro.org> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20171218171758.16964-1-richard.henderson@linaro.org> References: <20171218171758.16964-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:c05::241 Subject: [Qemu-devel] [PATCH v7 11/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: , 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 | 103 +++++++++++++++------------------------------ 1 file changed, 35 insertions(+), 68 deletions(-) -- 2.14.3 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 */