From patchwork Thu Jun 13 12:13:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 166631 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp721155ilk; Thu, 13 Jun 2019 05:53:17 -0700 (PDT) X-Google-Smtp-Source: APXvYqwwfCAunicEOKJ17k6RZMKzlOYQJttco1c/aGtnFgG3+RWeGFZ5sz+4AKB7bYc7U/B4xGXE X-Received: by 2002:ac8:2f90:: with SMTP id l16mr59956118qta.12.1560430397452; Thu, 13 Jun 2019 05:53:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560430397; cv=none; d=google.com; s=arc-20160816; b=z54s8EhfeN9ERrEohlWdb+7UGtuqyZtvX7qVSvELWwkED5vGiAn+NWYATxrqIGgvsR TK9U7sna9CxZP95XpgWtWlchpGA+izmJKWyMdbbcFpLiF+Z8aypxzt1cVA/U8hpqnlxh XbGfmvOOWxKei7dL+vXeRIWoXX445E4T5prUu6+Mi7J9RFHnMKvkdqExO6cmL459W8ST MgGbUrW5+pn5auRH4C0IYmDl7FG1tv25JIbyMFcxK97pCgcsrOPewjUnPQKdwnEKC5Yv dfHccBWt7U3H+NuFLe8XoPr5EMTt7FiyJQD7HvXkOHtwksB9p+Z045jtjukhVhkHFBRO aIzw== 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=G9EplEWWeY2rBD/O9y6VR49Hh5Zd3BPbLcO7Af3KvXA=; b=BdLxs7wRv8z9IL4K3maIcGf+WcoTLyZkkmdWhuQT/3BPt9w0mBTNeFG6Et4QkcVKV2 QVZDQ2Og4pTntQ7XEq2mOdRo0TrlrniaL/OkdmxAnmr+9rHBK4Iuzd1QJqzjrz3ZELkM t2SSMkvEWEERSfxh/681z1K/o+/QkVZ9ldJyz8mVkTsOE44k20RCSD/EhVgtWR7flsYb Op5ME0oQA7Ebq7H4SD3a+dYY0dcZj2BRv1wg8RXiEAkTrHq5zWc/1EC5kcPCCAybcDj7 UwRHisfYDUMwmpsGMqGPCTwWv0254vdQhy/KYVGa4qfc3JhDZxzv8cbMOs0YUSU0gGzo CK3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=s0Q3kV87; 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 b7si1423533qvh.206.2019.06.13.05.53.17 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 13 Jun 2019 05:53:17 -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=s0Q3kV87; 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]:39514 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hbPEC-0007p9-Rf for patch@linaro.org; Thu, 13 Jun 2019 08:53:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59078) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hbOdN-000829-9B for qemu-devel@nongnu.org; Thu, 13 Jun 2019 08:15:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hbOdL-0004O0-9N for qemu-devel@nongnu.org; Thu, 13 Jun 2019 08:15:13 -0400 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]:38236) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hbOdH-00041p-DC for qemu-devel@nongnu.org; Thu, 13 Jun 2019 08:15:09 -0400 Received: by mail-wr1-x431.google.com with SMTP id d18so20521232wrs.5 for ; Thu, 13 Jun 2019 05:14:51 -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=G9EplEWWeY2rBD/O9y6VR49Hh5Zd3BPbLcO7Af3KvXA=; b=s0Q3kV877QBrAfKHztkhpWg3t5LVgArMsU0D0QE4mzGHdRHd6f3e7+3w2Ix8Qy6HVf 3yTuTh5xdBDn5fMfUvAY5GsjXKQEbrkhNx7kStY/pkUXsP1AOULjQoeXWOmOVlAeB+XV rS3b/pFZDmueCiHraaPUtD1KaqL/rZGknDQl7t7uxjNXz5t+PtQleJJhZI7dpih46B1r +Fb0vFNK4QxF6BHE4dW5ZXsKMS2DK/y3C4gfolXtovUe1vA9LFKL2GSJjSl9MZTCTmEk Pbk3r2560uoKZ9p5aLgS6rEURFqJKw/3BCQEh31Lwm2aGSZumnP0EV1onvrqKiroKlQX vgTQ== 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=G9EplEWWeY2rBD/O9y6VR49Hh5Zd3BPbLcO7Af3KvXA=; b=aXH1546kui1Mb9NpIdQ00DoSRLxlUoHQJzmuEDMXBpzTwrkJjYWoYFyhIGLWZ7s2s1 +UopRTeSsjkNfM79kBH8rtTWUQut2O/KZueb2So57T7/H9JQWPifuVYpQZ7qhTLX+wcP 7+h9w1HNw58JwGtnjZrkYd15TS+fcWhUADKGZvArGoqtFfknK+ks8FrWPooJlsZ5CINg yaSaX2O7ZZSYcdOcPiW8fxA6Ll3KlyX00N6TfsJYvyJeMwagkD8vHUFTbQX0YUNKF6/u lCF6NkL/Ng6Ku3Iqnc4H2xls10FNzmqcBUAIJUcGawZm49gGeYpUrlTH4Ia22A70wT8H 3faw== X-Gm-Message-State: APjAAAUODI7QafTlm/mRBbTSVUjLHIwTKkq8db+uMIqr3R6OliCJ4fcG 1A7NDuyi+5v90X7504TmkVSxd39V2wL1qA== X-Received: by 2002:a5d:6709:: with SMTP id o9mr46293015wru.301.1560428090323; Thu, 13 Jun 2019 05:14:50 -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.14.49 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Jun 2019 05:14:49 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Date: Thu, 13 Jun 2019 13:13:59 +0100 Message-Id: <20190613121433.5246-15-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::431 Subject: [Qemu-devel] [PULL 14/48] target/arm: Convert VRINTA/VRINTN/VRINTP/VRINTM 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 VRINTA/VRINTN/VRINTP/VRINTM instructions to decodetree. Again, trans_VRINT() is temporarily left in translate.c. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- target/arm/translate.c | 60 +++++++++++++++++++++++------------- target/arm/vfp-uncond.decode | 5 +++ 2 files changed, 43 insertions(+), 22 deletions(-) -- 2.20.1 diff --git a/target/arm/translate.c b/target/arm/translate.c index 6cbdf4307a4..1da683820ab 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -3270,11 +3270,43 @@ static bool trans_VMINMAXNM(DisasContext *s, arg_VMINMAXNM *a) return true; } -static int handle_vrint(uint32_t insn, uint32_t rd, uint32_t rm, uint32_t dp, - int rounding) +/* + * Table for converting the most common AArch32 encoding of + * rounding mode to arm_fprounding order (which matches the + * common AArch64 order); see ARM ARM pseudocode FPDecodeRM(). + */ +static const uint8_t fp_decode_rm[] = { + FPROUNDING_TIEAWAY, + FPROUNDING_TIEEVEN, + FPROUNDING_POSINF, + FPROUNDING_NEGINF, +}; + +static bool trans_VRINT(DisasContext *s, arg_VRINT *a) { - TCGv_ptr fpst = get_fpstatus_ptr(0); + uint32_t rd, rm; + bool dp = a->dp; + TCGv_ptr fpst; TCGv_i32 tcg_rmode; + int rounding = fp_decode_rm[a->rm]; + + if (!dc_isar_feature(aa32_vrint, s)) { + return false; + } + + /* UNDEF accesses to D16-D31 if they don't exist */ + if (dp && !dc_isar_feature(aa32_fp_d32, s) && + ((a->vm | a->vd) & 0x10)) { + return false; + } + rd = a->vd; + rm = a->vm; + + if (!vfp_access_check(s)) { + return true; + } + + fpst = get_fpstatus_ptr(0); tcg_rmode = tcg_const_i32(arm_rmode_to_sf(rounding)); gen_helper_set_rmode(tcg_rmode, tcg_rmode, fpst); @@ -3305,7 +3337,7 @@ static int handle_vrint(uint32_t insn, uint32_t rd, uint32_t rm, uint32_t dp, tcg_temp_free_i32(tcg_rmode); tcg_temp_free_ptr(fpst); - return 0; + return true; } static int handle_vcvt(uint32_t insn, uint32_t rd, uint32_t rm, uint32_t dp, @@ -3366,17 +3398,6 @@ static int handle_vcvt(uint32_t insn, uint32_t rd, uint32_t rm, uint32_t dp, return 0; } -/* Table for converting the most common AArch32 encoding of - * rounding mode to arm_fprounding order (which matches the - * common AArch64 order); see ARM ARM pseudocode FPDecodeRM(). - */ -static const uint8_t fp_decode_rm[] = { - FPROUNDING_TIEAWAY, - FPROUNDING_TIEEVEN, - FPROUNDING_POSINF, - FPROUNDING_NEGINF, -}; - static int disas_vfp_misc_insn(DisasContext *s, uint32_t insn) { uint32_t rd, rm, dp = extract32(insn, 8, 1); @@ -3389,13 +3410,8 @@ static int disas_vfp_misc_insn(DisasContext *s, uint32_t insn) rm = VFP_SREG_M(insn); } - if ((insn & 0x0fbc0ed0) == 0x0eb80a40 && - dc_isar_feature(aa32_vrint, s)) { - /* VRINTA, VRINTN, VRINTP, VRINTM */ - int rounding = fp_decode_rm[extract32(insn, 16, 2)]; - return handle_vrint(insn, rd, rm, dp, rounding); - } else if ((insn & 0x0fbc0e50) == 0x0ebc0a40 && - dc_isar_feature(aa32_vcvt_dr, s)) { + if ((insn & 0x0fbc0e50) == 0x0ebc0a40 && + dc_isar_feature(aa32_vcvt_dr, s)) { /* VCVTA, VCVTN, VCVTP, VCVTM */ int rounding = fp_decode_rm[extract32(insn, 16, 2)]; return handle_vcvt(insn, rd, rm, dp, rounding); diff --git a/target/arm/vfp-uncond.decode b/target/arm/vfp-uncond.decode index 8ab201fa058..0aa83285de2 100644 --- a/target/arm/vfp-uncond.decode +++ b/target/arm/vfp-uncond.decode @@ -50,3 +50,8 @@ VMINMAXNM 1111 1110 1.00 .... .... 1010 . op:1 .0 .... \ vm=%vm_sp vn=%vn_sp vd=%vd_sp dp=0 VMINMAXNM 1111 1110 1.00 .... .... 1011 . op:1 .0 .... \ vm=%vm_dp vn=%vn_dp vd=%vd_dp dp=1 + +VRINT 1111 1110 1.11 10 rm:2 .... 1010 01.0 .... \ + vm=%vm_sp vd=%vd_sp dp=0 +VRINT 1111 1110 1.11 10 rm:2 .... 1011 01.0 .... \ + vm=%vm_dp vd=%vd_dp dp=1