From patchwork Wed Jun 13 01:56:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 138397 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp107897lji; Tue, 12 Jun 2018 19:12:15 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIDrEfVPML3PLhilLzNGiXsT+lGY0c9qp50wDKPF9Mqo1qj+wzDsZ1vdYrEh5A8A7eUzmXh X-Received: by 2002:aed:38c2:: with SMTP id k60-v6mr2745863qte.171.1528855935393; Tue, 12 Jun 2018 19:12:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528855935; cv=none; d=google.com; s=arc-20160816; b=PZWxckaSnHhKINzYY1B2b1eP4L+ahEeV6AZ0TfyE6aKHlIByx0syJ51YowK+KqyOuB 7Y0xTdUVX3KcAb5ZJHDsXvAPXGrp0pVPpTtUtLdS2xcnO74i/r2oZ+OaVs4fwpmqRls/ I2rz1h6EJEg84a2d9vIc2IzfIYj+RPhxEY7kOuFrv/klRFxM7TRPprLBccee4o08vO0S gJWp3IMW2J9AHzfPc2Le4TdUY3QhehdwtIzJmlISU3N+jkV937x4/AKkyC/uYmfd85OV SoOsCYccil/lyxyyIctvWz9blNpmilRAFX9r5s6rTPiBfq249paThO65EY9oBMkfdwNa y6Lw== 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=JrUBGULR193RsfcxMikDjaM1qj6AR2n7mIFladBHOpY=; b=lqN3xn5FdqytR0TRU8YIZERegdPzGfCERsBDAHW0FmLAzRPVz4GkycAkMbc9MChsWc XB9Sy+jjDr6SETMtSwBE/wkD18Nu3x0HiCbkMQNqesFS7xP+UpaEcC6QTY3ckT7OfQ5Q 9Yel4XPnqJQic/o4qYGQWZNsmGpjjWBMQALAaQjAsNnwfFi/PbTYL59svc145NB1RyAG 8aa0zGz0WsxMQWF8TXDqKhiWotNqc269Pw2tYtg1ChOCaQVCkV00py4P+yPGbGPCf4pY fTRAye3t5sKG7uBbNS6knhSfj7A2UZjMsOQ8tlJsMRPzoPcMcawXCrZf8w1Qu9EfGz4n 12Vw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=fmfa6MQr; 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 a17-v6si1515321qth.378.2018.06.12.19.12.15 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 12 Jun 2018 19:12:15 -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=fmfa6MQr; 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]:59355 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fSvGg-0006NS-LT for patch@linaro.org; Tue, 12 Jun 2018 22:12:14 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44091) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fSv2D-0002OT-O8 for qemu-devel@nongnu.org; Tue, 12 Jun 2018 21:57:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fSv2C-0006Hc-JM for qemu-devel@nongnu.org; Tue, 12 Jun 2018 21:57:17 -0400 Received: from mail-pg0-x22e.google.com ([2607:f8b0:400e:c05::22e]:46249) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fSv2C-0006HO-B8 for qemu-devel@nongnu.org; Tue, 12 Jun 2018 21:57:16 -0400 Received: by mail-pg0-x22e.google.com with SMTP id d2-v6so449201pga.13 for ; Tue, 12 Jun 2018 18:57:16 -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=JrUBGULR193RsfcxMikDjaM1qj6AR2n7mIFladBHOpY=; b=fmfa6MQr/Z/KBZ8JUAdE1bGGa5mg49wgvu/jO0uvwQVX38nTsv+wSMY0lwc30nf+Uk 7tIOlHSKpEgxOA9lEZE3WaetzwT2AkVIHy09y9rmBEVCeILfCOF71lFeQeKhoATVj8Pe xXyJDseWy6Mhx8H5oHNiSYfjPNW/Ntq/28WsM= 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=JrUBGULR193RsfcxMikDjaM1qj6AR2n7mIFladBHOpY=; b=iL4Ad+WdQcgzD0sd19UjCTUkmLYoNxHrQB+lBvN/nA76jnkpFXClnslgcTtg5UKvp3 Db8NjtYQqy7PLhAM2P34G+t6TTU71UGQSAg7oga357ELEjPznEJqfsBzTGFwWvLrQj64 PRHk6qR1aZXXUYxhYGSCFFUY5QjMS+AL9cBc7kYiXhZdR/brgTZqB4lqHGvU3Hcovt+5 GfFC4+eMO7yrXFqVF676DvXOAYdau5Xc/QtCClEp+UJ6A0GHdOEdUh2mYxF+tluPWdDi mOMJuwfwXPbRk3DvhYZFkjshb5Y2ExCuSdl9D8B6a9GWIlc6H9j1b+LWhL7Eeh422PMp CWxA== X-Gm-Message-State: APt69E2X4oBRb2RaTcJ6HYIA4/Apu6wIg/uWPAHhy6fE0O3eM/0mGsYj RMUpuEmJ6U/p6CJIzodxPDZQjJePFjw= X-Received: by 2002:a63:3f42:: with SMTP id m63-v6mr2420346pga.340.1528855035032; Tue, 12 Jun 2018 18:57:15 -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.12 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 12 Jun 2018 18:57:14 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Tue, 12 Jun 2018 15:56:33 -1000 Message-Id: <20180613015641.5667-11-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:c05::22e Subject: [Qemu-devel] [PATCH v4b 10/18] target/arm: Implement SVE Select Vectors Group 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 | 9 +++++++ target/arm/sve_helper.c | 55 ++++++++++++++++++++++++++++++++++++++ target/arm/translate-sve.c | 2 ++ target/arm/sve.decode | 6 +++++ 4 files changed, 72 insertions(+) -- 2.17.1 diff --git a/target/arm/helper-sve.h b/target/arm/helper-sve.h index c3f8a2b502..0f57f64895 100644 --- a/target/arm/helper-sve.h +++ b/target/arm/helper-sve.h @@ -195,6 +195,15 @@ DEF_HELPER_FLAGS_5(sve_lsl_zpzz_s, TCG_CALL_NO_RWG, DEF_HELPER_FLAGS_5(sve_lsl_zpzz_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_5(sve_sel_zpzz_b, TCG_CALL_NO_RWG, + void, ptr, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_5(sve_sel_zpzz_h, TCG_CALL_NO_RWG, + void, ptr, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_5(sve_sel_zpzz_s, TCG_CALL_NO_RWG, + void, ptr, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_5(sve_sel_zpzz_d, TCG_CALL_NO_RWG, + void, ptr, ptr, ptr, ptr, i32) + DEF_HELPER_FLAGS_5(sve_asr_zpzw_b, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_5(sve_asr_zpzw_h, TCG_CALL_NO_RWG, diff --git a/target/arm/sve_helper.c b/target/arm/sve_helper.c index 8da7baad76..f55fdc7dbe 100644 --- a/target/arm/sve_helper.c +++ b/target/arm/sve_helper.c @@ -2146,3 +2146,58 @@ void HELPER(sve_splice)(void *vd, void *vn, void *vm, void *vg, uint32_t desc) } swap_memmove(vd + len, vm, opr_sz * 8 - len); } + +void HELPER(sve_sel_zpzz_b)(void *vd, void *vn, void *vm, + void *vg, uint32_t desc) +{ + intptr_t i, opr_sz = simd_oprsz(desc) / 8; + uint64_t *d = vd, *n = vn, *m = vm; + uint8_t *pg = vg; + + for (i = 0; i < opr_sz; i += 1) { + uint64_t nn = n[i], mm = m[i]; + uint64_t pp = expand_pred_b(pg[H1(i)]); + d[i] = (nn & pp) | (mm & ~pp); + } +} + +void HELPER(sve_sel_zpzz_h)(void *vd, void *vn, void *vm, + void *vg, uint32_t desc) +{ + intptr_t i, opr_sz = simd_oprsz(desc) / 8; + uint64_t *d = vd, *n = vn, *m = vm; + uint8_t *pg = vg; + + for (i = 0; i < opr_sz; i += 1) { + uint64_t nn = n[i], mm = m[i]; + uint64_t pp = expand_pred_h(pg[H1(i)]); + d[i] = (nn & pp) | (mm & ~pp); + } +} + +void HELPER(sve_sel_zpzz_s)(void *vd, void *vn, void *vm, + void *vg, uint32_t desc) +{ + intptr_t i, opr_sz = simd_oprsz(desc) / 8; + uint64_t *d = vd, *n = vn, *m = vm; + uint8_t *pg = vg; + + for (i = 0; i < opr_sz; i += 1) { + uint64_t nn = n[i], mm = m[i]; + uint64_t pp = expand_pred_s(pg[H1(i)]); + d[i] = (nn & pp) | (mm & ~pp); + } +} + +void HELPER(sve_sel_zpzz_d)(void *vd, void *vn, void *vm, + void *vg, uint32_t desc) +{ + intptr_t i, opr_sz = simd_oprsz(desc) / 8; + uint64_t *d = vd, *n = vn, *m = vm; + uint8_t *pg = vg; + + for (i = 0; i < opr_sz; i += 1) { + uint64_t nn = n[i], mm = m[i]; + d[i] = (pg[H1(i)] & 1 ? nn : mm); + } +} diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c index 1517d82468..0de9118fdf 100644 --- a/target/arm/translate-sve.c +++ b/target/arm/translate-sve.c @@ -373,6 +373,8 @@ static bool trans_UDIV_zpzz(DisasContext *s, arg_rprr_esz *a, uint32_t insn) return do_zpzz_ool(s, a, fns[a->esz]); } +DO_ZPZZ(SEL, sel) + #undef DO_ZPZZ /* diff --git a/target/arm/sve.decode b/target/arm/sve.decode index a9fa631252..91522d8e13 100644 --- a/target/arm/sve.decode +++ b/target/arm/sve.decode @@ -98,6 +98,7 @@ &rprr_esz rn=%reg_movprfx @rdm_pg_rn ........ esz:2 ... ... ... pg:3 rn:5 rd:5 \ &rprr_esz rm=%reg_movprfx +@rd_pg4_rn_rm ........ esz:2 . rm:5 .. pg:4 rn:5 rd:5 &rprr_esz # Three register operand, with governing predicate, vector element size @rda_pg_rn_rm ........ esz:2 . rm:5 ... pg:3 rn:5 rd:5 \ @@ -466,6 +467,11 @@ RBIT 00000101 .. 1001 11 100 ... ..... ..... @rd_pg_rn # SVE vector splice (predicated) SPLICE 00000101 .. 101 100 100 ... ..... ..... @rdn_pg_rm +### SVE Select Vectors Group + +# SVE select vector elements (predicated) +SEL_zpzz 00000101 .. 1 ..... 11 .... ..... ..... @rd_pg4_rn_rm + ### SVE Predicate Logical Operations Group # SVE predicate logical operations