From patchwork Sat Feb 17 18:23:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 128738 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp1858196ljc; Sat, 17 Feb 2018 11:31:19 -0800 (PST) X-Google-Smtp-Source: AH8x226oB8omnAZbXiTrmlu4TahBv1Vak/qKEB5IdnyYjP7C8MnrZqwFuMECj/2NijST08ox47Hx X-Received: by 10.129.128.67 with SMTP id q64mr7522914ywf.376.1518895879015; Sat, 17 Feb 2018 11:31:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518895879; cv=none; d=google.com; s=arc-20160816; b=YIXOyYL7Lu7UKpiWtBS62z7LsaX0WD4q0S427mooU+zxWBoAUwLKtRsc5EhgxAjdNj i00KhK9iwaifLzBcEHvLEs7HzvfE98Uc72TYubdrrqgZ5fRxwgu0LBJYr42ti0bWzOfH +9SaPjiVjo/Heo2EGGR2VzT4tafLpXTtFf9eZfEhhbJ0vsnclHvJnO2A/sj89wJEUTRs 4R3YYop7QDIv8FwZScmmUOfopsom+zIT7cl3ceieT1ijQhlBz2/d+b49RC0aew4JiY/j N8fX0txxeF+jrlBVhhL0R0XOdAWzLUQWEEC2y0Ef+M1a91hQ0qrzwFhQaAzQ9DoO9VvY cRLw== 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=6iBAAbIc0nm8fljouk+VAtJA8NE1VxP/6Uk4XqY2ALY=; b=EBVuDb4MkBdZKRcCF2rnF4cMCec3tJi1xeq5sDmNrDJRykVeG5H2ziBmNCFFvA8N9K Nk/4HbVURBKM0tI/mXuNC7YkDOdS9TBgJFXkZGOskyyDfjGFBpmKY7f75inUEkqAlzvR 5EjzzIU7f+0c4BBrV04oYY33lu0hDHfwJQ+Ea0nc8zLLWvpe1RWckMTn/AwRRlxozjGK Dfvy30nfpvuIHYFm+J/mtTEmLnQBH5idhBhDrNDmnYpIFkkJvRxhPEcr5DvnFVn0vf84 qhpty6hIZNamMwNVjX+34LfsXrwlQxAPyYqrwyhqKHmo8MAervF3sKW9ATWRjB3W5qep GhpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=bQsteFdJ; 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 k124si3572700ywb.556.2018.02.17.11.31.18 for (version=TLS1 cipher=AES128-SHA bits=128/128); Sat, 17 Feb 2018 11:31:19 -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=bQsteFdJ; 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]:50773 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1en8Cc-0000M9-62 for patch@linaro.org; Sat, 17 Feb 2018 14:31:18 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40867) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1en7AQ-0001gq-6k for qemu-devel@nongnu.org; Sat, 17 Feb 2018 13:25:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1en7AO-0002CF-Ua for qemu-devel@nongnu.org; Sat, 17 Feb 2018 13:24:58 -0500 Received: from mail-pl0-x243.google.com ([2607:f8b0:400e:c01::243]:45437) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1en7AO-0002C4-Me for qemu-devel@nongnu.org; Sat, 17 Feb 2018 13:24:56 -0500 Received: by mail-pl0-x243.google.com with SMTP id p5so3429097plo.12 for ; Sat, 17 Feb 2018 10:24:56 -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=6iBAAbIc0nm8fljouk+VAtJA8NE1VxP/6Uk4XqY2ALY=; b=bQsteFdJvY671q2PALBpD3G4VVdIP0C0wcHJJ4m0VEPbrtH2lOA6Zf1imZNajZFqCA Q2PtAQaa00CaJNHPIuqSzaio26WDT3AVoFWbl+K06Bz2ZRRBrHu7HhxjTrON1FkO4Nly ajvjiycfrYGfbms2GB42To+oQCFBC/e44OxN8= 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=6iBAAbIc0nm8fljouk+VAtJA8NE1VxP/6Uk4XqY2ALY=; b=oFlcGXzfThhhp7w2N1Pde83sJdQevJG+faKbUmTEjqT4ifU8vuKCVfCZgScqbeNFt4 umiKFEC5lkyPf898gwYRE1D+Il0vyOITW6r3NYbfgk7I9hOE7sRj/qx45uJZ31nxdOPF uoVr8Y9Vj4mdIG94koGyHvBVXV/2+I0n8cBngWec4IMOKSFi1ckEloSMavqYm4dEOPyy 1Uy1lTkTPLzR+t1Y1wzw1JAgLPRCthZJKg15oRi0hr7/G0w+Bqr9ISlEWy3R4ZxMDS65 jrU+xa9Cte6fIm+7tWMTBgk0IbYNBwadjtoO1DmeBvCuan7XeG97t/GmGTJ5RvELPfPu 2m+g== X-Gm-Message-State: APf1xPBApxbr9Dm32zuzb40SMEnD3gU1jNuxGScCxslV5m05ARfu9Sln K6p2/tjA+UIcNBAIwIqg4CojvXTQCRM= X-Received: by 2002:a17:902:6ac2:: with SMTP id i2-v6mr1484963plt.368.1518891895405; Sat, 17 Feb 2018 10:24:55 -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.53 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 17 Feb 2018 10:24:54 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Sat, 17 Feb 2018 10:23:12 -0800 Message-Id: <20180217182323.25885-57-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:c01::243 Subject: [Qemu-devel] [PATCH v2 56/67] 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: qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Richard Henderson --- target/arm/translate-sve.c | 79 +++++++++++++++++++++++++++++++--------------- target/arm/sve.decode | 11 +++++++ 2 files changed, 65 insertions(+), 25 deletions(-) -- 2.14.3 Reviewed-by: Peter Maydell diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c index 6484ecd257..0241e8e707 100644 --- a/target/arm/translate-sve.c +++ b/target/arm/translate-sve.c @@ -4011,31 +4011,33 @@ static void trans_LD1_zpiz(DisasContext *s, arg_LD1_zpiz *a, uint32_t insn) tcg_temp_free_i64(imm); } +/* 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 void 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)) { @@ -4044,10 +4046,10 @@ static void 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(); @@ -4056,6 +4058,33 @@ static void trans_ST1_zprz(DisasContext *s, arg_ST1_zprz *a, uint32_t insn) cpu_reg_sp(s, a->rn), fn); } +static void 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) { + unallocated_encoding(s); + return; + } + + 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); +} + /* * Prefetches */ diff --git a/target/arm/sve.decode b/target/arm/sve.decode index f85d82e009..6ccb4289fc 100644 --- a/target/arm/sve.decode +++ b/target/arm/sve.decode @@ -84,6 +84,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 @@ -216,6 +217,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. @@ -935,6 +938,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 ... ..... ..... \