From patchwork Wed Jun 27 04:33:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 140101 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp389392ljj; Tue, 26 Jun 2018 21:44:03 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdwWmK0EwmIGpw6rmpAH7SNpCHGCTtQVRytu1oVk1gmSQ91N878hogrRHkubZ8dwZrNtVLH X-Received: by 2002:a37:16c3:: with SMTP id 64-v6mr3912324qkw.381.1530074643245; Tue, 26 Jun 2018 21:44:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530074643; cv=none; d=google.com; s=arc-20160816; b=lLbdR21f5uXrp6YwtebCDnp+kWsCLySoRyTMDP28CqtZr8+4rkWpWb2CeorIQYNO0v yiqZW8aw7HoobAhU16Tq9SnfdqeMO0ABaoluFJ6Oumz1ThmmtgKaEkb59bR7AMS9rwso wAsQLi+cRviJroNRZAMa4J/xL7DuD6g0/DH6hXetpXY9YCkRJGLbO5UdKZWYeDU5vP8w jPIymYCj1uKdJn4BCZM1EzIwK/E5xwZzAGr2BHS1RrypAD/n8OdQyqONML+09u47da/h QvUWx/bpIRDsweb7LqXp/PaPHBNsLK5h4Gf7cBEYO8glB5pMN6IdaanOLQ7hJBH21pPO g2lg== 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=dhB8ii/GaM/P1LrIoAgJ5HoWXCaUKMDijHadhOvMSUc=; b=VDkx5JdqdA6dIw4d4mT0TCwwblTkRXaA8A4AklPy4TCrB9Emo9MRdRU0eEj15e08ur 3+j0GUT4nLzc1mqTULgfTo+KBvW+kyB2b6cDpOANpDq5rNEXBTwQsBb9Eb95yP9yfA5a qjWVl454mLgdwJEJxsRI76kiyRNPpHQGcKWIdBBRrnrB16iKmzqeUsIeX/jAbpwIKtA+ TyPicx7lLRs5dY3BHqaAGgczvCb2vgc8rPuUEwU2AnqB7NdjH6rlbUdObHkkGhixy4rj aIMQ76W8yT15XpvHfF6bViz/A9xYbPy44yBS5EG2X7zubGWEo07j+Cpm9XiFTXKfOF0C UrSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=OTrEyJvG; 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 95-v6si2531120qkq.198.2018.06.26.21.44.03 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 26 Jun 2018 21:44:03 -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=OTrEyJvG; 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]:56531 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fY2JG-0003Gu-J5 for patch@linaro.org; Wed, 27 Jun 2018 00:44:02 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60558) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fY29U-0004JV-RU for qemu-devel@nongnu.org; Wed, 27 Jun 2018 00:33:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fY29R-0000aZ-Rc for qemu-devel@nongnu.org; Wed, 27 Jun 2018 00:33:56 -0400 Received: from mail-pg0-x236.google.com ([2607:f8b0:400e:c05::236]:38669) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fY29R-0000Z5-GQ for qemu-devel@nongnu.org; Wed, 27 Jun 2018 00:33:53 -0400 Received: by mail-pg0-x236.google.com with SMTP id c9-v6so365769pgf.5 for ; Tue, 26 Jun 2018 21:33:53 -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=dhB8ii/GaM/P1LrIoAgJ5HoWXCaUKMDijHadhOvMSUc=; b=OTrEyJvGApnT5jQ64CAc0Q3i0rfOuVYF4Ou1BBEtyCAS43+bORzUUSmUjkvxDlR/Yw BZf2iQSD8anGq3u6fMWfv7LGJahtn4hoFFBC6L+7j97PZzrUQmMHNMLOAXNn0g9225Ut Q9bCXT4SxiYsHCbH+JSwxHP6dRNyoskLlMm9Y= 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=dhB8ii/GaM/P1LrIoAgJ5HoWXCaUKMDijHadhOvMSUc=; b=W1wdQE59UAy7yeMUGmTd6kGLmkkIKtCMpze2JWT+xwsXgihkoix2EqIpNb0x30hwbk S9iGyfi2+7Iuya7nGnICEJcrV58PAoLo+rJ1zRM8choq4My5GTKNRPScn7Pc+UBARLD8 /PW11Jh0JXC8NfGT8SUlJHYlU8afqPdoQC2MXslpbdzbyEzss6RFvDB8d43oK+d2M+sF t2VxoV2850sjw43vfR5BUNzeGlHGI8MncTyQ3ataGvqIEQTrd6rq5o4nPUfv8pCykLq1 psL5zaKihJy8ruEy+QL2GO2Gf4NV+UV0D4KROKHDm8A58Ajy1i/hhC3mutjcufPgidol bGcw== X-Gm-Message-State: APt69E1+Wr9838NOVMDMbzjOGdf5A1pw5+Y10G5y6v6XDAoSHsF8JS08 oSk+Pgd8VtU4zonFJu5+Q9n6N35uW68= X-Received: by 2002:a63:6501:: with SMTP id z1-v6mr3747234pgb.452.1530074032199; Tue, 26 Jun 2018 21:33:52 -0700 (PDT) Received: from cloudburst.twiddle.net (97-126-112-211.tukw.qwest.net. [97.126.112.211]) by smtp.gmail.com with ESMTPSA id p20-v6sm4577638pff.90.2018.06.26.21.33.50 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 26 Jun 2018 21:33:51 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Tue, 26 Jun 2018 21:33:08 -0700 Message-Id: <20180627043328.11531-16-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180627043328.11531-1-richard.henderson@linaro.org> References: <20180627043328.11531-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::236 Subject: [Qemu-devel] [PATCH v6 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, qemu-arm@nongnu.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/translate-sve.c | 85 ++++++++++++++++++++++++++------------ target/arm/sve.decode | 11 +++++ 2 files changed, 70 insertions(+), 26 deletions(-) -- 2.17.1 diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c index ea4407b746..9eb2530d3b 100644 --- a/target/arm/translate-sve.c +++ b/target/arm/translate-sve.c @@ -4391,32 +4391,34 @@ 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, }, +}; + +/* Note that we overload xs=2 to indicate 64-bit offset. */ +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, }, - }; - /* Note that we overload xs=2 to indicate 64-bit offset. */ - 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)) { @@ -4427,10 +4429,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(); @@ -4440,6 +4442,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 45016c6042..75133ce659 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 @@ -219,6 +220,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. @@ -932,6 +935,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 ... ..... ..... \