From nobody Thu Dec 18 22:23:39 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1519905300010529.428812932183; Thu, 1 Mar 2018 03:55:00 -0800 (PST) Received: from localhost ([::1]:55875 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1erMnb-0001Io-1g for importer@patchew.org; Thu, 01 Mar 2018 06:54:59 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34061) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1erMK8-0003xr-8E for qemu-devel@nongnu.org; Thu, 01 Mar 2018 06:24:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1erMK7-0008Et-7v for qemu-devel@nongnu.org; Thu, 01 Mar 2018 06:24:32 -0500 Received: from orth.archaic.org.uk ([2001:8b0:1d0::2]:46724) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1erMK6-0008EX-W2 for qemu-devel@nongnu.org; Thu, 01 Mar 2018 06:24:31 -0500 Received: from pm215 by orth.archaic.org.uk with local (Exim 4.89) (envelope-from ) id 1erMK6-0000gV-1z for qemu-devel@nongnu.org; Thu, 01 Mar 2018 11:24:30 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Date: Thu, 1 Mar 2018 11:23:57 +0000 Message-Id: <20180301112403.12487-37-peter.maydell@linaro.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180301112403.12487-1-peter.maydell@linaro.org> References: <20180301112403.12487-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:8b0:1d0::2 Subject: [Qemu-devel] [PULL 36/42] arm/translate-a64: add FP16 FMOV to simd_mod_imm 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 From: Alex Benn=C3=A9e Only one half-precision instruction has been added to this group. Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Richard Henderson Message-id: 20180227143852.11175-29-alex.bennee@linaro.org Signed-off-by: Peter Maydell --- target/arm/translate-a64.c | 35 +++++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index 86231b33bb..7c2bc05b92 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -6234,6 +6234,8 @@ static void disas_simd_copy(DisasContext *s, uint32_t= insn) * MVNI - move inverted (shifted) imm into register * ORR - bitwise OR of (shifted) imm with register * BIC - bitwise clear of (shifted) imm with register + * With ARMv8.2 we also have: + * FMOV half-precision */ static void disas_simd_mod_imm(DisasContext *s, uint32_t insn) { @@ -6248,8 +6250,11 @@ static void disas_simd_mod_imm(DisasContext *s, uint= 32_t insn) uint64_t imm =3D 0; =20 if (o2 !=3D 0 || ((cmode =3D=3D 0xf) && is_neg && !is_q)) { - unallocated_encoding(s); - return; + /* Check for FMOV (vector, immediate) - half-precision */ + if (!(arm_dc_feature(s, ARM_FEATURE_V8_FP16) && o2 && cmode =3D=3D= 0xf)) { + unallocated_encoding(s); + return; + } } =20 if (!fp_access_check(s)) { @@ -6307,19 +6312,29 @@ static void disas_simd_mod_imm(DisasContext *s, uin= t32_t insn) imm |=3D 0x4000000000000000ULL; } } else { - imm =3D (abcdefgh & 0x3f) << 19; - if (abcdefgh & 0x80) { - imm |=3D 0x80000000; - } - if (abcdefgh & 0x40) { - imm |=3D 0x3e000000; + if (o2) { + /* FMOV (vector, immediate) - half-precision */ + imm =3D vfp_expand_imm(MO_16, abcdefgh); + /* now duplicate across the lanes */ + imm =3D bitfield_replicate(imm, 16); } else { - imm |=3D 0x40000000; + imm =3D (abcdefgh & 0x3f) << 19; + if (abcdefgh & 0x80) { + imm |=3D 0x80000000; + } + if (abcdefgh & 0x40) { + imm |=3D 0x3e000000; + } else { + imm |=3D 0x40000000; + } + imm |=3D (imm << 32); } - imm |=3D (imm << 32); } } break; + default: + fprintf(stderr, "%s: cmode_3_1: %x\n", __func__, cmode_3_1); + g_assert_not_reached(); } =20 if (cmode_3_1 !=3D 7 && is_neg) { --=20 2.16.2