From patchwork Mon Feb 24 22:22:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 183783 Delivered-To: patch@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp923829ile; Mon, 24 Feb 2020 14:25:59 -0800 (PST) X-Google-Smtp-Source: APXvYqxuVvAng/wJ1eat16q4aEifjcdfUOCTn2Y1S8xHu2UWG9+S11G24ZuTIw1/3OVfsLHrrorz X-Received: by 2002:a05:620a:74c:: with SMTP id i12mr4187549qki.286.1582583159391; Mon, 24 Feb 2020 14:25:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582583159; cv=none; d=google.com; s=arc-20160816; b=T4f2Tb8cPMDWqZyQnZDXOt9sgtrcRCx4VCLarDa3YQ+QZq9eZv36NdIXPNxJFDU/ju ce7auLqpUqaUCSpHawok+Ck16A4Zw1Hf5a+94qIp4GyZmCH9m5e8lGMERXCBjaslRJcw VYm3jd7FZFF0h41zkic/xd9P3ksqE0++orK6aPtg+KNWX2qX1g/gwOoboGLapJh78vYz tW8pVTTeAWc3YIScSq43fApg4V++IrALPVCsyonN9jbNXNUvjKXxdJTWgSnTQ87UrTFY HjuF+Ajv/xAT7a2fOAIi2HXGRrygVJCz+oYuNtYlmnU0NPBVSH4a0VBeUhFeAwxIcexS NddA== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=ABqg53SHadErlQ1KJw2EVsyG66DudT3m5ptP92s2kV4=; b=S2d3hZRbZrZ5uycH3iTtxxJ8s6p2ey0yovYd7HQ25NrpJdF+AyTPfsBpaJHQNxg3ES ApQOx4E5sZnINp4cmTqadAxTqngD4xM906B4R6k1zf58D8UgJCEsssgJBZrgPdyWxP/i KOGiMz0UR8lJa11jUOxdvR+GRrfh/JdwzoMybfxkIR4EsojfOpgENs7FwH8YOL1a8ov4 V4q2vSjgKLlgYGzj49NXh0gkPWNy7pYQmAZAVjlZ0oAmBv8xCK4Ip2Is3tbrg3oWtaj3 n3XgoIwEeEEhgg3HgxTsBdpJe/5dtSnhvyWPpkv7hH5BnuLbKBld6FGmQatDY/4LAjNy zD3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="ml/LGDeM"; 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=pass (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 s40si6329966qtj.384.2020.02.24.14.25.59 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 24 Feb 2020 14:25:59 -0800 (PST) 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=pass header.i=@linaro.org header.s=google header.b="ml/LGDeM"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:45260 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j6MAo-0002WH-Ry for patch@linaro.org; Mon, 24 Feb 2020 17:25:58 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:37880) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j6M7l-0004OL-0i for qemu-devel@nongnu.org; Mon, 24 Feb 2020 17:22:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j6M7j-0005sN-Jo for qemu-devel@nongnu.org; Mon, 24 Feb 2020 17:22:48 -0500 Received: from mail-pf1-x443.google.com ([2607:f8b0:4864:20::443]:42367) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1j6M7j-0005s0-EQ for qemu-devel@nongnu.org; Mon, 24 Feb 2020 17:22:47 -0500 Received: by mail-pf1-x443.google.com with SMTP id 4so6063238pfz.9 for ; Mon, 24 Feb 2020 14:22:47 -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 :mime-version:content-transfer-encoding; bh=ABqg53SHadErlQ1KJw2EVsyG66DudT3m5ptP92s2kV4=; b=ml/LGDeM83+tA/QuI9WQvvsXX+P52t3WEQ5SAtw+bAXUiCz0nN4ReHgPEwUqPnhZsD fvaMa4fOI+ttGPyxkAZ9L1Lmrvf8zS1PcbbxL1VHrWWls1eInuHQnSTvLqjuv3VJ/z6j xEknPQQu8h1NZrIAz9KLGE92mSw1cUXs3TPPo7TxBramSMrtftYEeINKRFenVtvGrtQ3 ag2l6KyYT3IwXljfc13/ciUf7TWjY2fEQfAAmXsfiZFwCaVutE8sSFASLtWEi1hibzgz fXsfpQNt1C1TKFcdttXosEUF7SQv5UM7zM4I4khWEUSsKbbDQSICfBSyAWs4adBpF/uL +Kcg== 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:mime-version:content-transfer-encoding; bh=ABqg53SHadErlQ1KJw2EVsyG66DudT3m5ptP92s2kV4=; b=Wl/+dzLAELPNeJDe1FU30Hr+CwxUDVcENljyV7olbxWt1pLTva1OMxQS6ZP7pRx+iU vN26uoyeo6YBPQhZZHCkF5MYxA9U9nMCr0+D7k2kdGbzzZQjKocEu5IDQfCL4HWrsB5X 6wUHqNvTzRKZklvUIPgR1f/28g5X9cxRYJT/ZdwAXYtb/mmUdwLF7L56UfmvO3An6VoL Qsa89UKokj68SgB2UQgq7n3yT1vRgKjch8gIaS5PW6S09GXlw8pEoVPM94Xv7+eBpdTc TrtBBLltvtzG1BmFgR/hv3MZA07wPff5GpPliPG2ExlehQ5O4OVnRHPLCjKly/R/NzFY l0og== X-Gm-Message-State: APjAAAWyKTwrmmEN8reYwRAtUlFLUjvutgNW+iN5E52AgWi3bsaK2Z2j TV1nxdnrabbzZCpRW0v2c+x7pEdMBHM= X-Received: by 2002:a65:5905:: with SMTP id f5mr17972398pgu.87.1582582966092; Mon, 24 Feb 2020 14:22:46 -0800 (PST) Received: from localhost.localdomain (97-126-123-70.tukw.qwest.net. [97.126.123.70]) by smtp.gmail.com with ESMTPSA id o6sm13897097pgg.37.2020.02.24.14.22.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Feb 2020 14:22:45 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 09/17] target/arm: Replace ARM_FEATURE_VFP4 with isar_feature_aa32_simdfmac Date: Mon, 24 Feb 2020 14:22:24 -0800 Message-Id: <20200224222232.13807-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200224222232.13807-1-richard.henderson@linaro.org> References: <20200224222232.13807-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::443 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: , Cc: peter.maydell@linaro.org, qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" All remaining tests for VFP4 are for fused multiply-add insns. Since the MVFR1 field is used for both VFP and NEON, move its adjustment from the !has_neon block to the (!has_vfp && !has_neon) block. Test for vfp of the appropraite width alongside the test for simdfmac within translate-vfp.inc.c. Within disas_neon_data_insn, we have already tested for ARM_FEATURE_NEON. Signed-off-by: Richard Henderson --- v2: Applied Peter's fixups, plus test fpdp_v2 in trans_VFM_dp. --- target/arm/cpu.h | 12 ++++++++++++ target/arm/cpu.c | 6 +++++- target/arm/translate-vfp.inc.c | 22 ++++++++++++++++++---- target/arm/translate.c | 2 +- 4 files changed, 36 insertions(+), 6 deletions(-) -- 2.20.1 Reviewed-by: Peter Maydell diff --git a/target/arm/cpu.h b/target/arm/cpu.h index b94d2a5ace..b29b0eddfc 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -3514,6 +3514,18 @@ static inline bool isar_feature_aa32_fp16_dpconv(const ARMISARegisters *id) return FIELD_EX32(id->mvfr1, MVFR1, FPHP) > 1; } +/* + * Note that this ID register field covers both VFP and Neon FMAC, + * so should usually be tested in combination with some other + * check that confirms the presence of whichever of VFP or Neon is + * relevant, to avoid accidentally enabling a Neon feature on + * a VFP-no-Neon core or vice-versa. + */ +static inline bool isar_feature_aa32_simdfmac(const ARMISARegisters *id) +{ + return FIELD_EX32(id->mvfr1, MVFR1, SIMDFMAC) != 0; +} + static inline bool isar_feature_aa32_vsel(const ARMISARegisters *id) { return FIELD_EX32(id->mvfr2, MVFR2, FPMISC) >= 1; diff --git a/target/arm/cpu.c b/target/arm/cpu.c index f10f34b655..bdcaa46b8a 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -1501,7 +1501,6 @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp) u = FIELD_DP32(u, MVFR1, SIMDINT, 0); u = FIELD_DP32(u, MVFR1, SIMDSP, 0); u = FIELD_DP32(u, MVFR1, SIMDHP, 0); - u = FIELD_DP32(u, MVFR1, SIMDFMAC, 0); cpu->isar.mvfr1 = u; u = cpu->isar.mvfr2; @@ -1524,6 +1523,11 @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp) u = cpu->isar.mvfr0; u = FIELD_DP32(u, MVFR0, SIMDREG, 0); cpu->isar.mvfr0 = u; + + /* Despite the name, this field covers both VFP and Neon */ + u = cpu->isar.mvfr1; + u = FIELD_DP32(u, MVFR1, SIMDFMAC, 0); + cpu->isar.mvfr1 = u; } if (arm_feature(env, ARM_FEATURE_AARCH64) && diff --git a/target/arm/translate-vfp.inc.c b/target/arm/translate-vfp.inc.c index f88a95438f..03ba8d7aac 100644 --- a/target/arm/translate-vfp.inc.c +++ b/target/arm/translate-vfp.inc.c @@ -1803,11 +1803,18 @@ static bool trans_VFM_sp(DisasContext *s, arg_VFM_sp *a) /* * Present in VFPv4 only. + * Note that we can't rely on the SIMDFMAC check alone, because + * in a Neon-no-VFP core that ID register field will be non-zero. + */ + if (!dc_isar_feature(aa32_simdfmac, s) || + !dc_isar_feature(aa32_fpsp_v2, s)) { + return false; + } + /* * In v7A, UNPREDICTABLE with non-zero vector length/stride; from * v8A, must UNDEF. We choose to UNDEF for both v7A and v8A. */ - if (!arm_dc_feature(s, ARM_FEATURE_VFP4) || - (s->vec_len != 0 || s->vec_stride != 0)) { + if (s->vec_len != 0 || s->vec_stride != 0) { return false; } @@ -1861,11 +1868,18 @@ static bool trans_VFM_dp(DisasContext *s, arg_VFM_dp *a) /* * Present in VFPv4 only. + * Note that we can't rely on the SIMDFMAC check alone, because + * in a Neon-no-VFP core that ID register field will be non-zero. + */ + if (!dc_isar_feature(aa32_simdfmac, s) || + !dc_isar_feature(aa32_fpdp_v2, s)) { + return false; + } + /* * In v7A, UNPREDICTABLE with non-zero vector length/stride; from * v8A, must UNDEF. We choose to UNDEF for both v7A and v8A. */ - if (!arm_dc_feature(s, ARM_FEATURE_VFP4) || - (s->vec_len != 0 || s->vec_stride != 0)) { + if (s->vec_len != 0 || s->vec_stride != 0) { return false; } diff --git a/target/arm/translate.c b/target/arm/translate.c index 79880adaad..0489e0cdaa 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -5150,7 +5150,7 @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) } break; case NEON_3R_VFM_VQRDMLSH: - if (!arm_dc_feature(s, ARM_FEATURE_VFP4)) { + if (!dc_isar_feature(aa32_simdfmac, s)) { return 1; } break;