From patchwork Tue Feb 27 14:38:32 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: 129819 Delivered-To: patch@linaro.org Received: by 10.80.172.228 with SMTP id x91csp376626edc; Tue, 27 Feb 2018 07:00:59 -0800 (PST) X-Google-Smtp-Source: AH8x225JZgQCNjBTkbsBWgKifULjxsDDvX2TxOTJK7qru/lUAB1KKsULlucoqOB9dLw3N2Dd8KTA X-Received: by 10.13.238.69 with SMTP id x66mr9802097ywe.1.1519743659078; Tue, 27 Feb 2018 07:00:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519743659; cv=none; d=google.com; s=arc-20160816; b=kuoS1HUHWOjef0hIF64F+jR8oftjhPdfs0R3/pRnnXPinHtFqvI6QsaIYMUgNPW2Sr 0iM2wGJmGyO1CY1D2P7bgWk9+RsubRVHvzqmsb5zW9C90o7W0DM87IQUV6d/qc54U0ZG vgxTSzI9mtWKDmvLpDiYVoeUZBC/5r9VfRwzaE+OLtBLCeSeE0QFrHYDVmEohNAg5Noh 7zxpTXmJir1HfyoH7loHOa6lsJRrV8DyoU/Jn6JXZHgu/t8L5I/wOAmpIbtQCR2ASHyU LP4dzB5wyW6mBPpyKjo4PZHNDRj7TzfV3LZplTVLW5TfWMhPPyUd42QkuSn++GEx+A60 JyuQ== 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=iBqH45SlFBObnvwfLPHwxoabm4TR09xPqJ3hh9QJl+39EW8ZdOWXq8vJHNGI57wpjm A+rsH0xJ1TCnrftpEJ9+zYkcRYxYd7G1YshA0dfFo9hGWbGhCYcWX2kpUpVFjOLGfmFx n5fw/lJ8X1UtfToou6dB3YfVHMsqtnAHobe+Sk8f5r4frsDYHptqg0VVPtpt6nin7hn5 Al6DW2MXitZ5dvk8f2mrb74iOgnpCHnVpHSmmRtuPqIcKxhRfn7Hr/MXmssZ29rh6evl rMgqBzUHeWmIcOtAqJ1NhzczgJpgSql32OuM+05/5HqzboM4TeD7HOBvb18kqQ6LWR0O Bx2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=aSGhOc95; 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 h1si1891474ywd.378.2018.02.27.07.00.58 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 27 Feb 2018 07:00: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=aSGhOc95; 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]:37829 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eqgkU-0006LV-F4 for patch@linaro.org; Tue, 27 Feb 2018 10:00:58 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58302) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eqgY4-0003Wv-4c for qemu-devel@nongnu.org; Tue, 27 Feb 2018 09:48:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eqgY1-0001Fs-Rk for qemu-devel@nongnu.org; Tue, 27 Feb 2018 09:48:08 -0500 Received: from mail-wr0-x244.google.com ([2a00:1450:400c:c0c::244]:38942) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eqgY1-0001Bh-H2 for qemu-devel@nongnu.org; Tue, 27 Feb 2018 09:48:05 -0500 Received: by mail-wr0-x244.google.com with SMTP id w77so25110384wrc.6 for ; Tue, 27 Feb 2018 06:48:05 -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=aSGhOc95PbBOORCWn33+A4HtJQgce3qZxlSBEmhxM6/hpXgu8xbDVloZXDPZ/JxQqj fg1IjpCGgadhtf1QlYQS4iWSzm5BIzuq8lPCGByhnZSgnkHwKa1csXO8334o3xYaCwka 7aIwhTKUgKheRsA5XVzgLwIisGJOD2ZelbhC0= 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=OVdzQCD7Mfbj1Equgs8uE4TUc7YviI2t6vgsTj2oFVDjYWSzWc54+50JEqibZYFGLT fNrpHdnQa5ZvDh3ju825GDdmjBdPSaDgQQjve4/X8nBsbWqbrkTxnajM3jxRNrhi/bl8 ykgP2n5kirRc/3lqLpy10YGHrSNvNnQUdOyTr4FaGId73UYZRxrj5cAWhGDGckoh9TTf Gn37WcCOWo0aeY/Ih/z3vDvvFDS0xnhdik/9HQ4Yk5D1swSuOiUB/1wc6Iqd2zInN6yE ZylElvpkLzrzmT3Sxrw0D+bthJIEC34Ilr+GrHdIEdQJ/C5XpIFu4Yvomzt5NgDlh1Co UZPA== X-Gm-Message-State: APf1xPDyxzxO9nB028DBYfR3cifvp1yZ8jbZCv7lJwL9Sw2LFDp2uXr+ syi+y6Q6UZRB7xgxOdJ5dupcjA== X-Received: by 10.223.182.16 with SMTP id f16mr12563089wre.51.1519742884379; Tue, 27 Feb 2018 06:48:04 -0800 (PST) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id 142sm5623865wmq.47.2018.02.27.06.48.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 27 Feb 2018 06:48:00 -0800 (PST) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id B5F653E0A1A; Tue, 27 Feb 2018 14:38:53 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-arm@nongnu.org Date: Tue, 27 Feb 2018 14:38:32 +0000 Message-Id: <20180227143852.11175-12-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::244 Subject: [Qemu-devel] [PATCH v4 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;