From patchwork Thu Jun 21 01:53:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 139409 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp1473829lji; Wed, 20 Jun 2018 19:02:06 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIFTO06QX5i63NFbvtGommwpNMkRhKWqksstuS7FKQ0mi5jaDuSYNuAfb+auwYPHihvk5Qv X-Received: by 2002:a37:4792:: with SMTP id u140-v6mr19934213qka.100.1529546526827; Wed, 20 Jun 2018 19:02:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529546526; cv=none; d=google.com; s=arc-20160816; b=ZoITS/JgqRA71PSd0kkxJ+KWMFneLNT7CLBZjg++fKi0LYzaFxf7PtuCShC4MoPZie MMg0gol5hkd7COd9mveB3iTqaHyAISoP9fpgtD7NE7ajuVtBDp2pLeggbPwJQ4sPhyPt tkxg/93FtUv9xeQjhIFrqj5NiAeAqUH7hL0znjiUI3bmMh8qf42ry6oo3zokT0c9Eiut MCY5nf2KVmFK3ICbcOdKlonehKyrN+Nx8X6yCVCB6hHVlyjK9TVQxqKkZdzFGyqY9PJ4 AqmgTh8zSFOQoCjSU7mzUQA184A4y6MOp7RSGS7f4Pq4pTfitTZ0TGvvAffVpLKQvDL0 GRdg== 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=K/RaemtBMKMDMQiaXGvolQPI9idWFbIOOZMoovbxENI=; b=hNbFNOU1F8D3Hf3dG067NXqPEVOGDanv2ztUthaRcLS+400FfmMeITUBlG2VkSMfxc RG73bvq/C+heOvF6rZR3Lt1dLtcRI3UTcp5xhOX7aJzLLuJdtesvn6uhJE6H3i5rHE+L gcxBswVbZlICuz+HHFjWT9AzbSNKvWatnwnMUvFf+l5C3jlQU2IgCpeZCWLc0pRKqaiz ID4UE3zkW3XIcW0unHqvCmUt2GTBPHczmmlCjE3/eVKgiruy7sG3t3wYGQQndWPCvOf5 zon6d8T1NNO/HXxZcHFEHA1gdM0Lv3PXJwe0R/LlMXSJ7s1v3Mlicwfq/EMQiZbwPqSS KS+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Bn4ppvSG; 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 x9-v6si3734442qvh.260.2018.06.20.19.02.06 for (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 20 Jun 2018 19:02:06 -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=Bn4ppvSG; 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]:52519 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fVovG-0001TI-5D for patch@linaro.org; Wed, 20 Jun 2018 22:02:06 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39273) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fVonz-0004SA-E6 for qemu-devel@nongnu.org; Wed, 20 Jun 2018 21:54:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fVony-0003A3-Ax for qemu-devel@nongnu.org; Wed, 20 Jun 2018 21:54:35 -0400 Received: from mail-pl0-x22f.google.com ([2607:f8b0:400e:c01::22f]:45163) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fVony-00039Y-2c for qemu-devel@nongnu.org; Wed, 20 Jun 2018 21:54:34 -0400 Received: by mail-pl0-x22f.google.com with SMTP id o18-v6so58673pll.12 for ; Wed, 20 Jun 2018 18:54:33 -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=K/RaemtBMKMDMQiaXGvolQPI9idWFbIOOZMoovbxENI=; b=Bn4ppvSGM/GQJ+fdsN6FJSqINnqdxfomlfNFtdEPFvX6j8vaIWfaSV0WfGSb94E5mf GMpToHtkg/p0QpoSD4O3KVJuxvzvdoWNJ7DolkjH7GGeSG4kZzojqMdAucAVVXeHWhhf xfXytbP9mLaO3AQJiEbtq+1z9GWBjVWDMSSbA= 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=K/RaemtBMKMDMQiaXGvolQPI9idWFbIOOZMoovbxENI=; b=dpC0gt/X9j2HywNhlwUNsKuSB9P/d80OaNIbPm880aywP/pHBY5SoE/1xttYG8Bfb1 I32xzUzeGPP3cHxONxyTgoVad3Cnylyv4dhjXUdfLZfyItSGqFaEZ23bGLecn5tho1gl qSjViRYC3IvAF3BBCa0zmBMkW43yvc03LhgFB9GNu/rzZVqDlqPp515DwcP8VhmIszQE zK217qpLVKSTdgJkyuEiCP+033GsYb2aNG/gTDS2uy810uAZgI7uBz1oA/pdccRqHxao IX3OqKn6m0j9BvfhNenCaCKO2hxIHc28RB+nANfe9oFlX8jqSBx1xRI2fpUNxxVkNxRE fzNw== X-Gm-Message-State: APt69E3FHdg+oqKEnZT1menEJP+ClHXWJE34WSjBA3USWPdRbAcWppSi 7CzW93e3vWCek/gbeIaNUCmYl0XMF3M= X-Received: by 2002:a17:902:b217:: with SMTP id t23-v6mr26425520plr.312.1529546072766; Wed, 20 Jun 2018 18:54:32 -0700 (PDT) Received: from cloudburst.twiddle.net (mta-98-147-121-51.hawaii.rr.com. [98.147.121.51]) by smtp.gmail.com with ESMTPSA id a27-v6sm6187946pfc.18.2018.06.20.18.54.31 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 20 Jun 2018 18:54:31 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 20 Jun 2018 15:53:39 -1000 Message-Id: <20180621015359.12018-16-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180621015359.12018-1-richard.henderson@linaro.org> References: <20180621015359.12018-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::22f Subject: [Qemu-devel] [PATCH v5 15/35] target/arm: Implement SVE scatter store vector immediate 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-sve.c | 83 ++++++++++++++++++++++++++------------ target/arm/sve.decode | 11 +++++ 2 files changed, 69 insertions(+), 25 deletions(-) -- 2.17.1 Reviewed-by: Peter Maydell diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c index 11c1bf112c..fdc3231e63 100644 --- a/target/arm/translate-sve.c +++ b/target/arm/translate-sve.c @@ -4395,31 +4395,33 @@ static bool trans_LD1_zpiz(DisasContext *s, arg_LD1_zpiz *a, uint32_t insn) return true; } +/* Indexed by [xs][msz]. */ +static gen_helper_gvec_mem_scatter * const scatter_store_fn32[2][3] = { + { gen_helper_sve_stbs_zsu, + gen_helper_sve_sths_zsu, + gen_helper_sve_stss_zsu, }, + { gen_helper_sve_stbs_zss, + gen_helper_sve_sths_zss, + gen_helper_sve_stss_zss, }, +}; + +static gen_helper_gvec_mem_scatter * const scatter_store_fn64[3][4] = { + { gen_helper_sve_stbd_zsu, + gen_helper_sve_sthd_zsu, + gen_helper_sve_stsd_zsu, + gen_helper_sve_stdd_zsu, }, + { gen_helper_sve_stbd_zss, + gen_helper_sve_sthd_zss, + gen_helper_sve_stsd_zss, + gen_helper_sve_stdd_zss, }, + { gen_helper_sve_stbd_zd, + gen_helper_sve_sthd_zd, + gen_helper_sve_stsd_zd, + gen_helper_sve_stdd_zd, }, +}; + static bool trans_ST1_zprz(DisasContext *s, arg_ST1_zprz *a, uint32_t insn) { - /* Indexed by [xs][msz]. */ - static gen_helper_gvec_mem_scatter * const fn32[2][3] = { - { gen_helper_sve_stbs_zsu, - gen_helper_sve_sths_zsu, - gen_helper_sve_stss_zsu, }, - { gen_helper_sve_stbs_zss, - gen_helper_sve_sths_zss, - gen_helper_sve_stss_zss, }, - }; - static gen_helper_gvec_mem_scatter * const fn64[3][4] = { - { gen_helper_sve_stbd_zsu, - gen_helper_sve_sthd_zsu, - gen_helper_sve_stsd_zsu, - gen_helper_sve_stdd_zsu, }, - { gen_helper_sve_stbd_zss, - gen_helper_sve_sthd_zss, - gen_helper_sve_stsd_zss, - gen_helper_sve_stdd_zss, }, - { gen_helper_sve_stbd_zd, - gen_helper_sve_sthd_zd, - gen_helper_sve_stsd_zd, - gen_helper_sve_stdd_zd, }, - }; gen_helper_gvec_mem_scatter *fn; if (a->esz < a->msz || (a->msz == 0 && a->scale)) { @@ -4430,10 +4432,10 @@ static bool trans_ST1_zprz(DisasContext *s, arg_ST1_zprz *a, uint32_t insn) } switch (a->esz) { case MO_32: - fn = fn32[a->xs][a->msz]; + fn = scatter_store_fn32[a->xs][a->msz]; break; case MO_64: - fn = fn64[a->xs][a->msz]; + fn = scatter_store_fn64[a->xs][a->msz]; break; default: g_assert_not_reached(); @@ -4443,6 +4445,37 @@ static bool trans_ST1_zprz(DisasContext *s, arg_ST1_zprz *a, uint32_t insn) return true; } +static bool trans_ST1_zpiz(DisasContext *s, arg_ST1_zpiz *a, uint32_t insn) +{ + gen_helper_gvec_mem_scatter *fn = NULL; + TCGv_i64 imm; + + if (a->esz < a->msz) { + return false; + } + if (!sve_access_check(s)) { + return true; + } + + switch (a->esz) { + case MO_32: + fn = scatter_store_fn32[0][a->msz]; + break; + case MO_64: + fn = scatter_store_fn64[2][a->msz]; + break; + } + assert(fn != NULL); + + /* Treat ST1_zpiz (zn[x] + imm) the same way as ST1_zprz (rn + zm[x]) + * by loading the immediate into the scalar parameter. + */ + imm = tcg_const_i64(a->imm << a->msz); + do_mem_zpz(s, a->rd, a->pg, a->rn, 0, imm, fn); + tcg_temp_free_i64(imm); + return true; +} + /* * Prefetches */ diff --git a/target/arm/sve.decode b/target/arm/sve.decode index fb73a22c0e..311ae6dbdf 100644 --- a/target/arm/sve.decode +++ b/target/arm/sve.decode @@ -83,6 +83,7 @@ &rprr_gather_load rd pg rn rm esz msz u ff xs scale &rpri_gather_load rd pg rn imm esz msz u ff &rprr_scatter_store rd pg rn rm esz msz xs scale +&rpri_scatter_store rd pg rn imm esz msz ########################################################################### # Named instruction formats. These are generally used to @@ -215,6 +216,8 @@ &rprr_store nreg=0 @rprr_scatter_store ....... msz:2 .. rm:5 ... pg:3 rn:5 rd:5 \ &rprr_scatter_store +@rpri_scatter_store ....... msz:2 .. imm:5 ... pg:3 rn:5 rd:5 \ + &rpri_scatter_store ########################################################################### # Instruction patterns. Grouped according to the SVE encodingindex.xhtml. @@ -927,6 +930,14 @@ ST1_zprz 1110010 .. 01 ..... 101 ... ..... ..... \ ST1_zprz 1110010 .. 00 ..... 101 ... ..... ..... \ @rprr_scatter_store xs=2 esz=3 scale=0 +# SVE 64-bit scatter store (vector plus immediate) +ST1_zpiz 1110010 .. 10 ..... 101 ... ..... ..... \ + @rpri_scatter_store esz=3 + +# SVE 32-bit scatter store (vector plus immediate) +ST1_zpiz 1110010 .. 11 ..... 101 ... ..... ..... \ + @rpri_scatter_store esz=2 + # SVE 64-bit scatter store (scalar plus unpacked 32-bit scaled offset) # Require msz > 0 ST1_zprz 1110010 .. 01 ..... 100 ... ..... ..... \