From patchwork Mon Dec 18 17:45:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 122297 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp3170275qgn; Mon, 18 Dec 2017 10:26:25 -0800 (PST) X-Google-Smtp-Source: ACJfBos5aHKEuvFxBdWrHncX3O5SgRuFkK7yO7dU5LmRFhEFPo13nXGQaErgvEtLUSLHRb7/ouDT X-Received: by 10.37.164.40 with SMTP id f37mr579327ybi.437.1513621585153; Mon, 18 Dec 2017 10:26:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513621585; cv=none; d=google.com; s=arc-20160816; b=xmllE9NEQ3HgC0zp2iKZBCawZUHj4Mt/7am+IccpQ2u3yGDO7TJ3lwE0CA/H6Qq3RF CzCieYTS2IQXdPDYoVeDp8xExy41PanN9o1wZI6VJgELheCoQk+IIcDDSV7Ft5v1cEsC s4QWlujynltsolBs5oUMJRsa7MvJh2qRncRrGsFGLLNHgY1QVNlGyLbGVzAzuyUwLOCv 140WlHwPhhbvMnpRNVOnFZ/H6syW3ly5RaNYeWi/BeyT++KDYOCfFKQUomdWEDy8cpGf peX9xzY71zWKdn5NOeLlvaa9O+NJ42H0rQsRFgYXUuXegosHkVC69iIKuorNnVEJzCiU Fn+g== 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=79qaL/sSWdRs8yI9GhQnKs5bk8BLHvgB2DUy18WjB6U=; b=opUCGMdFoCyEWlgDZXOKyT6UFPjqlXUMXaAOxCD2nkrcBT8PpGuXuk3W9ogBZQvJaM vCNY0mDz+bN7Y844YHjDTcV/6DX+8FtkpYTkJCB+OBJl0Izlj+knINAhTFLpWTga38fX 5XuEPwMyZLkr2U5y1lmKeI4igbWGltemvI+zBw2WRDy7qOP8uSgu/jnRk47ncw/3U5zm JYJwyP97S40CBinRnDaabky4SZrfEtGp8Q9VNwErpy9k8fw5d+O908Wr7A587jhtNd9y pRtkmQEATr7wLRtvLvjqy+CDpu/24l0163ie4JqlcxEJsnCFs2cMu5rEnfaUQXpOpl7x 7lIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=kSvDTtrF; 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 n132si1093114yba.138.2017.12.18.10.26.25 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 18 Dec 2017 10:26:25 -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=kSvDTtrF; 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]:44125 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eR07M-0006zf-Jb for patch@linaro.org; Mon, 18 Dec 2017 13:26:24 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55936) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eQzUd-0008OJ-P2 for qemu-devel@nongnu.org; Mon, 18 Dec 2017 12:46:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eQzUc-0002DS-IO for qemu-devel@nongnu.org; Mon, 18 Dec 2017 12:46:23 -0500 Received: from mail-pg0-x241.google.com ([2607:f8b0:400e:c05::241]:34081) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eQzUc-0002Cn-Af for qemu-devel@nongnu.org; Mon, 18 Dec 2017 12:46:22 -0500 Received: by mail-pg0-x241.google.com with SMTP id j4so9441910pgp.1 for ; Mon, 18 Dec 2017 09:46:22 -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=79qaL/sSWdRs8yI9GhQnKs5bk8BLHvgB2DUy18WjB6U=; b=kSvDTtrFI+o8qyQfGxKP/S1D7BPPXJBSaLLHY0BOZO1klfgH41L804x2HIyRvKFoJF CONuczPevtr9DIHUZRv4KuuvqwBL7tVGJvUmriQwyIRJn81ZPkXNBi7jeJ1pW/u9klIX 3KopfZDKy1c/FwvUHKw3fpG3KDKP55MKtZskg= 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=79qaL/sSWdRs8yI9GhQnKs5bk8BLHvgB2DUy18WjB6U=; b=CcOymnnH6SAHZryHc/j1mqOgRZKmBaaSR9u4SCX7ofD0ej1OYEHccoLnwrEhDqJcVV AZMFUZNTGkXyew+HDcR4OGRQ+o5HQM/QvAW0q0Iio3sN4Tccr7ajsr48YV/s/9B3uHBs GvnVVt9e1TEnN54CIhr4GrZQFr8EdHvwEL7Z+1oVd1I6o/kphirJBrN28mk6usWp7lap ENnvGjXoYHHjIrC2NQvm+yq8aPpVP+7H7nJcq0v9f4mz6QNKnCC7+NFRoq/xq8G6u4H0 24qcSh52XxhzWHY3B21fH8ccnAyAxSJfEzoEoU06PZnqzrBEyVfCYL4IXb2OZBjPs7Fy DYoQ== X-Gm-Message-State: AKGB3mI+RVZhn38Pd+FieQkJeNtiBGw/7E3PVMm0MrzWw+NT6ag6aCPi UgmpkYrHc+kj33XzhnqMNJNu5pQdno0= X-Received: by 10.101.66.136 with SMTP id j8mr429452pgp.78.1513619180991; Mon, 18 Dec 2017 09:46:20 -0800 (PST) Received: from cloudburst.twiddle.net (174-21-7-63.tukw.qwest.net. [174.21.7.63]) by smtp.gmail.com with ESMTPSA id t84sm26209657pfe.160.2017.12.18.09.46.19 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 18 Dec 2017 09:46:20 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Mon, 18 Dec 2017 09:45:46 -0800 Message-Id: <20171218174552.18871-18-richard.henderson@linaro.org> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20171218174552.18871-1-richard.henderson@linaro.org> References: <20171218174552.18871-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::241 Subject: [Qemu-devel] [PATCH 17/23] target/arm: Implement SVE Index Generation 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, qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Richard Henderson --- target/arm/helper-sve.h | 5 ++++ target/arm/sve_helper.c | 40 ++++++++++++++++++++++++++++++ target/arm/translate-sve.c | 62 ++++++++++++++++++++++++++++++++++++++++++++++ target/arm/sve.def | 14 +++++++++++ 4 files changed, 121 insertions(+) -- 2.14.3 diff --git a/target/arm/helper-sve.h b/target/arm/helper-sve.h index abed625123..c8eae5eb62 100644 --- a/target/arm/helper-sve.h +++ b/target/arm/helper-sve.h @@ -357,6 +357,11 @@ DEF_HELPER_FLAGS_6(sve_mls_s, TCG_CALL_NO_RWG, DEF_HELPER_FLAGS_6(sve_mls_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_4(sve_index_b, TCG_CALL_NO_RWG, void, ptr, i32, i32, i32) +DEF_HELPER_FLAGS_4(sve_index_h, TCG_CALL_NO_RWG, void, ptr, i32, i32, i32) +DEF_HELPER_FLAGS_4(sve_index_s, TCG_CALL_NO_RWG, void, ptr, i32, i32, i32) +DEF_HELPER_FLAGS_4(sve_index_d, TCG_CALL_NO_RWG, void, ptr, i64, i64, i32) + DEF_HELPER_FLAGS_5(sve_and_pred, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_5(sve_bic_pred, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_5(sve_eor_pred, 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 8235784a82..d8684b9457 100644 --- a/target/arm/sve_helper.c +++ b/target/arm/sve_helper.c @@ -913,6 +913,46 @@ DO_ZPZZZ_D(sve_mls_d, uint64_t, DO_MLS) #undef DO_ZPZZZ #undef DO_ZPZZZ_D +void HELPER(sve_index_b)(void *vd, uint32_t start, + uint32_t incr, uint32_t desc) +{ + intptr_t i, opr_sz = simd_oprsz(desc); + uint8_t *d = vd; + for (i = 0; i < opr_sz; i += 1) { + d[H1(i)] = start + i * incr; + } +} + +void HELPER(sve_index_h)(void *vd, uint32_t start, + uint32_t incr, uint32_t desc) +{ + intptr_t i, opr_sz = simd_oprsz(desc) / 2; + uint16_t *d = vd; + for (i = 0; i < opr_sz; i += 1) { + d[H2(i)] = start + i * incr; + } +} + +void HELPER(sve_index_s)(void *vd, uint32_t start, + uint32_t incr, uint32_t desc) +{ + intptr_t i, opr_sz = simd_oprsz(desc) / 4; + uint32_t *d = vd; + for (i = 0; i < opr_sz; i += 1) { + d[H4(i)] = start + i * incr; + } +} + +void HELPER(sve_index_d)(void *vd, uint64_t start, + uint64_t incr, uint32_t desc) +{ + intptr_t i, opr_sz = simd_oprsz(desc) / 8; + uint64_t *d = vd; + for (i = 0; i < opr_sz; i += 1) { + d[i] = start + i * incr; + } +} + void HELPER(sve_ldr)(CPUARMState *env, void *d, target_ulong addr, uint32_t len) { intptr_t i, len_align = QEMU_ALIGN_DOWN(len, 8); diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c index 7edec8ba96..7e1bf7d623 100644 --- a/target/arm/translate-sve.c +++ b/target/arm/translate-sve.c @@ -577,6 +577,68 @@ DO_ZPZZZ(MLS, mls) #undef DO_ZPZZZ +static void do_index(DisasContext *s, int esz, int rd, + TCGv_i64 start, TCGv_i64 incr) +{ + unsigned vsz = size_for_gvec(vec_full_reg_size(s)); + TCGv_i32 desc = tcg_const_i32(simd_desc(vsz, vsz, 0)); + TCGv_ptr t_zd = tcg_temp_new_ptr(); + + tcg_gen_addi_ptr(t_zd, cpu_env, vec_full_reg_offset(s, rd)); + if (esz == 3) { + gen_helper_sve_index_d(t_zd, start, incr, desc); + } else { + static void (*fns[3])(TCGv_ptr, TCGv_i32, TCGv_i32, TCGv_i32) = { + gen_helper_sve_index_b, + gen_helper_sve_index_h, + gen_helper_sve_index_s, + }; + TCGv_i32 s32 = tcg_temp_new_i32(); + TCGv_i32 i32 = tcg_temp_new_i32(); + + tcg_gen_extrl_i64_i32(s32, start); + tcg_gen_extrl_i64_i32(i32, incr); + fns[esz](t_zd, s32, i32, desc); + + tcg_temp_free_i32(s32); + tcg_temp_free_i32(i32); + } + tcg_temp_free_ptr(t_zd); + tcg_temp_free_i32(desc); +} + +void trans_INDEX_ii(DisasContext *s, arg_INDEX_ii *a, uint32_t insn) +{ + TCGv_i64 start = tcg_const_i64(a->imm1); + TCGv_i64 incr = tcg_const_i64(a->imm2); + do_index(s, a->esz, a->rd, start, incr); + tcg_temp_free_i64(start); + tcg_temp_free_i64(incr); +} + +void trans_INDEX_ir(DisasContext *s, arg_INDEX_ir *a, uint32_t insn) +{ + TCGv_i64 start = tcg_const_i64(a->imm); + TCGv_i64 incr = cpu_reg(s, a->rm); + do_index(s, a->esz, a->rd, start, incr); + tcg_temp_free_i64(start); +} + +void trans_INDEX_ri(DisasContext *s, arg_INDEX_ri *a, uint32_t insn) +{ + TCGv_i64 start = cpu_reg(s, a->rn); + TCGv_i64 incr = tcg_const_i64(a->imm); + do_index(s, a->esz, a->rd, start, incr); + tcg_temp_free_i64(incr); +} + +void trans_INDEX_rr(DisasContext *s, arg_INDEX_rr *a, uint32_t insn) +{ + TCGv_i64 start = cpu_reg(s, a->rn); + TCGv_i64 incr = cpu_reg(s, a->rm); + do_index(s, a->esz, a->rd, start, incr); +} + static uint64_t pred_esz_mask[4] = { 0xffffffffffffffffull, 0x5555555555555555ull, 0x1111111111111111ull, 0x0101010101010101ull diff --git a/target/arm/sve.def b/target/arm/sve.def index a33fec4f33..0cac3a974f 100644 --- a/target/arm/sve.def +++ b/target/arm/sve.def @@ -204,6 +204,20 @@ ORR_zzz 00000100 01 1 ..... 001 100 ..... ..... @rd_rn_rm EOR_zzz 00000100 10 1 ..... 001 100 ..... ..... @rd_rn_rm BIC_zzz 00000100 11 1 ..... 001 100 ..... ..... @rd_rn_rm +### SVE Index Generation Group + +# SVE index generation (immediate start, immediate increment) +INDEX_ii 00000100 esz:2 1 imm2:s5 010000 imm1:s5 rd:5 + +# SVE index generation (immediate start, register increment) +INDEX_ir 00000100 esz:2 1 rm:5 010010 imm:s5 rd:5 + +# SVE index generation (register start, immediate increment) +INDEX_ri 00000100 esz:2 1 imm:s5 010001 rn:5 rd:5 + +# SVE index generation (register start, register increment) +INDEX_rr 00000100 .. 1 ..... 010011 ..... ..... @rd_rn_rm_esz + ### SVE Predicate Generation Group # SVE initialize predicate (PTRUE, PTRUES)