From patchwork Sat Feb 17 18:22:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 128716 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp1840908ljc; Sat, 17 Feb 2018 11:04:10 -0800 (PST) X-Google-Smtp-Source: AH8x224l8I9RW7df49fJvuRKjjnzCqBCmSoLv77Nytqb0sQxWAbmG/AChN7SYaj9+YW0hylyNJzm X-Received: by 10.37.45.90 with SMTP id s26mr6126643ybe.354.1518894250568; Sat, 17 Feb 2018 11:04:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518894250; cv=none; d=google.com; s=arc-20160816; b=tIadl2K3LcZlPYPcCejfLUahKA4jd06o6B2jUdr8klaDNi+REQWZc617V5PdPRTJz1 lWsagDUCfG4pu/Xyb6wCxpuT9TzvOOyL520KmYAH91pHN0jhaLoOaMribP3aIb9XD+sQ 3gzzx1y49bekmKB7M+qTD6Vi40L/mC+DZXg7V3UDrrGLlFzm9+fAo2bg9Z1/XyYMGaH1 f7MNndVoXMTsYHfkyNctSNJCfUz+4WYaHQ2zbZ+auNTRkg7rRSl1khKFFHn4VNjFC4RV iIWxXpDs4Rtt0chjoOyySw+doV4UZ+eGW3gPWRfRhSkWpWEQZWMZpyIh8wRKsuD2eBDK /MOQ== 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=nvmjmNBSSd8KlTGFZjxDZR+Pc5M+VYp/8trMxJq8PP0=; b=GD+aMBUh4iDCfVb9rLoNUa84BXLwUCkrgWMU8e9hgr2zA9JDUMovxxV+RVFhFeac3f shnDmLkBr9F18+G6y9P0adICZHZ1uXXSNPC41kkbz6gV0SLz+gOt7AvMVKlkNkAQWPGf g/zDcncLTnj2fqZo029aLjgKevqZ/n7PyYyyog03uwQy/CZaEja+teot9ZsiE8R0nvD9 UsMLNusTvjeklMZMsAjqiZhkAMFXHsJuZzq1eAahoKpREvelcJRCnGSMKgaB+DiQxC0Z T2rR+HM8UeDbj5m3EaWJSKiowu0BD0GbRdbW/hCONTJdUoOyQxsfNszxgmm2eedo7RiG cjXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=d9nEwwYS; 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 t184si3807278ywb.736.2018.02.17.11.04.10 for (version=TLS1 cipher=AES128-SHA bits=128/128); Sat, 17 Feb 2018 11:04:10 -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=d9nEwwYS; 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]:48404 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1en7mM-00089c-04 for patch@linaro.org; Sat, 17 Feb 2018 14:04:10 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40218) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1en79l-0000uS-Bg for qemu-devel@nongnu.org; Sat, 17 Feb 2018 13:24:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1en79k-0001r8-AB for qemu-devel@nongnu.org; Sat, 17 Feb 2018 13:24:17 -0500 Received: from mail-pg0-x241.google.com ([2607:f8b0:400e:c05::241]:37119) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1en79k-0001qY-1h for qemu-devel@nongnu.org; Sat, 17 Feb 2018 13:24:16 -0500 Received: by mail-pg0-x241.google.com with SMTP id o1so4353677pgn.4 for ; Sat, 17 Feb 2018 10:24:15 -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=nvmjmNBSSd8KlTGFZjxDZR+Pc5M+VYp/8trMxJq8PP0=; b=d9nEwwYSjSaZUIaYquQNmpyKFIsbiRl3tuTsBjkgE9UJK+HgSsr5ZfaeFGJR+zf4eM /A7lagrN+kO7Oaum7aHT1gt+zZbeuXnd5R7CdrZwo4EoL+2G7rkUVCsvqbopNMoJ43KC X/7TsJcXEbLefuEyNkIyf/IItVAz6ahZ1EJm0= 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=nvmjmNBSSd8KlTGFZjxDZR+Pc5M+VYp/8trMxJq8PP0=; b=N/m+XUnknLMXKMmHkqqkhxRN+OAKwavRlDFq5pfcpDr9qjZNVJYMCLVPRiakhCg6H1 nNSRc3XyQMvTB1ZZIpLmpj2NIvBDSv9hz+WERMA/oUwUSMStEAoHpdebAqOpK5Uh1ZTq pG6zGSGpokuy1dJl+wmCMKzMtwJ+qkelRPmD9/AHSctQPg2yWiQxtXsT7Y1Pjb0D5MvT /+ushBY7I/ytMhty0vGFjKqpLSTKp7ik7Iw22IUdwr39VNVTG83VvFj470bnID6bQVc0 WXRzNVPocL1dGhlycUvilBXVdrJl0TFdW8m69d/fd8L9/+re96KbVyny5VqYgCC27Jbg VY/g== X-Gm-Message-State: APf1xPCHaBFk2LF0y3oTAig5a0Jobu9G9w7sBt/YvxhP3KJ4bGO3KlsK LVZVbZp2NTIrLvCLQBusRu0cQzUYtlI= X-Received: by 10.99.60.72 with SMTP id i8mr8129654pgn.399.1518891854813; Sat, 17 Feb 2018 10:24:14 -0800 (PST) Received: from cloudburst.twiddle.net ([50.0.192.64]) by smtp.gmail.com with ESMTPSA id h15sm13466712pfi.56.2018.02.17.10.24.13 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 17 Feb 2018 10:24:13 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Sat, 17 Feb 2018 10:22:46 -0800 Message-Id: <20180217182323.25885-31-richard.henderson@linaro.org> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180217182323.25885-1-richard.henderson@linaro.org> References: <20180217182323.25885-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 v2 30/67] target/arm: Implement SVE compress active elements 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: qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Richard Henderson --- target/arm/helper-sve.h | 3 +++ target/arm/sve_helper.c | 34 ++++++++++++++++++++++++++++++++++ target/arm/translate-sve.c | 12 ++++++++++++ target/arm/sve.decode | 6 ++++++ 4 files changed, 55 insertions(+) -- 2.14.3 Reviewed-by: Peter Maydell diff --git a/target/arm/helper-sve.h b/target/arm/helper-sve.h index bab20345c6..d977aea00d 100644 --- a/target/arm/helper-sve.h +++ b/target/arm/helper-sve.h @@ -460,6 +460,9 @@ DEF_HELPER_FLAGS_4(sve_trn_h, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_4(sve_trn_s, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_4(sve_trn_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_4(sve_compact_s, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_4(sve_compact_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) + DEF_HELPER_FLAGS_5(sve_and_pppp, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_5(sve_bic_pppp, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_5(sve_eor_pppp, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, i32) diff --git a/target/arm/sve_helper.c b/target/arm/sve_helper.c index 62982bd099..87a1a32232 100644 --- a/target/arm/sve_helper.c +++ b/target/arm/sve_helper.c @@ -2016,3 +2016,37 @@ DO_TRN(sve_trn_d, uint64_t, ) #undef DO_ZIP #undef DO_UZP #undef DO_TRN + +void HELPER(sve_compact_s)(void *vd, void *vn, void *vg, uint32_t desc) +{ + intptr_t i, j, opr_sz = simd_oprsz(desc) / 4; + uint32_t *d = vd, *n = vn; + uint8_t *pg = vg; + + for (i = j = 0; i < opr_sz; i++) { + if (pg[H1(i / 2)] & (i & 1 ? 0x10 : 0x01)) { + d[H4(j)] = n[H4(i)]; + j++; + } + } + for (; j < opr_sz; j++) { + d[H4(j)] = 0; + } +} + +void HELPER(sve_compact_d)(void *vd, void *vn, void *vg, uint32_t desc) +{ + intptr_t i, j, opr_sz = simd_oprsz(desc) / 8; + uint64_t *d = vd, *n = vn; + uint8_t *pg = vg; + + for (i = j = 0; i < opr_sz; i++) { + if (pg[H1(i)] & 1) { + d[j] = n[i]; + j++; + } + } + for (; j < opr_sz; j++) { + d[j] = 0; + } +} diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c index 09ac955a36..21531b259c 100644 --- a/target/arm/translate-sve.c +++ b/target/arm/translate-sve.c @@ -2111,6 +2111,18 @@ static void trans_TRN2_z(DisasContext *s, arg_rrr_esz *a, uint32_t insn) do_zzz_data_ool(s, a, 1 << a->esz, trn_fns[a->esz]); } +/* + *** SVE Permute Vector - Predicated Group + */ + +static void trans_COMPACT(DisasContext *s, arg_rpr_esz *a, uint32_t insn) +{ + static gen_helper_gvec_3 * const fns[4] = { + NULL, NULL, gen_helper_sve_compact_s, gen_helper_sve_compact_d + }; + do_zpz_ool(s, a, fns[a->esz]); +} + /* *** SVE Memory - 32-bit Gather and Unsized Contiguous Group */ diff --git a/target/arm/sve.decode b/target/arm/sve.decode index 2efa3773fc..a89bd37eeb 100644 --- a/target/arm/sve.decode +++ b/target/arm/sve.decode @@ -425,6 +425,12 @@ UZP2_z 00000101 .. 1 ..... 011 011 ..... ..... @rd_rn_rm TRN1_z 00000101 .. 1 ..... 011 100 ..... ..... @rd_rn_rm TRN2_z 00000101 .. 1 ..... 011 101 ..... ..... @rd_rn_rm +### SVE Permute - Predicated Group + +# SVE compress active elements +# Note esz >= 2 +COMPACT 00000101 .. 100001 100 ... ..... ..... @rd_pg_rn + ### SVE Predicate Logical Operations Group # SVE predicate logical operations