From patchwork Thu Feb 28 11:08:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 10832803 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9A4E01399 for ; Thu, 28 Feb 2019 11:13:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8AB4A2DD8D for ; Thu, 28 Feb 2019 11:13:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7DA2F2DDAC; Thu, 28 Feb 2019 11:13:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id F35272DD8D for ; Thu, 28 Feb 2019 11:13:37 +0000 (UTC) Received: from localhost ([127.0.0.1]:36214 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gzJdB-0004uy-5N for patchwork-qemu-devel@patchwork.kernel.org; Thu, 28 Feb 2019 06:13:37 -0500 Received: from eggs.gnu.org ([209.51.188.92]:36445) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gzJZ0-0001QV-Gl for qemu-devel@nongnu.org; Thu, 28 Feb 2019 06:09:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gzJYu-0003sI-Qw for qemu-devel@nongnu.org; Thu, 28 Feb 2019 06:09:18 -0500 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]:46732) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gzJYu-0003rE-KE for qemu-devel@nongnu.org; Thu, 28 Feb 2019 06:09:12 -0500 Received: by mail-wr1-x42f.google.com with SMTP id i16so21421981wrs.13 for ; Thu, 28 Feb 2019 03:09:12 -0800 (PST) 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=n+p8SgcC5UISm3c/899NGcqPjSEMSEHHg+im9iJ7Dsc=; b=uGLdRzabe7Pl3qNisgNzPj+QPC299G+4XdTTx6Y6Z9qu6v7htw33ZUP0qbWPNJvENi YjCS2hi6YaR/tR+OJ0ojQ3nJVBpBydLc23tgL7g1WjJT+jj4naQ//ey9NqK5r6FbxXMx L0mYUaftqznxh6rQjege8QUzYsvIegXWBC55Rs3bMIn7sX14D/RMFYcu2AXlL/7+uQxP 0IhDYPpuUqFHHbPGFuzFm7qYqlHvWWjVoWkWCHGMZqp6Qv7dsNwxPFbAqtgNcyzTD8Zj lSLXG1QqKmjGRU60c5U5rahcPNsSQSqm0JhPAkBzVqj/o6ycjhcX6M8O42jM16q6Qsl5 HbWw== 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=n+p8SgcC5UISm3c/899NGcqPjSEMSEHHg+im9iJ7Dsc=; b=qXu6Ww71kPbPp2cAqoQgXrZdF5IRsBCblQg5y762wJimGIq/+XhC81HjgD526TrSVj dxeRSImaUCVfEXYW+6EvuBouMdhVQDvMkMtXQndJvSZ9gDhSQpx5pKLi2VesRvrURCD7 6zP7R+ywGjw9ax4TpImjDUnhuEvX1fg2WwgNHo5MHV+k/eR7KpOWBFkuOF4s0eQy+nuf 0yfXLxq4AzKXcejSsF9MLk6sv/reiGO9NyC5VWdOY7oPpoNLHXuGcbv+FYpHeyw/Phbc 8+ItXE+jxaKPJg56H/c3D63poepuIgZyLlyla0zmS2LKvxMt+GniYtfGVvlnGzptanrM iLTA== X-Gm-Message-State: APjAAAV5CdNa7iJ1yUomHsJzsiLvxWRlBBC4qovqYxuTeKUZ2bpY2DEZ GZ1fbwrh/yjHBSn215gOxkaRzBSQAEg= X-Google-Smtp-Source: APXvYqwuYDM5NrvwlvjUaMDz5NabUnBG8HphdC7jj2eUmuvSu6lsJ6cXtpRxA+5v/giE+vS1Kl0dFA== X-Received: by 2002:adf:f60d:: with SMTP id t13mr5807281wrp.225.1551352151387; Thu, 28 Feb 2019 03:09:11 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id c17sm13153241wrs.17.2019.02.28.03.09.09 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 Feb 2019 03:09:10 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Date: Thu, 28 Feb 2019 11:08:29 +0000 Message-Id: <20190228110835.16159-11-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190228110835.16159-1-peter.maydell@linaro.org> References: <20190228110835.16159-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::42f Subject: [Qemu-devel] [PULL 10/16] target/arm: Gate "miscellaneous FP" insns by ID register field 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: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP There is a set of VFP instructions which we implement in disas_vfp_v8_insn() and gate on the ARM_FEATURE_V8 bit. These were all first introduced in v8 for A-profile, but in M-profile they appeared in v7M. Gate them on the MVFR2 FPMisc field instead, and rename the function appropriately. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20190222170936.13268-3-peter.maydell@linaro.org --- target/arm/cpu.h | 20 ++++++++++++++++++++ target/arm/translate.c | 25 +++++++++++++------------ 2 files changed, 33 insertions(+), 12 deletions(-) diff --git a/target/arm/cpu.h b/target/arm/cpu.h index 36ea3b58567..ff9ba387b42 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -3328,6 +3328,26 @@ static inline bool isar_feature_aa32_fp16_dpconv(const ARMISARegisters *id) return FIELD_EX64(id->mvfr1, MVFR1, FPHP) > 1; } +static inline bool isar_feature_aa32_vsel(const ARMISARegisters *id) +{ + return FIELD_EX64(id->mvfr2, MVFR2, FPMISC) >= 1; +} + +static inline bool isar_feature_aa32_vcvt_dr(const ARMISARegisters *id) +{ + return FIELD_EX64(id->mvfr2, MVFR2, FPMISC) >= 2; +} + +static inline bool isar_feature_aa32_vrint(const ARMISARegisters *id) +{ + return FIELD_EX64(id->mvfr2, MVFR2, FPMISC) >= 3; +} + +static inline bool isar_feature_aa32_vminmaxnm(const ARMISARegisters *id) +{ + return FIELD_EX64(id->mvfr2, MVFR2, FPMISC) >= 4; +} + /* * 64-bit feature tests via id registers. */ diff --git a/target/arm/translate.c b/target/arm/translate.c index b7702fb49f7..d845923a96b 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -3357,14 +3357,10 @@ static const uint8_t fp_decode_rm[] = { FPROUNDING_NEGINF, }; -static int disas_vfp_v8_insn(DisasContext *s, uint32_t insn) +static int disas_vfp_misc_insn(DisasContext *s, uint32_t insn) { uint32_t rd, rn, rm, dp = extract32(insn, 8, 1); - if (!arm_dc_feature(s, ARM_FEATURE_V8)) { - return 1; - } - if (dp) { VFP_DREG_D(rd, insn); VFP_DREG_N(rn, insn); @@ -3375,15 +3371,18 @@ static int disas_vfp_v8_insn(DisasContext *s, uint32_t insn) rm = VFP_SREG_M(insn); } - if ((insn & 0x0f800e50) == 0x0e000a00) { + if ((insn & 0x0f800e50) == 0x0e000a00 && dc_isar_feature(aa32_vsel, s)) { return handle_vsel(insn, rd, rn, rm, dp); - } else if ((insn & 0x0fb00e10) == 0x0e800a00) { + } else if ((insn & 0x0fb00e10) == 0x0e800a00 && + dc_isar_feature(aa32_vminmaxnm, s)) { return handle_vminmaxnm(insn, rd, rn, rm, dp); - } else if ((insn & 0x0fbc0ed0) == 0x0eb80a40) { + } else 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) { + } else 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); @@ -3427,10 +3426,12 @@ static int disas_vfp_insn(DisasContext *s, uint32_t insn) } if (extract32(insn, 28, 4) == 0xf) { - /* Encodings with T=1 (Thumb) or unconditional (ARM): - * only used in v8 and above. + /* + * Encodings with T=1 (Thumb) or unconditional (ARM): + * only used for the "miscellaneous VFP features" added in v8A + * and v7M (and gated on the MVFR2.FPMisc field). */ - return disas_vfp_v8_insn(s, insn); + return disas_vfp_misc_insn(s, insn); } dp = ((insn & 0xf00) == 0xb00);