From patchwork Sat Feb 17 18:22:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 128689 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp1825977ljc; Sat, 17 Feb 2018 10:40:10 -0800 (PST) X-Google-Smtp-Source: AH8x2257L5k/CgtAyzd+rcthLxFSbmCmstqArFguX96JCygH0jLnymrlLfyoCutoWMCVPmdJZftY X-Received: by 10.129.161.66 with SMTP id y63mr6310295ywg.403.1518892810645; Sat, 17 Feb 2018 10:40:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518892810; cv=none; d=google.com; s=arc-20160816; b=qdo0zi84XFGIeyxPwmkQe4qvVz0TLiuJna+4bkE3HzHld8Ba172MeohZtWMcY6N534 Jwn53lT+7I4SaCmZQRI4doR5Ma9f2R2o+V1OUcSu/vcjCHWB0XUa7XMHb9wZAR3rUFCL vq3w/rraw8JbZGPZX8pexUeAc23jDJBKuahq7bRhzjlkBP9iNnXnwkCuGaMT5zBMqdRI C/EOB+FDgthZdOtZYLtML39iwGtz3MCWZHLACY754PO6i7+ItJ2aOmMxXjsNnltK1xS0 8NY8YilWilWtQqdk2RHL0dkM0187Hts5ohPpLDGs05wtXq51W5l3h0Ac/NhhaxuADbBD 5Dcg== 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=qUivDrBs/deC0vPF+CXEPEAAPcV9POzH7MV2Tc4RKIU=; b=MJctzsP1LsGrUGl9YJtIOEk17GJIUIavRQLipDNPrDdrP2bV5d9K4Y4s81pgC69HhI apcXXrtgQiUh/3M7Fyl8xLj8cxHPsNNDuzA3KGfnVE8hZjYyQ2OiJkTrEjG/WKVrtJ3V SYMFOkGOBnNXwhKgO2lIfLigZq4cS5sNX5Qa+6rZRgyyG69RZORRtBw6xArAZhRZnhX5 UlxjGDLBf9J3U7k5ZvT6GKrYg71p8bkd8vJ1sdU44t6bTWTkYjIDdKPn/or3VyeJjpSi wBSUzZrjFX/bq+xotq7GI9DIsJ3e8CLSw55abLJpnzaa9W37p3QtqD2VYWeyn4smrIkp v5zw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=FjCGSzOr; 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 c65si1220325ywe.519.2018.02.17.10.40.10 for (version=TLS1 cipher=AES128-SHA bits=128/128); Sat, 17 Feb 2018 10:40:10 -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=FjCGSzOr; 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]:48175 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1en7P8-0005Qf-1m for patch@linaro.org; Sat, 17 Feb 2018 13:40:10 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39957) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1en79V-0000cH-Nv for qemu-devel@nongnu.org; Sat, 17 Feb 2018 13:24:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1en79U-0001hY-Hj for qemu-devel@nongnu.org; Sat, 17 Feb 2018 13:24:01 -0500 Received: from mail-pf0-x242.google.com ([2607:f8b0:400e:c00::242]:47051) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1en79U-0001hC-AC for qemu-devel@nongnu.org; Sat, 17 Feb 2018 13:24:00 -0500 Received: by mail-pf0-x242.google.com with SMTP id z24so587774pfh.13 for ; Sat, 17 Feb 2018 10:24:00 -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=qUivDrBs/deC0vPF+CXEPEAAPcV9POzH7MV2Tc4RKIU=; b=FjCGSzOrl59WAmxuTF3fp9cSnWOvbvUgfkBEWUwBwkG9lu8QMIiknQeTGNI/UBvJL3 2MoyEOQphAC3KlOTqLXCYkJhLwyiVlZ7vMcC8trb2Wb3jChCrAP4w2TefmACPQ5aSrTK 4bZvwBG+audRb0NOqQmMDYm/3BdsDWDcLoQsM= 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=qUivDrBs/deC0vPF+CXEPEAAPcV9POzH7MV2Tc4RKIU=; b=gK/YjL0hgmrrgBBAEtg/NpGcmc/dkyrjJgSVg+pIvBX7grSJNj23q22jUvfRnbTuFd umdnBA3V3xmrRMFj2/K5OQqEo/Gu3i3C3joV8ZAzAEE0ol38I6cQ2fOppWXuZNAHJmAA FoaH0z64Q+tL2B8oT8hcBGKMtLmpDR2wEC6zqfQq5ut42zRfXw9J07ads8qQsqdSFnQP TXqj9TIrKSsWQyM9kJn5PKDMpG1Gp2O1MvKYtxgWgD6U8+GKplC03L8MjtswlgvB2tTc kocV7R4q6Yk7PKQDMOPkqHepv3m0TJpi0RR+hRbr1fMm1y+ZZmrwpapmFK2KUKKquYWN /bYQ== X-Gm-Message-State: APf1xPBL7a/9GWy0Veotn08R0IhFujPjsGr6n+FYv6Er1672nVVP+FO1 kScQqSn7i+K8A7zeswTXLIDUqClNEpQ= X-Received: by 10.98.196.199 with SMTP id h68mr1212317pfk.42.1518891839009; Sat, 17 Feb 2018 10:23:59 -0800 (PST) Received: from cloudburst.twiddle.net ([50.0.192.64]) by smtp.gmail.com with ESMTPSA id h15sm13466712pfi.56.2018.02.17.10.23.57 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 17 Feb 2018 10:23:58 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Sat, 17 Feb 2018 10:22:36 -0800 Message-Id: <20180217182323.25885-21-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:c00::242 Subject: [Qemu-devel] [PATCH v2 20/67] target/arm: Implement SVE Compute Vector Address 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: 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 | 33 +++++++++++++++++++++++++++++++++ target/arm/sve.decode | 12 ++++++++++++ 4 files changed, 90 insertions(+) -- 2.14.3 Reviewed-by: Peter Maydell diff --git a/target/arm/helper-sve.h b/target/arm/helper-sve.h index 00e3cd48bb..5280d375f9 100644 --- a/target/arm/helper-sve.h +++ b/target/arm/helper-sve.h @@ -380,6 +380,11 @@ DEF_HELPER_FLAGS_4(sve_lsl_zzw_b, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_4(sve_lsl_zzw_h, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_4(sve_lsl_zzw_s, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_4(sve_adr_p32, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_4(sve_adr_p64, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_4(sve_adr_s32, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_4(sve_adr_u32, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) + DEF_HELPER_FLAGS_5(sve_and_pppp, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_5(sve_bic_pppp, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_5(sve_eor_pppp, 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 4c6e2713fa..a290a58c02 100644 --- a/target/arm/sve_helper.c +++ b/target/arm/sve_helper.c @@ -1061,3 +1061,43 @@ void HELPER(sve_index_d)(void *vd, uint64_t start, d[i] = start + i * incr; } } + +void HELPER(sve_adr_p32)(void *vd, void *vn, void *vm, uint32_t desc) +{ + intptr_t i, opr_sz = simd_oprsz(desc) / 4; + uint32_t sh = simd_data(desc); + uint32_t *d = vd, *n = vn, *m = vm; + for (i = 0; i < opr_sz; i += 1) { + d[i] = n[i] + (m[i] << sh); + } +} + +void HELPER(sve_adr_p64)(void *vd, void *vn, void *vm, uint32_t desc) +{ + intptr_t i, opr_sz = simd_oprsz(desc) / 8; + uint64_t sh = simd_data(desc); + uint64_t *d = vd, *n = vn, *m = vm; + for (i = 0; i < opr_sz; i += 1) { + d[i] = n[i] + (m[i] << sh); + } +} + +void HELPER(sve_adr_s32)(void *vd, void *vn, void *vm, uint32_t desc) +{ + intptr_t i, opr_sz = simd_oprsz(desc) / 8; + uint64_t sh = simd_data(desc); + uint64_t *d = vd, *n = vn, *m = vm; + for (i = 0; i < opr_sz; i += 1) { + d[i] = n[i] + ((uint64_t)(int32_t)m[i] << sh); + } +} + +void HELPER(sve_adr_u32)(void *vd, void *vn, void *vm, uint32_t desc) +{ + intptr_t i, opr_sz = simd_oprsz(desc) / 8; + uint64_t sh = simd_data(desc); + uint64_t *d = vd, *n = vn, *m = vm; + for (i = 0; i < opr_sz; i += 1) { + d[i] = n[i] + ((uint64_t)(uint32_t)m[i] << sh); + } +} diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c index 43e9f1ad08..34cc8c2773 100644 --- a/target/arm/translate-sve.c +++ b/target/arm/translate-sve.c @@ -847,6 +847,39 @@ static void trans_RDVL(DisasContext *s, arg_RDVL *a, uint32_t insn) tcg_gen_movi_i64(reg, a->imm * vec_full_reg_size(s)); } +/* + *** SVE Compute Vector Address Group + */ + +static void do_adr(DisasContext *s, arg_rrri *a, gen_helper_gvec_3 *fn) +{ + unsigned vsz = vec_full_reg_size(s); + tcg_gen_gvec_3_ool(vec_full_reg_offset(s, a->rd), + vec_full_reg_offset(s, a->rn), + vec_full_reg_offset(s, a->rm), + vsz, vsz, a->imm, fn); +} + +static void trans_ADR_p32(DisasContext *s, arg_rrri *a, uint32_t insn) +{ + do_adr(s, a, gen_helper_sve_adr_p32); +} + +static void trans_ADR_p64(DisasContext *s, arg_rrri *a, uint32_t insn) +{ + do_adr(s, a, gen_helper_sve_adr_p64); +} + +static void trans_ADR_s32(DisasContext *s, arg_rrri *a, uint32_t insn) +{ + do_adr(s, a, gen_helper_sve_adr_s32); +} + +static void trans_ADR_u32(DisasContext *s, arg_rrri *a, uint32_t insn) +{ + do_adr(s, a, gen_helper_sve_adr_u32); +} + /* *** SVE Predicate Logical Operations Group */ diff --git a/target/arm/sve.decode b/target/arm/sve.decode index f71ea1b60d..6ec1f94832 100644 --- a/target/arm/sve.decode +++ b/target/arm/sve.decode @@ -49,6 +49,7 @@ &rr_esz rd rn esz &rri rd rn imm +&rrri rd rn rm imm &rri_esz rd rn imm esz &rrr_esz rd rn rm esz &rpr_esz rd pg rn esz @@ -77,6 +78,9 @@ # Three operand, vector element size @rd_rn_rm ........ esz:2 . rm:5 ... ... rn:5 rd:5 &rrr_esz +# Three operand with "memory" size, aka immediate left shift +@rd_rn_msz_rm ........ ... rm:5 .... imm:2 rn:5 rd:5 &rrri + # Two register operand, with governing predicate, vector element size @rdn_pg_rm ........ esz:2 ... ... ... pg:3 rm:5 rd:5 \ &rprr_esz rn=%reg_movprfx @@ -278,6 +282,14 @@ ASR_zzw 00000100 .. 1 ..... 1000 00 ..... ..... @rd_rn_rm LSR_zzw 00000100 .. 1 ..... 1000 01 ..... ..... @rd_rn_rm LSL_zzw 00000100 .. 1 ..... 1000 11 ..... ..... @rd_rn_rm +### SVE Compute Vector Address Group + +# SVE vector address generation +ADR_s32 00000100 00 1 ..... 1010 .. ..... ..... @rd_rn_msz_rm +ADR_u32 00000100 01 1 ..... 1010 .. ..... ..... @rd_rn_msz_rm +ADR_p32 00000100 10 1 ..... 1010 .. ..... ..... @rd_rn_msz_rm +ADR_p64 00000100 11 1 ..... 1010 .. ..... ..... @rd_rn_msz_rm + ### SVE Predicate Logical Operations Group # SVE predicate logical operations