From patchwork Tue Feb 27 14:38:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 129814 Delivered-To: patch@linaro.org Received: by 10.80.172.228 with SMTP id x91csp369751edc; Tue, 27 Feb 2018 06:54:49 -0800 (PST) X-Google-Smtp-Source: AG47ELt9JbH9Bjv/o0yGPXR7Vmlgec0GtKv4F74GdigRWprEDTA3eAAFWACNKNOsjpilmj+GV/MQ X-Received: by 2002:a25:69d1:: with SMTP id e200-v6mr9079896ybc.253.1519743289387; Tue, 27 Feb 2018 06:54:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519743289; cv=none; d=google.com; s=arc-20160816; b=PlXNXAzH2Sd/tvhYcxwLk+IoGUXggXBu2kHyQC5d9EnJKb85+Hs20zYQXScbs+xNlD 7hKhkgi5kuoznxImR0KBaq2xoYatD9UYsGOepPzc+rJBmwhv4SrFCKNTUY7UFxuII6qv YU6AeuJmiIbGcezhvVPjdcQZ/ePkVMSpvtHgNCLmj1gL/k+jswOxYj1yEKl7r9IVVofQ 5qW9LDHpdAOGiZeH+VDoQPyCtLzK8nhREOEhkuPy81zpJ4u6gMKg1F0wvVNBg1K2PCvA +IK3Ktk9aT6mwrrcHU7LRKSgMhzWTPFKYVPk3/hNTPMbJZgeqF1yaEm9pVKdBNnVXR/T 6RYw== 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:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=+HnaMoj4oqRgZrPNtvzv7OqJLDnl27LXHLWnw27T2VI=; b=0VekscziR+GjAq8is/vUADyGKReG3yaettVdy3YDT8eQ+aiJP1B/aKDBs7PAIURp7n tNmgxODXrKialJC0aFlJXeBRaIP/8f5CKxWaAIhptHxBg4/HUIvpl3BmuMKH8SRYQ6G4 pYeowT/G5QVUEpywbjj43v+w7cNpAUKR/vNCGzbsftF9W9KPE7pimgGPSEMb6Wtxjbum iwpJ7L/NQUf7rYsz7dyja/D3lMmo8KeksjpxB9iM5UTGqTNuZISIdsABp4kJhLHEDqCe H4D0BDNgbItvKYwDwshCYG9MfvqKfn0g2WcVW/AJdmvRJtMYjk7bHBdkLNLcIjzclEQ2 URvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=FyJZC9rF; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 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. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id t131si820947ywb.736.2018.02.27.06.54.49 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 27 Feb 2018 06:54:49 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=FyJZC9rF; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 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]:37772 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eqgeW-0000fQ-Qz for patch@linaro.org; Tue, 27 Feb 2018 09:54:48 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56029) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eqgPU-0003nS-0x for qemu-devel@nongnu.org; Tue, 27 Feb 2018 09:39:17 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eqgPT-00085V-4t for qemu-devel@nongnu.org; Tue, 27 Feb 2018 09:39:16 -0500 Received: from mail-wr0-x242.google.com ([2a00:1450:400c:c0c::242]:38868) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eqgPS-00084v-P3 for qemu-devel@nongnu.org; Tue, 27 Feb 2018 09:39:15 -0500 Received: by mail-wr0-x242.google.com with SMTP id n7so25120784wrn.5 for ; Tue, 27 Feb 2018 06:39:14 -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=+HnaMoj4oqRgZrPNtvzv7OqJLDnl27LXHLWnw27T2VI=; b=FyJZC9rFjwWLMTLc0Ee449KvdL40v05Bd2KzjcXu2+jK5g+wKcclOF8vAg5OZp7G7E jdds/N5KSdxpdpGDxX+mpEvOxJb+EynU+GMbTs/caZivZgyQgFB2DY+PYpalkYg4rdpk K6y4KoHbbc+QrJHnTDTK4gzJak1+kqXjE62J0= 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=+HnaMoj4oqRgZrPNtvzv7OqJLDnl27LXHLWnw27T2VI=; b=twpHLOscEUhFY4WTcwVByDDUKepRG8BKWZcdjhN0mW+P4CDBbRv7mTvFazaXsNwPY7 Fxxc1lIYWO+lkzB3ZMLnpYxHoaG7Ip0tCnZgG+QMSIyPBXPAZlKTGlCPWKcZVxYORf7I Hk8EreWtxBOFTQcrglZYUAceTlxcMDz8jSB+ahp4daL8WLD5+wk4c/7ZL28Wx+z4Z8L1 M8mswPfuFQPa274vuwjx36AH/ld9sokqq+PgKfI86QhOyok7TSpdtp/V04dQfo0S7rmQ 4lb1ra8qhhKpZFoi+swstUYd/m8d88XM3jtU8fUQhWptrdqqQfe+dfliNk4sZdcGE5pk 5Jzg== X-Gm-Message-State: APf1xPDdnabiXe+eHhxvOuR2icB1ggqycxWeffCcl1u8KthhMzJps97s B18PtKObQqCcOWT5KY4cJGkZfA== X-Received: by 10.223.200.2 with SMTP id d2mr12614117wrh.81.1519742353674; Tue, 27 Feb 2018 06:39:13 -0800 (PST) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id w29sm11239614wra.84.2018.02.27.06.39.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 27 Feb 2018 06:39:09 -0800 (PST) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 0AF343E165A; Tue, 27 Feb 2018 14:38:55 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-arm@nongnu.org Date: Tue, 27 Feb 2018 14:38:49 +0000 Message-Id: <20180227143852.11175-29-alex.bennee@linaro.org> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180227143852.11175-1-alex.bennee@linaro.org> References: <20180227143852.11175-1-alex.bennee@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:400c:c0c::242 Subject: [Qemu-devel] [PATCH v4 28/31] 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: , Cc: =?utf-8?q?Alex_Benn=C3=A9e?= , richard.henderson@linaro.org, qemu-devel@nongnu.org, Peter Maydell Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Only one half-precision instruction has been added to this group. Signed-off-by: Alex Bennée Reviewed-by: Richard Henderson --- v2 - checkpatch fixes v3 - use vfp_expand_imm --- target/arm/translate-a64.c | 35 +++++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 10 deletions(-) -- 2.15.1 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, uint32_t insn) uint64_t imm = 0; if (o2 != 0 || ((cmode == 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 == 0xf)) { + unallocated_encoding(s); + return; + } } if (!fp_access_check(s)) { @@ -6307,19 +6312,29 @@ static void disas_simd_mod_imm(DisasContext *s, uint32_t insn) imm |= 0x4000000000000000ULL; } } else { - imm = (abcdefgh & 0x3f) << 19; - if (abcdefgh & 0x80) { - imm |= 0x80000000; - } - if (abcdefgh & 0x40) { - imm |= 0x3e000000; + if (o2) { + /* FMOV (vector, immediate) - half-precision */ + imm = vfp_expand_imm(MO_16, abcdefgh); + /* now duplicate across the lanes */ + imm = bitfield_replicate(imm, 16); } else { - imm |= 0x40000000; + imm = (abcdefgh & 0x3f) << 19; + if (abcdefgh & 0x80) { + imm |= 0x80000000; + } + if (abcdefgh & 0x40) { + imm |= 0x3e000000; + } else { + imm |= 0x40000000; + } + imm |= (imm << 32); } - imm |= (imm << 32); } } break; + default: + fprintf(stderr, "%s: cmode_3_1: %x\n", __func__, cmode_3_1); + g_assert_not_reached(); } if (cmode_3_1 != 7 && is_neg) {