From patchwork Thu Jun 13 12:14:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 166629 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp719576ilk; Thu, 13 Jun 2019 05:51:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqxlc+vh+mke49riIsOpB5Oz12QceObDDV8k+bPhEJIaf6ymKTxVN7wfi2okqRXpNXf7lUrf X-Received: by 2002:ac8:156:: with SMTP id f22mr56900800qtg.58.1560430292777; Thu, 13 Jun 2019 05:51:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560430292; cv=none; d=google.com; s=arc-20160816; b=jP3MsvLF3LI6FL2687o8otNos9uTecXm2rb0ercLeNjF7qvJUnNBymituyfKOBKh0T S6nrmrHGAk8xC25tsD7B0SA+nYGEVVSAv2q6neAJgEnYP/yc6H5P8blyDvjBocLSKQVf d+PNOgFTt2w4sXLMxSXrGYr1MfaxneQd12giUIEibEFo9sOF8LYhiEuh+HCE+I8M+a9Z HG7jntSu6EqBijANwRBYeH4k3Jv8UstDrr2QD8n2s5k57p/9BUm3PeZEdLVzb+ZnFc7N zgH94BEegZgIMAbBde+JZCQx/aeuVMWBFc/rSQBIvRXNDUFpY2vgGKlO5Xt7OrZuycE+ uEHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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=IRZuW3taWPCfJ37rwCt/vodP6fN4Yy7faj6/F0vMpBk=; b=XXyB5SPD//I+Ix1OTO1IA/AVDPPbHFt+vpvS0sR4CQYJvmrUhaC/pXTBTsbKUfkrzU dSqzBYqd8TnCYxmko7wHg31NDlahZx+N4vVQ6djwO7X7UtIuCuwJeG1e+xMKV3o4dGLx MnXunU7mrTYfwIpkYxgH+2wz1/Q+nyZeagDPTlLxTRoDyR1K3UgrudqYTGjxZfdGOqYw y0eTqiScdxOKQjMTq4aQCgRXm6TqDdnL7XkBXB94HUH95UZol4QD5JvTvuQe/TiPlyNF obQ46sGvUR9/ozyAGEUqd5vwsASAVmJWveCdXCw13bPjp2NS4aDN5788lR/5yFMd40dB nxiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=oLQA8r7U; 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 c30si1808161qtk.109.2019.06.13.05.51.32 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 13 Jun 2019 05:51:32 -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=oLQA8r7U; 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]:39504 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hbPCW-0006Z5-Bp for patch@linaro.org; Thu, 13 Jun 2019 08:51:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59025) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hbOdL-00080Z-Ce for qemu-devel@nongnu.org; Thu, 13 Jun 2019 08:15:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hbOdH-0004Kj-FG for qemu-devel@nongnu.org; Thu, 13 Jun 2019 08:15:10 -0400 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]:34022) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hbOdF-0004GR-Bq for qemu-devel@nongnu.org; Thu, 13 Jun 2019 08:15:05 -0400 Received: by mail-wr1-x436.google.com with SMTP id k11so2349590wrl.1 for ; Thu, 13 Jun 2019 05:15:04 -0700 (PDT) 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=IRZuW3taWPCfJ37rwCt/vodP6fN4Yy7faj6/F0vMpBk=; b=oLQA8r7UuXmNoTYEPEC6QiGnVdR3Zc2aIIXxn27myZqylPWNSxqWsCg4nvMWQ+n4xl XjMGrKl84vH/c6iRM7YL99EuU67nCat1bZbnDz367Dhh7kqbKm0F1wJCdbvl6svdjn5L gNen86jGdt2uUTUFfu9sS/tn5QZd2UwrJNrg0m0yhty1y0oYj47nlV2/kuM44JsjiRTD pERp1BAIgZsFy5u4/Wkcp34pr/SRbb7RUOZblMR3SJsspuoF/4LeEOI5dSB2whFq79T8 1H/Df1y+nPPcutC3FNNN0Utc0mwvGX9GuICypDfJ1eTFvNnMCaGHGPalLqpAc9k6Jsss 4XNg== 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=IRZuW3taWPCfJ37rwCt/vodP6fN4Yy7faj6/F0vMpBk=; b=kUhqxBpH+jCSaoY2Yh0PsaXQ51URrUqEVKe6XIWPrzPF9fCntPSVlNpOqOIW47r6o4 UQHU+Ff8TouiBipOP2GUcionNVDx/l46/0JilTwCyCc4DRi1wkmlQJh38xJ7a7BhybGs nmPjcrqRM6Ufi/e5l+ob0YgIYNzo4G8wab5MlmU6B9qW77dPMLgi2FLhtmSPWQ+jpCVi 3/D5gn5kN22O7iQGoSgcxMDfeS4+UuIYWsAdnWF5rTao+0IK7bnM01XPpcPTB2kXlrhN IjbMyai5ZNst3Gyxvmds17ka6rOalNjJo3Nkm0pPdh7BnX4GU+cVQCNKQe3anWH9F8h7 PknA== X-Gm-Message-State: APjAAAXrTor5Q9jBWNoUJ3N7ySVALk+20fV0ehMNrq6awnOOJ2mmrvDy PrOSwKvDzJ32uClf1lYp+642kHoAk024Nw== X-Received: by 2002:adf:a18a:: with SMTP id u10mr37082207wru.351.1560428103352; Thu, 13 Jun 2019 05:15:03 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id y6sm2010576wrp.12.2019.06.13.05.15.02 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Jun 2019 05:15:02 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Date: Thu, 13 Jun 2019 13:14:10 +0100 Message-Id: <20190613121433.5246-26-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190613121433.5246-1-peter.maydell@linaro.org> References: <20190613121433.5246-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::436 Subject: [Qemu-devel] [PULL 25/48] target/arm: Convert VFP VMLS to decodetree 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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Convert the VFP VMLS instruction to decodetree. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- target/arm/translate-vfp.inc.c | 38 ++++++++++++++++++++++++++++++++++ target/arm/translate.c | 8 +------ target/arm/vfp.decode | 5 +++++ 3 files changed, 44 insertions(+), 7 deletions(-) -- 2.20.1 diff --git a/target/arm/translate-vfp.inc.c b/target/arm/translate-vfp.inc.c index 4f922dc8405..00f64401dda 100644 --- a/target/arm/translate-vfp.inc.c +++ b/target/arm/translate-vfp.inc.c @@ -1303,3 +1303,41 @@ static bool trans_VMLA_dp(DisasContext *s, arg_VMLA_sp *a) { return do_vfp_3op_dp(s, gen_VMLA_dp, a->vd, a->vn, a->vm, true); } + +static void gen_VMLS_sp(TCGv_i32 vd, TCGv_i32 vn, TCGv_i32 vm, TCGv_ptr fpst) +{ + /* + * VMLS: vd = vd + -(vn * vm) + * Note that order of inputs to the add matters for NaNs. + */ + TCGv_i32 tmp = tcg_temp_new_i32(); + + gen_helper_vfp_muls(tmp, vn, vm, fpst); + gen_helper_vfp_negs(tmp, tmp); + gen_helper_vfp_adds(vd, vd, tmp, fpst); + tcg_temp_free_i32(tmp); +} + +static bool trans_VMLS_sp(DisasContext *s, arg_VMLS_sp *a) +{ + return do_vfp_3op_sp(s, gen_VMLS_sp, a->vd, a->vn, a->vm, true); +} + +static void gen_VMLS_dp(TCGv_i64 vd, TCGv_i64 vn, TCGv_i64 vm, TCGv_ptr fpst) +{ + /* + * VMLS: vd = vd + -(vn * vm) + * Note that order of inputs to the add matters for NaNs. + */ + TCGv_i64 tmp = tcg_temp_new_i64(); + + gen_helper_vfp_muld(tmp, vn, vm, fpst); + gen_helper_vfp_negd(tmp, tmp); + gen_helper_vfp_addd(vd, vd, tmp, fpst); + tcg_temp_free_i64(tmp); +} + +static bool trans_VMLS_dp(DisasContext *s, arg_VMLS_sp *a) +{ + return do_vfp_3op_dp(s, gen_VMLS_dp, a->vd, a->vn, a->vm, true); +} diff --git a/target/arm/translate.c b/target/arm/translate.c index ad8f947a13b..2afab7fbc20 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -3134,7 +3134,7 @@ static int disas_vfp_insn(DisasContext *s, uint32_t insn) rn = VFP_SREG_N(insn); switch (op) { - case 0: + case 0 ... 1: /* Already handled by decodetree */ return 1; default: @@ -3320,12 +3320,6 @@ static int disas_vfp_insn(DisasContext *s, uint32_t insn) for (;;) { /* Perform the calculation. */ switch (op) { - case 1: /* VMLS: fd + -(fn * fm) */ - gen_vfp_mul(dp); - gen_vfp_F1_neg(dp); - gen_mov_F0_vreg(dp, rd); - gen_vfp_add(dp); - break; case 2: /* VNMLS: -fd + (fn * fm) */ /* Note that it isn't valid to replace (-A + B) with (B - A) * or similar plausible looking simplifications diff --git a/target/arm/vfp.decode b/target/arm/vfp.decode index 9530e17ae02..7bcf2260eec 100644 --- a/target/arm/vfp.decode +++ b/target/arm/vfp.decode @@ -102,3 +102,8 @@ VMLA_sp ---- 1110 0.00 .... .... 1010 .0.0 .... \ vm=%vm_sp vn=%vn_sp vd=%vd_sp VMLA_dp ---- 1110 0.00 .... .... 1011 .0.0 .... \ vm=%vm_dp vn=%vn_dp vd=%vd_dp + +VMLS_sp ---- 1110 0.00 .... .... 1010 .1.0 .... \ + vm=%vm_sp vn=%vn_sp vd=%vd_sp +VMLS_dp ---- 1110 0.00 .... .... 1011 .1.0 .... \ + vm=%vm_dp vn=%vn_dp vd=%vd_dp