From patchwork Thu Jun 13 16:39:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 166733 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp1109253ilk; Thu, 13 Jun 2019 11:55:50 -0700 (PDT) X-Google-Smtp-Source: APXvYqzz0YKmEstQusso6i5xVlLtmCXbk5azlCa7LBDaNTFmk4UKQ/AIpGcW91WQ/3nO04QfMUpK X-Received: by 2002:ac8:30a7:: with SMTP id v36mr55279190qta.119.1560452150687; Thu, 13 Jun 2019 11:55:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560452150; cv=none; d=google.com; s=arc-20160816; b=Xd7q0hi4CoPfvryyUCRs/tdJNiLCSIriN+gLmd/IItJcUVtGZP8mEN+P0ySagbUup/ bVCB/pAJmmqhO2biHn1wRQGRN2EPJQU7JcgXSziT2pdIv3F4+4BRSjkRv3axODM1jMtO Rp/kmZv8md5b4tPZAyiL+kRiwArH5E94XPHlrFxZhH4PcJeKV9epCJUb2QGrJZilcUdK CX13yUvVA9+/fx8fR1oWrEqB0HKPNaa3TdBRGYej6R+98dp6vLoUvdJLEjSTuj68e1Ow xvinHa/HwIjNi5uXuVW/NI0ejrByFAJ4LcyLqPainlMen+LEJCJPOBP03PatyPBrc4wy QxKw== 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; bh=Gokt4IdrDcmmQcCA2l5TV7aYVHlbnHYyswQ2I9MjocE=; b=Z3efMKYizaQxsvUziaRf+zxXh2+yrH9Ji8ykoR5Mj0LUScP+PgEZ2mNMY3oED+E7GG 9QDPs5Fmv+3w89Tgk0aHMACr3SMY4udNNUn6PzouJQ9DHiSDwXR6F7+1+8Mi6M36rAKx 7/k/udDG1wyLcNkcqTIIZA6NuYdmtKE9S+TlgY7F3ctMnp4Yk+CXCzmMtmJdoodF4+4p 2LGjHfslo+NTdkyKTpBPmDXsXakxUEk/IlpWDiTrpAnwcETfO8qA9LgqFeziAW71YLvi JsWn5VO8uaW8iBvyS9MkI8xifQaXjdHoF4CVwfLiEvE/zvvcA8ihP6VaXRsGKIJeQ/Fe RG9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=BL1q1qQe; 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 y1si294681qke.225.2019.06.13.11.55.50 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 13 Jun 2019 11:55:50 -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=BL1q1qQe; 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]:43896 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hbUt4-0000vz-66 for patch@linaro.org; Thu, 13 Jun 2019 14:55:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53868) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hbSlL-0004Bb-Gy for qemu-devel@nongnu.org; Thu, 13 Jun 2019 12:39:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hbSlG-0003N8-Dt for qemu-devel@nongnu.org; Thu, 13 Jun 2019 12:39:43 -0400 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]:36101) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hbSlF-0001vw-RK for qemu-devel@nongnu.org; Thu, 13 Jun 2019 12:39:38 -0400 Received: by mail-wr1-x443.google.com with SMTP id n4so21552176wrs.3 for ; Thu, 13 Jun 2019 09:39:22 -0700 (PDT) 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=Gokt4IdrDcmmQcCA2l5TV7aYVHlbnHYyswQ2I9MjocE=; b=BL1q1qQed6sniZLbZricKmNJ1j42K79dZlrXG1nsxyCYust+0sy7c8/fSrz3ZFM2of jxfQ9obcZRGmAhFzeKFT+rKMv50w2O/BVEy08pWrgT/bswn5j+QjIC2n9dUHCKoHB6li cFhITtjdw3kNP3E22bhKpPJXD0fbuXa9EWRQ2jclzEIUBw/0HF4M+eOdMI9Gxzhu3S3Z dDZwFeIx/ZBEaCvWioAfoitpB5jYc9i1hYTylgnvzBokNLeLrW8oyuJCa6dGweHFEyFu Ylqq+9BwNL6sYzgUF531KKKl7PP1XxfvfrRrMH/2G+IiB+mrBM71+TNjcdqjDb4cil7f YK6w== 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=Gokt4IdrDcmmQcCA2l5TV7aYVHlbnHYyswQ2I9MjocE=; b=n1hxlC5RJoRKogM6x0mGWjavN+MKjl/ngkv9ypqQ+gTj83iGW9MNwbuoI+5ruo16oV gPzJXhRAwQW6yWGoFDRQm77Xc3uB1GB89qjYkC92F/AB+IAC3194crKI8QmGzDKDp2FY GFWXDfG5W+7IireOxa0zigEjx8W/AzoY99RBJiYuaJk38WQ0cFZWu+PWxISn4N2gju/B D1IDqjD7cGPsEF1smLGc+kLmRRip6usNBtsyUyLmMnhMjiJ0Atg4pzJwA/fwQOmd3sN3 JlPgp1nk+zWxsdlPNKPipUgAx7teQD1pNp6vqPdeuBrNE7ttY9SY61xbaByy+pWs1RjL dsiA== X-Gm-Message-State: APjAAAXYrg9kwkZczQ/hhz1CxlIAsHwSu6+N8sWMIshQ1yL35cLpkQqi R8Bv85ZauC0/UWNiA1Erx8Wsiw== X-Received: by 2002:a5d:4950:: with SMTP id r16mr15426905wrs.136.1560443961497; Thu, 13 Jun 2019 09:39:21 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id f197sm358747wme.39.2019.06.13.09.39.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Jun 2019 09:39:21 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Thu, 13 Jun 2019 17:39:07 +0100 Message-Id: <20190613163917.28589-3-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190613163917.28589-1-peter.maydell@linaro.org> References: <20190613163917.28589-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::443 Subject: [Qemu-devel] [PATCH 02/12] target/arm: Use vfp_expand_imm() for AArch32 VFP VMOV_imm 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: Richard Henderson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" The AArch32 VMOV (immediate) instruction uses the same VFP encoded immediate format we already handle in vfp_expand_imm(). Use that function rather than hand-decoding it. Suggested-by: Richard Henderson Signed-off-by: Peter Maydell --- target/arm/translate-vfp.inc.c | 28 ++++------------------------ target/arm/vfp.decode | 10 ++++++---- 2 files changed, 10 insertions(+), 28 deletions(-) -- 2.20.1 Reviewed-by: Richard Henderson diff --git a/target/arm/translate-vfp.inc.c b/target/arm/translate-vfp.inc.c index a66084f6e36..8b732761f26 100644 --- a/target/arm/translate-vfp.inc.c +++ b/target/arm/translate-vfp.inc.c @@ -1842,7 +1842,7 @@ static bool trans_VMOV_imm_sp(DisasContext *s, arg_VMOV_imm_sp *a) uint32_t delta_d = 0; int veclen = s->vec_len; TCGv_i32 fd; - uint32_t n, i, vd; + uint32_t vd; vd = a->vd; @@ -1869,17 +1869,7 @@ static bool trans_VMOV_imm_sp(DisasContext *s, arg_VMOV_imm_sp *a) } } - n = (a->imm4h << 28) & 0x80000000; - i = ((a->imm4h << 4) & 0x70) | a->imm4l; - if (i & 0x40) { - i |= 0x780; - } else { - i |= 0x800; - } - n |= i << 19; - - fd = tcg_temp_new_i32(); - tcg_gen_movi_i32(fd, n); + fd = tcg_const_i32(vfp_expand_imm(MO_32, a->imm)); for (;;) { neon_store_reg32(fd, vd); @@ -1902,7 +1892,7 @@ static bool trans_VMOV_imm_dp(DisasContext *s, arg_VMOV_imm_dp *a) uint32_t delta_d = 0; int veclen = s->vec_len; TCGv_i64 fd; - uint32_t n, i, vd; + uint32_t vd; vd = a->vd; @@ -1934,17 +1924,7 @@ static bool trans_VMOV_imm_dp(DisasContext *s, arg_VMOV_imm_dp *a) } } - n = (a->imm4h << 28) & 0x80000000; - i = ((a->imm4h << 4) & 0x70) | a->imm4l; - if (i & 0x40) { - i |= 0x3f80; - } else { - i |= 0x4000; - } - n |= i << 16; - - fd = tcg_temp_new_i64(); - tcg_gen_movi_i64(fd, ((uint64_t)n) << 32); + fd = tcg_const_i64(vfp_expand_imm(MO_64, a->imm)); for (;;) { neon_store_reg64(fd, vd); diff --git a/target/arm/vfp.decode b/target/arm/vfp.decode index ea24365bb4c..a67b3f29ee5 100644 --- a/target/arm/vfp.decode +++ b/target/arm/vfp.decode @@ -44,6 +44,8 @@ %vmov_idx_b 21:1 5:2 %vmov_idx_h 21:1 6:1 +%vmov_imm 16:4 0:4 + # VMOV scalar to general-purpose register; note that this does # include some Neon cases. VMOV_to_gp ---- 1110 u:1 1. 1 .... rt:4 1011 ... 1 0000 \ @@ -152,10 +154,10 @@ VFM_sp ---- 1110 1.10 .... .... 1010 . o2:1 . 0 .... \ VFM_dp ---- 1110 1.10 .... .... 1011 . o2:1 . 0 .... \ vm=%vm_dp vn=%vn_dp vd=%vd_dp o1=2 -VMOV_imm_sp ---- 1110 1.11 imm4h:4 .... 1010 0000 imm4l:4 \ - vd=%vd_sp -VMOV_imm_dp ---- 1110 1.11 imm4h:4 .... 1011 0000 imm4l:4 \ - vd=%vd_dp +VMOV_imm_sp ---- 1110 1.11 .... .... 1010 0000 .... \ + vd=%vd_sp imm=%vmov_imm +VMOV_imm_dp ---- 1110 1.11 .... .... 1011 0000 .... \ + vd=%vd_dp imm=%vmov_imm VMOV_reg_sp ---- 1110 1.11 0000 .... 1010 01.0 .... \ vd=%vd_sp vm=%vm_sp