From patchwork Sat Feb 17 18:22:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 128710 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp1836570ljc; Sat, 17 Feb 2018 10:58:22 -0800 (PST) X-Google-Smtp-Source: AH8x2253XimHrvKpay3OIMd09Stz+dwg68wdLMAhN/yQDpXJUySvfFtkj52lcydHwXeQDp8w200U X-Received: by 10.37.87.66 with SMTP id l63mr3703075ybb.488.1518893902521; Sat, 17 Feb 2018 10:58:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518893902; cv=none; d=google.com; s=arc-20160816; b=uCjmwh2HDTgnRtzW52fjGenEhhyd42f8ISYaBUmWkoX6QLCijcsF0QlSbt33A9ao8X vQJhowRkM9TI5qrt9maydPezVxv9sH0ugW3PMrdr5+vlDEwEszoBc9ZroZx1Vpoh5riW y7VQlBA47gebjq8HyX8RjN16Sr1DeFtedFUQaGsi5aXIw0E3HqmUz/k2aE9reZ3S+vlx cVkvOT4SWuIIkNZX1hSDCDizHo6YqGrYGOt2P2xFL0KmcGDeUZedB+deXs6JoxgEHLpy x8+bB/MN9DOIOI5w6+ThlXIpN1n1tfZvd5g6mKtgGw7hO/qQG1udEaLJYpP1ClsZdd9u WyWw== 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=k4jL592UFSa2Gtp23s7RFTcDDeu5zdBjKBpgmgfqBXU=; b=mNFnlWBCgnkdnUplgyy9O/PgEdJVV9KnGAQeWBG+NK+Wl/S5DAOAKGkIh3QaFIrAd3 qqAShjE8Plg1e57MgVkBlYavR9R9GFgKhafY9BSK82QC5uaWfCEu0rP6tiqJndanKNz5 UXgKGtVIuZb/f+RHeDJfBXOpbiMEo8L/K+8Iar0Ya5fRHFITV8QfoMVKicyImNTwKTXp 69mKNziQnxyeOm73e1lV9KUZNUIPqWXI7wKV6CqAD7NG4Cc8tzyselndClW7vSj3bx1G b7VBPtxZq4BJd3bbGitnkwClKyNRyPLhit399eDt0XB+0yJ+bcpcjoFlVhEB3PWyw89Y iH5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=KatThmkn; 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 s203si3540367yws.394.2018.02.17.10.58.22 for (version=TLS1 cipher=AES128-SHA bits=128/128); Sat, 17 Feb 2018 10:58:22 -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=KatThmkn; 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]:48356 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1en7gj-0003m3-Rq for patch@linaro.org; Sat, 17 Feb 2018 13:58:21 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40334) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1en79t-00015A-5d for qemu-devel@nongnu.org; Sat, 17 Feb 2018 13:24:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1en79q-0001u6-Bl for qemu-devel@nongnu.org; Sat, 17 Feb 2018 13:24:25 -0500 Received: from mail-pf0-x244.google.com ([2607:f8b0:400e:c00::244]:38522) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1en79q-0001tg-5r for qemu-devel@nongnu.org; Sat, 17 Feb 2018 13:24:22 -0500 Received: by mail-pf0-x244.google.com with SMTP id i3so592708pfe.5 for ; Sat, 17 Feb 2018 10:24:22 -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=k4jL592UFSa2Gtp23s7RFTcDDeu5zdBjKBpgmgfqBXU=; b=KatThmknFgzHb/Wf3HO7P2EK564kCbe3j/4RB061Jcs8gnNuWy6VTDIow5DZvgSiHR Ipot+dEmFcABolk0K8yYRySP08UKC24xJahxgpm2MFilWrc22VZmPWSS9GsnDiDf3toN 338t0xA1WZ31bByeJosFPH95W0Lg89cZ/GCPQ= 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=k4jL592UFSa2Gtp23s7RFTcDDeu5zdBjKBpgmgfqBXU=; b=Q89I4GuuvyQZ5LDRTTGsOpgB81ZYbPc1ECSIV0SZM4r/emX8HMKwN7CEcniwyW4Q9I FZNAh0N9OX4pOhdARBM/ufMTPeiw2UCctiNgegJgT9KPxR5wrXf5cicWzuSRJxXqWHh4 4zIVpAUqhwZCRgfw8b8ZIYGM+IXI/WZi/z0EbO7tIcZJoGglV98dF1Z+RJSvq4EVwH/N oPaTZWZzN+lgSah9TtyAmsbpq2g6hvydFggHAcf2UxjZiWTSoRIekETRdeOqXf/ea0xX MBj5AhDMJYswENQiE2UymprH/nw73kM8E9aaz7Gw/NWTZmHpQl54q4J0b8FN5KRqZqRJ diTw== X-Gm-Message-State: APf1xPCqGY6nD6JvZALOZh619NCc7WtoWJ4/AxFoYd2YsuFU86wgIbHV PdGV+6XWHNbNRhj3krtuz8ecECGmj4w= X-Received: by 10.99.168.8 with SMTP id o8mr8387252pgf.42.1518891860910; Sat, 17 Feb 2018 10:24:20 -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.19 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 17 Feb 2018 10:24:20 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Sat, 17 Feb 2018 10:22:50 -0800 Message-Id: <20180217182323.25885-35-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:c00::244 Subject: [Qemu-devel] [PATCH v2 34/67] target/arm: Implement SVE vector splice (predicated) 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 | 2 ++ target/arm/sve_helper.c | 37 +++++++++++++++++++++++++++++++++++++ target/arm/translate-sve.c | 10 ++++++++++ target/arm/sve.decode | 3 +++ 4 files changed, 52 insertions(+) -- 2.14.3 Reviewed-by: Peter Maydell diff --git a/target/arm/helper-sve.h b/target/arm/helper-sve.h index 3b7c54905d..c3f8a2b502 100644 --- a/target/arm/helper-sve.h +++ b/target/arm/helper-sve.h @@ -479,6 +479,8 @@ DEF_HELPER_FLAGS_4(sve_rbit_h, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_4(sve_rbit_s, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_4(sve_rbit_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_5(sve_splice, TCG_CALL_NO_RWG, void, ptr, 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 a67bb579b8..f524a1ddce 100644 --- a/target/arm/sve_helper.c +++ b/target/arm/sve_helper.c @@ -2088,3 +2088,40 @@ int32_t HELPER(sve_last_active_element)(void *vg, uint32_t pred_desc) return last_active_element(vg, DIV_ROUND_UP(oprsz, 8), esz); } + +void HELPER(sve_splice)(void *vd, void *vn, void *vm, void *vg, uint32_t desc) +{ + intptr_t opr_sz = simd_oprsz(desc) / 8; + int esz = simd_data(desc); + uint64_t pg, first_g, last_g, len, mask = pred_esz_masks[esz]; + intptr_t i, first_i, last_i; + ARMVectorReg tmp; + + first_i = last_i = 0; + first_g = last_g = 0; + + /* Find the extent of the active elements within VG. */ + for (i = QEMU_ALIGN_UP(opr_sz, 8) - 8; i >= 0; i -= 8) { + pg = *(uint64_t *)(vg + i) & mask; + if (pg) { + if (last_g == 0) { + last_g = pg; + last_i = i; + } + first_g = pg; + first_i = i; + } + } + + len = 0; + if (first_g != 0) { + first_i = first_i * 8 + ctz64(first_g); + last_i = last_i * 8 + 63 - clz64(last_g); + len = last_i - first_i + (1 << esz); + if (vd == vm) { + vm = memcpy(&tmp, vm, opr_sz * 8); + } + swap_memmove(vd, vn + first_i, len); + } + swap_memmove(vd + len, vm, opr_sz * 8 - len); +} diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c index 5a1ed379ad..559fb41fd6 100644 --- a/target/arm/translate-sve.c +++ b/target/arm/translate-sve.c @@ -2473,6 +2473,16 @@ static void trans_RBIT(DisasContext *s, arg_rpr_esz *a, uint32_t insn) do_zpz_ool(s, a, fns[a->esz]); } +static void trans_SPLICE(DisasContext *s, arg_rprr_esz *a, uint32_t insn) +{ + unsigned vsz = vec_full_reg_size(s); + tcg_gen_gvec_4_ool(vec_full_reg_offset(s, a->rd), + vec_full_reg_offset(s, a->rn), + vec_full_reg_offset(s, a->rm), + pred_full_reg_offset(s, a->pg), + vsz, vsz, a->esz, gen_helper_sve_splice); +} + /* *** SVE Memory - 32-bit Gather and Unsized Contiguous Group */ diff --git a/target/arm/sve.decode b/target/arm/sve.decode index 8903fb6592..70feb448e6 100644 --- a/target/arm/sve.decode +++ b/target/arm/sve.decode @@ -464,6 +464,9 @@ REVH 00000101 .. 1001 01 100 ... ..... ..... @rd_pg_rn REVW 00000101 .. 1001 10 100 ... ..... ..... @rd_pg_rn RBIT 00000101 .. 1001 11 100 ... ..... ..... @rd_pg_rn +# SVE vector splice (predicated) +SPLICE 00000101 .. 101 100 100 ... ..... ..... @rdn_pg_rm + ### SVE Predicate Logical Operations Group # SVE predicate logical operations