From patchwork Fri Feb 23 15:36:16 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: 129406 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp751538lja; Fri, 23 Feb 2018 07:47:59 -0800 (PST) X-Google-Smtp-Source: AG47ELtmU7IFy85yn5C5UDicylkjkcF+ZWRFSeOBmx54ObuCHncOSobhbghpsccdgwP2alVhahAW X-Received: by 2002:a25:b087:: with SMTP id f7-v6mr1414345ybj.247.1519400879076; Fri, 23 Feb 2018 07:47:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519400879; cv=none; d=google.com; s=arc-20160816; b=Uo7MyYZCRVWUYJL97E9ahympxYSY60C/MlImMPEoe3bPSuMvX4T8ZP4yXfcEWt51cN MPlVT4rrxty9RVnWx9BUhRWTj00ljCDpJ9EJ+3J+pq5U1MRjciP98e4Oy4+LZn2OIhju jMNEN+qt8Fh4X2rs8RJAQZHgQ6A+dM5v5QtwEWxuUUN2PKLfEjbqhJ5+2/OsB4e6+69n bIoCdvblgw8GAqSdIfqTobvrdulhMpSTDRLkbrWHWpYxoS+1Gnz1c+ESKj9BWG2moYFJ JnmT4Xg3JllCchX66CWwM0I1YUKJ7K4yHmAkj140FW319Rr7p8YNMKOosNDLQiD9Qj09 NmWA== 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=LKAZFc3rihLsNwzpvrBqYrmTrGRYoEULslG1Yu5iQhs=; b=rmO+BCLCs3FM7ecYtV4KQ4T6WM37mLUvEnf0inHqFCj2M++W6nPs+BSHbemRH/TTzJ IPaW/r/V8UrHVbUMr3ds2TsxHbm63S8f/rm5SqiJZtQTtDdZjMuMK18i9/eQJwc8SwD7 AxFxgODmERKKzwI9khSg5lWUdwXCMRprgjwipI2NQP6crUTo0b+DGaVccGkhpYprbv9r 4RlcuFUTk4jJNcIPLrppnBIB6LnMgIL9sD99NepGRRman31eoSNgs8xRP7L7fIBjOFnO QJusiG2FwN5FLrtJGbcDloXCklRJY1GDdY7iP2GUJ04rnf21pnf33S4JIEwKgN9fYyb8 54ag== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=BpcpTGBc; 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 z23si447998ywj.539.2018.02.23.07.47.58 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 23 Feb 2018 07:47:59 -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=BpcpTGBc; 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]:45303 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1epFZm-0003uR-A4 for patch@linaro.org; Fri, 23 Feb 2018 10:47:58 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45929) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1epFUh-0008Qi-1E for qemu-devel@nongnu.org; Fri, 23 Feb 2018 10:42:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1epFUc-0005ZC-Bh for qemu-devel@nongnu.org; Fri, 23 Feb 2018 10:42:43 -0500 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]:40489) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1epFUc-0005XL-2b for qemu-devel@nongnu.org; Fri, 23 Feb 2018 10:42:38 -0500 Received: by mail-wm0-x241.google.com with SMTP id t82so5357226wmt.5 for ; Fri, 23 Feb 2018 07:42:37 -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=LKAZFc3rihLsNwzpvrBqYrmTrGRYoEULslG1Yu5iQhs=; b=BpcpTGBcZuLjWDWlL2UfsUIXzUTAymlZL0qIr2Z5BA3RozpBP2Gpq0N9/nRA3RsIDP 5NKg9xh+6wDNIw7V6jFJhZnFOQJR/eWtY517bCWChad5kz9lxJF6bQSY71YiC1pSHeV5 3x+fixf9XmP9CRlAf0f42BXCV7yp9bOGMsBj8= 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=LKAZFc3rihLsNwzpvrBqYrmTrGRYoEULslG1Yu5iQhs=; b=Ypy/qFsqZmSxsnuSib7TZCELf5K9n9CYZtcHbfj3Du55xGGfX9OdctLZzLTdGm4fn/ uTWwaiwEAEwzdZ6JSDuAdI9dZWZ+3ZJnEaxRxuP5oliSmJWrxtKmCVocAKMsqoHUbRLC eubHwY6yQVWG3WkC26YrpfHmOb8skjvHqqCnaJsXOKuI87OIeQmIIAJ/cv8/HibV68vn 7n/hmuLhGHiXBqDJGETQjuKC3GBfTKyEJEe9Mga+z8RldLLYYem5V3Me+66wWpyAnq5j NaNyh5sEoK3rVISHKU90yCLo+8HfrM4tdOnuoo9LYxfRaoGk0j68m0DCNdQZE3Wdt3Nz O8QA== X-Gm-Message-State: APf1xPD6+iqKRt/K0Vd+zKnjJiJ1gdxDeXKYiW6RPelV9Tl+1wSPfgW5 QmokV3G19XBjcDmOuOQprvvsow== X-Received: by 10.28.227.86 with SMTP id a83mr2236896wmh.3.1519400556940; Fri, 23 Feb 2018 07:42:36 -0800 (PST) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id 7sm2117551wmq.42.2018.02.23.07.42.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Feb 2018 07:42:32 -0800 (PST) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 57FBE3E0968; Fri, 23 Feb 2018 15:36:37 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-arm@nongnu.org Date: Fri, 23 Feb 2018 15:36:16 +0000 Message-Id: <20180223153636.29809-12-alex.bennee@linaro.org> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180223153636.29809-1-alex.bennee@linaro.org> References: <20180223153636.29809-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:c09::241 Subject: [Qemu-devel] [PATCH v3 11/31] 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: =?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" Signed-off-by: Alex Bennée Reviewed-by: Richard Henderson --- 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 diff --git a/target/arm/helper-a64.c b/target/arm/helper-a64.c index d0b284fec4..1ef13abd76 100644 --- a/target/arm/helper-a64.c +++ b/target/arm/helper-a64.c @@ -595,6 +595,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 1cf40bda5e..9c1a95594c 100644 --- a/target/arm/helper-a64.h +++ b/target/arm/helper-a64.h @@ -61,3 +61,5 @@ DEF_HELPER_3(advsimd_cge_f16, i32, f16, f16, ptr) DEF_HELPER_3(advsimd_cgt_f16, i32, f16, f16, ptr) DEF_HELPER_3(advsimd_acge_f16, i32, f16, f16, ptr) DEF_HELPER_3(advsimd_acgt_f16, i32, f16, f16, ptr) +DEF_HELPER_3(advsimd_mulxh, f16, f16, f16, ptr) +DEF_HELPER_4(advsimd_muladdh, f16, f16, f16, f16, ptr) diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index fb74dc1c45..0e2d298687 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -10286,9 +10286,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; @@ -10298,6 +10306,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;