From patchwork Wed Jun 13 01:56:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 138389 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp98731lji; Tue, 12 Jun 2018 19:00:39 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKeKB6PFkry0OSGEwc+hxWtzoKGMRQNqHyX9zeAcrmFcu0KpcoCtqZSW7WCKds+0eum5728 X-Received: by 2002:a0c:a083:: with SMTP id c3-v6mr2798921qva.107.1528855239546; Tue, 12 Jun 2018 19:00:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528855239; cv=none; d=google.com; s=arc-20160816; b=NKlRRmmjoAkvGl4oKpfiV3UfoSxeSg+IXpSjgIBChrywVgRrMZ/9O+sCkwxW4/o1r1 LV04SFJFsfEBSlbWUfGnjHlaucls79ULS6h40/AC4S84eWKQjdLGXi2CdLElNH13rGds Fq2XnynY2XvdUwkE+gOdqPmzo0xo0stydk2VDL/om5mQc9Rs77jKlhsSpQcOS1bQzaDF GTLXaUKdk8jIkXn+Gfh3o+27Pod5X/ryC2SgqgzRqne6wOk63q5Wge5Ioc+KnQXD4e7O VEC3NOzao+50FjbjmD/Mv3S011bCSwZgoJTtOZTTRqu3mWKRb8B1TEQJgNdgtjH81r07 CRsg== 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=IkiridyT5PI+W0HF8A0jZ7zJMR+O60d3GRJl8gAbJew=; b=hlYoBZ887ICB7bCxFxhP4OgWo0qwDEx0/9MqN8bIFuf6TXrm8mYLVdIi3OUJaoX6KH boh0+0z8GivuHBLs5tkVFkGO9M01ZRe0Hz1QDdEoAyhIrGM0Ns7oC/H/M43cH/OQkpns j4bO8KuffySfElwLGRY6EP2HJtOMxMxUcRckeq2nRADU9iloeQuJI2cKIrl/NQzp5Kp7 kKO9ytNETenim2qaCipBfYGKQTD9B/YoM85BuPt3zPp6PoZBKxnXrSavRPjQHhf79FRD Cqob/fcpIMaR918Y1PssB1FjTx9FdPCYuDodXa0FB5cQ5Twg5kvpNR1yR5lsVnelKwGG lknQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=EJnxV1cB; 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 o3-v6si1420484qvk.58.2018.06.12.19.00.39 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 12 Jun 2018 19:00:39 -0700 (PDT) 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=EJnxV1cB; 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]:59281 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fSv5S-0004tL-Vz for patch@linaro.org; Tue, 12 Jun 2018 22:00:39 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44081) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fSv2C-0002Nb-S3 for qemu-devel@nongnu.org; Tue, 12 Jun 2018 21:57:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fSv2A-0006H7-7P for qemu-devel@nongnu.org; Tue, 12 Jun 2018 21:57:16 -0400 Received: from mail-pl0-x235.google.com ([2607:f8b0:400e:c01::235]:44821) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fSv2A-0006Gy-1R for qemu-devel@nongnu.org; Tue, 12 Jun 2018 21:57:14 -0400 Received: by mail-pl0-x235.google.com with SMTP id z9-v6so544517plk.11 for ; Tue, 12 Jun 2018 18:57:13 -0700 (PDT) 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=IkiridyT5PI+W0HF8A0jZ7zJMR+O60d3GRJl8gAbJew=; b=EJnxV1cBQGV7wWMY4eyhPq2jyRQG2I+YC5ZNzyAnZ5EPht+Yfz6kbjPIsTRQrclny/ USDh1KE/miDJVQzp3hMf7hzrBQgSjUSUPgjJJGBEyZ0oRtYBqF63QTZLlTMWoVbo8ywo 3fZV2VYg0CYzmea7pIfk9w5CopGi86uh5E/Zw= 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=IkiridyT5PI+W0HF8A0jZ7zJMR+O60d3GRJl8gAbJew=; b=rpRwRSeTO9gnq80M8XncI2U3Lc34QfmH0dXgMWir2lOSAzDJMBTeA27h9+jiLVkprF 5bGo5iI+lPpv8hA64xpF4VHGHYRhjQRow0dfPEuiTAWBAhIn6aZbTZMxH3RC+bcUGale QTyHF7zNzN1iFe+Wwr3YmodtB9OPmFZ97UzZ4nX4K4Wk9lgYzKk8oa+oYe/aHvbHe+IJ KeMKTndOfHyBDxuA4SbfA8Q2vm2zFdyF1Qxln4ZujVOyh/PxBl5T7TXh2KGq6B2bsXqj B32C58xr9hDwb7jA8/+WtHkU3sovrUhm8CcxtEZkl/p0X+EOzjxN7MtIvYSuIrmV9stj o/Sw== X-Gm-Message-State: APt69E0cyH5Mi6XQnf6ygmMPJn3opy2KrWEhLONbLHUSAjRgQjbYt3SY l0KmxWrUsanceCrjNtyTVGF8dCP1OsA= X-Received: by 2002:a17:902:9883:: with SMTP id s3-v6mr2978636plp.194.1528855032719; Tue, 12 Jun 2018 18:57:12 -0700 (PDT) Received: from cloudburst.twiddle.net (rrcs-173-198-77-219.west.biz.rr.com. [173.198.77.219]) by smtp.gmail.com with ESMTPSA id g10-v6sm1647287pfi.148.2018.06.12.18.57.10 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 12 Jun 2018 18:57:11 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Tue, 12 Jun 2018 15:56:32 -1000 Message-Id: <20180613015641.5667-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180613015641.5667-1-richard.henderson@linaro.org> References: <20180613015641.5667-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:c01::235 Subject: [Qemu-devel] [PATCH v4b 09/18] 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: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/helper-sve.h | 2 ++ target/arm/sve_helper.c | 37 +++++++++++++++++++++++++++++++++++++ target/arm/translate-sve.c | 13 +++++++++++++ target/arm/sve.decode | 3 +++ 4 files changed, 55 insertions(+) -- 2.17.1 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 4017b9eed1..8da7baad76 100644 --- a/target/arm/sve_helper.c +++ b/target/arm/sve_helper.c @@ -2109,3 +2109,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 f8d8cf1547..1517d82468 100644 --- a/target/arm/translate-sve.c +++ b/target/arm/translate-sve.c @@ -2681,6 +2681,19 @@ static bool trans_RBIT(DisasContext *s, arg_rpr_esz *a, uint32_t insn) return do_zpz_ool(s, a, fns[a->esz]); } +static bool trans_SPLICE(DisasContext *s, arg_rprr_esz *a, uint32_t insn) +{ + if (sve_access_check(s)) { + 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); + } + return true; +} + /* *** SVE Memory - 32-bit Gather and Unsized Contiguous Group */ diff --git a/target/arm/sve.decode b/target/arm/sve.decode index 95eb4968a9..a9fa631252 100644 --- a/target/arm/sve.decode +++ b/target/arm/sve.decode @@ -463,6 +463,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