From patchwork Thu Feb 8 17:31:37 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: 127702 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp1722762ljc; Thu, 8 Feb 2018 09:56:05 -0800 (PST) X-Google-Smtp-Source: AH8x224qTT7jN+l8IIaF/RRBmIMbAaal2gjFgHiK6ymFkxGZkMjdJp2z6kk35D781VLJunFYlaZh X-Received: by 10.37.132.80 with SMTP id r16mr10457ybm.518.1518112564899; Thu, 08 Feb 2018 09:56:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518112564; cv=none; d=google.com; s=arc-20160816; b=uJ3eNJ6NbgERl4aSf05Td9yFBBcMHOB+8hSMd5e5lE92hMPzq3LPG0QVZGzKE+YoHD ezpew/nEgP7x+jWcVYh2rB+DCkDsxOzaxgEnYSH0sk9GmuFKLYMavXUH6NXYNsNSLrLN cT2XMlEmCcd34Q5xmSBU9o6iozybx1J/9ilxX755k+PW+jYkmTsMxYmxC/gz6nmhotXB 66+yopu9udLzYq1k01viB2MzsMIkL8/Q0TdxMK2CXAs+/qWuFYOc8b5u+zdn7kHAhwEo 4EnyAa4dJh2VAd/qwgTcZBv4zv2YFT2u8Uq9BeS6+mEvGNq9pfNub92R9Fd2g9vL2kDt fcSA== 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=zKekfPRdNRQZgO4ZfZdHphlQ8CAk9rt0M5+bxZUrcbg=; b=YZK1HhZbDI2NEu4yxM5VVRLoKUV1lIWVKhcVyiMKF+AcVBcJTJ/CsrXKIke4fBZZZl FEJsXQxnVft2UiCdjSjfZEuDscXeCtR2HJqxvYFpdG+RYL5JfSm7Go8WWQA7PE7C0ee7 qlJpc45+9Ny/SmqHIeiQDqA0vsvYNp1ik8ogWkLGokDxKjedkAEkpi4gtJpi1Lm2+YXL Y5VUTw1PoP6omS5TQq6BvUYhiHyoeqNUPtdUiMdxbcVt+GspvlUY4Pcg63cx2oSuwfuK UbTyzMGIA8GYRWOumBf5BM6M8YzruWRCg6R3C4fRDb1SoAZkTvXgVT3GQMxDJ0PkgD4C UDSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=dVGCnWkA; 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 x204si83921ybx.309.2018.02.08.09.56.04 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 08 Feb 2018 09:56:04 -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=dVGCnWkA; 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]:57652 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ejqQW-0007WZ-9B for patch@linaro.org; Thu, 08 Feb 2018 12:56:04 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54522) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ejq3X-0003VG-54 for qemu-devel@nongnu.org; Thu, 08 Feb 2018 12:32:22 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ejq3Q-0006qG-RP for qemu-devel@nongnu.org; Thu, 08 Feb 2018 12:32:19 -0500 Received: from mail-wr0-x243.google.com ([2a00:1450:400c:c0c::243]:46267) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ejq3Q-0006nZ-L8 for qemu-devel@nongnu.org; Thu, 08 Feb 2018 12:32:12 -0500 Received: by mail-wr0-x243.google.com with SMTP id 111so2694627wrb.13 for ; Thu, 08 Feb 2018 09:32:12 -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=zKekfPRdNRQZgO4ZfZdHphlQ8CAk9rt0M5+bxZUrcbg=; b=dVGCnWkApWRCsnhaHCpsT7VndlJVdM11LBM9k5GrE85/hy8VfX2FtTxFJXPwr9jHBv r8zKiWOmwc1kqNT87Fpr86uMfaZq7A1vBe3/W+i+QImARR1iSO4erM3Q53pP0dxQDsZF 3rN69ViB1OfNTmUvjJV6snl9oFgEU8kEEncuo= 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=zKekfPRdNRQZgO4ZfZdHphlQ8CAk9rt0M5+bxZUrcbg=; b=d3kYniT8a0SouAgp/N9fzQ2p8G2CsEJECOo1D5GaE7YDKEJDFrYHUsXd3r+e6n5JXG D5f2VZIr4xquyqzvQUy4ofvqNbKlYPkQhwZhPTLXo/c59mDVMBTA9IG4JKd/1eqvl8d8 HpISFS++CKiolIAiwbIfYQL1Fiwhwjm3LhIEZNujiyd27vL3iOvAE7QF6/3t9qnW1rUo 9H2xjsSQocBOfoo/t8GnNSykoOvVQ0SghmBhih9tnwjy7NMKwkxoO8d6MbJ+h8SXcHBO qhnFb9tQIaJ6x/9wQ50AX6JlCFgKon4KMTcheImdGlvdLwVYN/OozxsWubGhC/BsWb74 NEPA== X-Gm-Message-State: APf1xPAi7dOqYm/K/cnsEJGSclFjaEQeUBSVN+OdE5XaxZaitXFvlctn IyyzzEHycNbb6eW3SoFmMLkQQQ== X-Received: by 10.223.173.119 with SMTP id p110mr1597595wrc.69.1518111131458; Thu, 08 Feb 2018 09:32:11 -0800 (PST) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id i4sm465815wmf.3.2018.02.08.09.32.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 08 Feb 2018 09:32:05 -0800 (PST) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 9F86A3E0CCF; Thu, 8 Feb 2018 17:31:58 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-arm@nongnu.org Date: Thu, 8 Feb 2018 17:31:37 +0000 Message-Id: <20180208173157.24705-13-alex.bennee@linaro.org> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180208173157.24705-1-alex.bennee@linaro.org> References: <20180208173157.24705-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::243 Subject: [Qemu-devel] [PATCH v2 12/32] arm/translate-a64: add FP16 FMULA/X/S to simd_three_reg_same_fp16 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: Peter Maydell , =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Alex Bennée --- target/arm/helper-a64.c | 24 ++++++++++++++++++++++++ target/arm/helper-a64.h | 2 ++ target/arm/translate-a64.c | 15 +++++++++++++++ 3 files changed, 41 insertions(+) -- 2.15.1 Reviewed-by: Richard Henderson diff --git a/target/arm/helper-a64.c b/target/arm/helper-a64.c index 78eeda31d1..bdfcac111f 100644 --- a/target/arm/helper-a64.c +++ b/target/arm/helper-a64.c @@ -600,6 +600,30 @@ ADVSIMD_HALFOP(max) ADVSIMD_HALFOP(minnum) ADVSIMD_HALFOP(maxnum) +/* Data processing - scalar floating-point and advanced SIMD */ +float16 HELPER(advsimd_mulxh)(float16 a, float16 b, void *fpstp) +{ + float_status *fpst = fpstp; + + a = float16_squash_input_denormal(a, fpst); + b = float16_squash_input_denormal(b, fpst); + + if ((float16_is_zero(a) && float16_is_infinity(b)) || + (float16_is_infinity(a) && float16_is_zero(b))) { + /* 2.0 with the sign bit set to sign(A) XOR sign(B) */ + return make_float16((1U << 14) | + ((float16_val(a) ^ float16_val(b)) & (1U << 15))); + } + return float16_mul(a, b, fpst); +} + +/* fused multiply-accumulate */ +float16 HELPER(advsimd_muladdh)(float16 a, float16 b, float16 c, void *fpstp) +{ + float_status *fpst = fpstp; + return float16_muladd(a, b, c, 0, fpst); +} + /* * Floating point comparisons produce an integer result. Softfloat * routines return float_relation types which we convert to the 0/-1 diff --git a/target/arm/helper-a64.h b/target/arm/helper-a64.h index e701644ae7..7900299efd 100644 --- a/target/arm/helper-a64.h +++ b/target/arm/helper-a64.h @@ -57,6 +57,8 @@ DEF_HELPER_3(advsimd_maxh, f16, f16, f16, ptr) DEF_HELPER_3(advsimd_minh, f16, f16, f16, ptr) DEF_HELPER_3(advsimd_maxnumh, f16, f16, f16, ptr) DEF_HELPER_3(advsimd_minnumh, f16, f16, f16, ptr) +DEF_HELPER_3(advsimd_mulxh, f16, f16, f16, ptr) +DEF_HELPER_4(advsimd_muladdh, f16, f16, f16, f16, ptr) DEF_HELPER_3(advsimd_ceq_f16, i32, f16, f16, ptr) DEF_HELPER_3(advsimd_cge_f16, i32, f16, f16, ptr) DEF_HELPER_3(advsimd_cgt_f16, i32, f16, f16, ptr) diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index 14572f26e1..3eec52eb34 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -9852,9 +9852,17 @@ static void disas_simd_three_reg_same_fp16(DisasContext *s, uint32_t insn) case 0x0: /* FMAXNM */ gen_helper_advsimd_maxnumh(tcg_res, tcg_op1, tcg_op2, fpst); break; + case 0x1: /* FMLA */ + read_vec_element_i32(s, tcg_res, rd, pass, MO_16); + gen_helper_advsimd_muladdh(tcg_res, tcg_op1, tcg_op2, tcg_res, + fpst); + break; case 0x2: /* FADD */ gen_helper_advsimd_addh(tcg_res, tcg_op1, tcg_op2, fpst); break; + case 0x3: /* FMULX */ + gen_helper_advsimd_mulxh(tcg_res, tcg_op1, tcg_op2, fpst); + break; case 0x4: /* FCMEQ */ gen_helper_advsimd_ceq_f16(tcg_res, tcg_op1, tcg_op2, fpst); break; @@ -9864,6 +9872,13 @@ static void disas_simd_three_reg_same_fp16(DisasContext *s, uint32_t insn) case 0x8: /* FMINNM */ gen_helper_advsimd_minnumh(tcg_res, tcg_op1, tcg_op2, fpst); break; + case 0x9: /* FMLS */ + /* As usual for ARM, separate negation for fused multiply-add */ + tcg_gen_xori_i32(tcg_op1, tcg_op1, 0x8000); + read_vec_element_i32(s, tcg_res, rd, pass, MO_16); + gen_helper_advsimd_muladdh(tcg_res, tcg_op1, tcg_op2, tcg_res, + fpst); + break; case 0xa: /* FSUB */ gen_helper_advsimd_subh(tcg_res, tcg_op1, tcg_op2, fpst); break;