From patchwork Thu Jun 13 12:14:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 166639 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp726515ilk; Thu, 13 Jun 2019 05:59:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqzokeby2G2WXob/QdnzUv29NTug730oXRo0QwmUomhaA+O7zE6PBri99LzfODzpm1BJ/GJl X-Received: by 2002:ac8:224d:: with SMTP id p13mr54833733qtp.154.1560430744936; Thu, 13 Jun 2019 05:59:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560430744; cv=none; d=google.com; s=arc-20160816; b=lhYgxSJ4d0NDmJMPwW97ToXBPvFT35oLDqAx08fMf1hqrXyT3Sd2EWVGNdEjTefrfJ Zi8gasnUpUM6eyGLFBlwVTpLrWUp36hJ4FfU8wf4NqYbDp0EF58PJ/Lc1sGHmwEe9onS e1pSXd4se3YxEF4Yt7je/QSBaqiyLSll5IpRoa862apEurCmsOtikWz6s12fdWQ9PJzg o3WggGyA+GO+tQiH9Z5EMoG/eVXexNIlqPtupgBeGEUJeTjMdSQf1yYPYaHtHng1lXQP Wq5iW3GZQN0mYFvCBMAItqNbN4YCowowrOlzzcHP7Z4dhUBTXRVL+aZuWsCB42Ppd8zi ayfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=ZxLqU47/zu103NNnSAFyZsvu3wGIQylPHAykvX/ZYgU=; b=VMgJEVAvdE4QRY7aBk8xfAteUnp76M/EaxgmVFiBjrAylolqA6aVGRWuIePFULwAgj U/F64wdqngqsCpUkvWWZPdrBx5Z964h7P/3EPMPjiTkT+hDYTCuLvh2+3c17kxmNuIkJ +LU4E365HZpygKjHdj81i+7dflcKH61+8MNvKif55RCK1GaXCzlxPT+mLcZd6IppFcPg GXG2YOp9x9FL0b//4trpg6SeMC0jACjPy9T0rhKCCMjhL7mBpGU4igMj9zaoztqOtf/k Ak9wVbsW6YoL99CrLHk6Gl1W+0pof1kY/wNbt/1gn5Ptkmq2GFojVNba/ViGSup0ML/3 nVvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=mUTagof+; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 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. [209.51.188.17]) by mx.google.com with ESMTPS id t188si1636607qkh.84.2019.06.13.05.59.04 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 13 Jun 2019 05:59:04 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=mUTagof+; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 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]:39554 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hbPJo-0006F5-Bd for patch@linaro.org; Thu, 13 Jun 2019 08:59:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59426) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hbOdc-0008Lm-4h for qemu-devel@nongnu.org; Thu, 13 Jun 2019 08:15:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hbOdV-0004bu-4w for qemu-devel@nongnu.org; Thu, 13 Jun 2019 08:15:27 -0400 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]:35534) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hbOdU-0004Pg-EP for qemu-devel@nongnu.org; Thu, 13 Jun 2019 08:15:20 -0400 Received: by mail-wm1-x343.google.com with SMTP id c6so9908394wml.0 for ; Thu, 13 Jun 2019 05:15:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=ZxLqU47/zu103NNnSAFyZsvu3wGIQylPHAykvX/ZYgU=; b=mUTagof+QENGT9hFlrkDNZbdx72vXBsVhweZeN7NGbRMX2iIBtDuGmqBYYc2w88hBB w6I+mZ0U3h9mlwa8QqA52LsQIz9ALO1XD5k12zGKmypx2V/T9JZufHHQKeX4ToDngmRZ T4BmhSbHvmH6W+EPWxOkCLekedY5a1lyv9thwntsywv26bhCQ3rTm6+0QY+W7H1NyD/4 mb9PNLG5hMEPJFOUEzleNtevyhV5/dBSnPpc+bjBS1exA++yZHokKQR9W1Y5Q0D+cElH 5A2szSzecizLh9FNTOH0yOlGExmrBQjIwIxDNN5EMPOWewp4gCJFgsH5SaKhXWGLrSkT rPXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ZxLqU47/zu103NNnSAFyZsvu3wGIQylPHAykvX/ZYgU=; b=Aqj5eubLDIxSiMkWMMeUlKJkI9csvFD4h+74F4qUCqBdftE5AwjbeAa5ewHGgLqlD6 BAdyRdObmbDfssZM5uZx09yZVLoupZ09zxIM/3HEnXVMUi+eYssBHGDf8x42BW8edrN/ RHQFvCaUHlFBOm+0UzTv0Fdu0I519zQn4afgpOGwxlbSalN2WojBCZ6NoKNY6XCuozKs 5mGtpR+DC8GjAegs1hW/9CXLj+QHpeAMIqadLEJe/ZQx7XT/ACTp9GokLC9rGWmbq9qx RCBR9X+gA3kdauT2JcWGL1KRXyIRZo1fc7PMxbQkQAT5OqDVEVS7OMimba/RsWpkY5G2 hLWw== X-Gm-Message-State: APjAAAVGh0c6FgmmAT7m7gXJJll2YpnzWOSKDRubkgy0V2POE+pjePrb fz84kuWFm1YDEOqma/9dec2vvvHiw2kJ9w== X-Received: by 2002:a7b:cbc6:: with SMTP id n6mr3753140wmi.14.1560428112112; Thu, 13 Jun 2019 05:15:12 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id y6sm2010576wrp.12.2019.06.13.05.15.11 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Jun 2019 05:15:11 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Date: Thu, 13 Jun 2019 13:14:19 +0100 Message-Id: <20190613121433.5246-35-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190613121433.5246-1-peter.maydell@linaro.org> References: <20190613121433.5246-1-peter.maydell@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::343 Subject: [Qemu-devel] [PULL 34/48] target/arm: Convert VMOV (imm) to decodetree X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Convert the VFP VMOV (immediate) instruction to decodetree. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- target/arm/translate-vfp.inc.c | 129 +++++++++++++++++++++++++++++++++ target/arm/translate.c | 27 +------ target/arm/vfp.decode | 5 ++ 3 files changed, 136 insertions(+), 25 deletions(-) -- 2.20.1 diff --git a/target/arm/translate-vfp.inc.c b/target/arm/translate-vfp.inc.c index ba6506a378c..a2eeb6cb511 100644 --- a/target/arm/translate-vfp.inc.c +++ b/target/arm/translate-vfp.inc.c @@ -1602,3 +1602,132 @@ static bool trans_VFM_dp(DisasContext *s, arg_VFM_sp *a) return true; } + +static bool trans_VMOV_imm_sp(DisasContext *s, arg_VMOV_imm_sp *a) +{ + uint32_t delta_d = 0; + uint32_t bank_mask = 0; + int veclen = s->vec_len; + TCGv_i32 fd; + uint32_t n, i, vd; + + vd = a->vd; + + if (!dc_isar_feature(aa32_fpshvec, s) && + (veclen != 0 || s->vec_stride != 0)) { + return false; + } + + if (!arm_dc_feature(s, ARM_FEATURE_VFP3)) { + return false; + } + + if (!vfp_access_check(s)) { + return true; + } + + if (veclen > 0) { + bank_mask = 0x18; + /* Figure out what type of vector operation this is. */ + if ((vd & bank_mask) == 0) { + /* scalar */ + veclen = 0; + } else { + delta_d = s->vec_stride + 1; + } + } + + n = (a->imm4h << 28) & 0x80000000; + i = ((a->imm4h << 4) & 0x70) | a->imm4l; + if (i & 0x40) { + i |= 0x780; + } else { + i |= 0x800; + } + n |= i << 19; + + fd = tcg_temp_new_i32(); + tcg_gen_movi_i32(fd, n); + + for (;;) { + neon_store_reg32(fd, vd); + + if (veclen == 0) { + break; + } + + /* Set up the operands for the next iteration */ + veclen--; + vd = ((vd + delta_d) & (bank_mask - 1)) | (vd & bank_mask); + } + + tcg_temp_free_i32(fd); + return true; +} + +static bool trans_VMOV_imm_dp(DisasContext *s, arg_VMOV_imm_dp *a) +{ + uint32_t delta_d = 0; + uint32_t bank_mask = 0; + int veclen = s->vec_len; + TCGv_i64 fd; + uint32_t n, i, vd; + + vd = a->vd; + + /* UNDEF accesses to D16-D31 if they don't exist. */ + if (!dc_isar_feature(aa32_fp_d32, s) && (vd & 0x10)) { + return false; + } + + if (!dc_isar_feature(aa32_fpshvec, s) && + (veclen != 0 || s->vec_stride != 0)) { + return false; + } + + if (!arm_dc_feature(s, ARM_FEATURE_VFP3)) { + return false; + } + + if (!vfp_access_check(s)) { + return true; + } + + if (veclen > 0) { + bank_mask = 0xc; + /* Figure out what type of vector operation this is. */ + if ((vd & bank_mask) == 0) { + /* scalar */ + veclen = 0; + } else { + delta_d = (s->vec_stride >> 1) + 1; + } + } + + n = (a->imm4h << 28) & 0x80000000; + i = ((a->imm4h << 4) & 0x70) | a->imm4l; + if (i & 0x40) { + i |= 0x3f80; + } else { + i |= 0x4000; + } + n |= i << 16; + + fd = tcg_temp_new_i64(); + tcg_gen_movi_i64(fd, ((uint64_t)n) << 32); + + for (;;) { + neon_store_reg64(fd, vd); + + if (veclen == 0) { + break; + } + + /* Set up the operands for the next iteration */ + veclen--; + vd = ((vd + delta_d) & (bank_mask - 1)) | (vd & bank_mask); + } + + tcg_temp_free_i64(fd); + return true; +} diff --git a/target/arm/translate.c b/target/arm/translate.c index 75280e0e524..30d96fbf5a6 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -3033,7 +3033,7 @@ static void gen_neon_dup_high16(TCGv_i32 var) */ static int disas_vfp_insn(DisasContext *s, uint32_t insn) { - uint32_t rd, rn, rm, op, i, n, delta_d, delta_m, bank_mask; + uint32_t rd, rn, rm, op, delta_d, delta_m, bank_mask; int dp, veclen; TCGv_i32 tmp; TCGv_i32 tmp2; @@ -3093,7 +3093,7 @@ static int disas_vfp_insn(DisasContext *s, uint32_t insn) rn = VFP_SREG_N(insn); switch (op) { - case 0 ... 13: + case 0 ... 14: /* Already handled by decodetree */ return 1; default: @@ -3279,29 +3279,6 @@ static int disas_vfp_insn(DisasContext *s, uint32_t insn) for (;;) { /* Perform the calculation. */ switch (op) { - case 14: /* fconst */ - if (!arm_dc_feature(s, ARM_FEATURE_VFP3)) { - return 1; - } - - n = (insn << 12) & 0x80000000; - i = ((insn >> 12) & 0x70) | (insn & 0xf); - if (dp) { - if (i & 0x40) - i |= 0x3f80; - else - i |= 0x4000; - n |= i << 16; - tcg_gen_movi_i64(cpu_F0d, ((uint64_t)n) << 32); - } else { - if (i & 0x40) - i |= 0x780; - else - i |= 0x800; - n |= i << 19; - tcg_gen_movi_i32(cpu_F0s, n); - } - break; case 15: /* extension space */ switch (rn) { case 0: /* cpy */ diff --git a/target/arm/vfp.decode b/target/arm/vfp.decode index 37eec0e1310..1818d4f71e1 100644 --- a/target/arm/vfp.decode +++ b/target/arm/vfp.decode @@ -151,3 +151,8 @@ VFM_sp ---- 1110 1.10 .... .... 1010 . o2:1 . 0 .... \ vm=%vm_sp vn=%vn_sp vd=%vd_sp o1=2 VFM_dp ---- 1110 1.10 .... .... 1011 . o2:1 . 0 .... \ vm=%vm_dp vn=%vn_dp vd=%vd_dp o1=2 + +VMOV_imm_sp ---- 1110 1.11 imm4h:4 .... 1010 0000 imm4l:4 \ + vd=%vd_sp +VMOV_imm_dp ---- 1110 1.11 imm4h:4 .... 1011 0000 imm4l:4 \ + vd=%vd_dp