From patchwork Thu Mar 1 11:23:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 130178 Delivered-To: patch@linaro.org Received: by 10.80.172.228 with SMTP id x91csp2743361edc; Thu, 1 Mar 2018 04:37:09 -0800 (PST) X-Google-Smtp-Source: AG47ELu2s9U1GsFH18u2yUzxlXgI9GfadzqrkNrf2fj/OacYntghUai4zAYtEsrvrjhVTTsroMAB X-Received: by 2002:a25:ff12:: with SMTP id c18-v6mr941258ybe.271.1519907829551; Thu, 01 Mar 2018 04:37:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519907829; cv=none; d=google.com; s=arc-20160816; b=HSOFm+QEJSA+0I+kp8c0btsbqDqFTJU5Qqavm55Pczd1ZT0+cp3MAEHRTrHVogdtAm oRfxbaPcCf+6aXADO5w0IPZnJHMn0cSQj9cJR8OlR8gA98km3lKhkbSnbgABQ0RFdHzY XjI7v3KezyYeLq93DSUtK/O5eniFLyHVdt5Nxq5ThcFFKO9eWRQLNhNQ4H28K35sLqiQ XhUKv5ynyKYw3oStjeBKUtBqJHq2Io2RmsEh3rVWGjw/uvy2RP3fKEx27tyVSorMY5Z0 e66p1fZtCxU5nnWQAeyGxtjfqMH74xkrNM2we1/C1jgbt+1MRZJ6psyY+Fc6CpXuBUVV T8VQ== 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:arc-authentication-results; bh=+ijtLWoSqfnN6nkgyYQ/yWpkPSFF1qGiUCyrxB20Ak4=; b=rQjQrQvyhezXVgsEWij+Oo0UbLpjJt//y2oUM/LHRgMq0JiVt7XFuXojz3E61rgiHY F3CezUMvVJg43h0wg387oFG1FW8u3QheP+Qj/FFKg9WooWZdTM1h7ey4MUm6onsDkNg3 eBKpQsgYeEwvazozkwVqr0CyT8y6WdyhokJkzK+UYyNrf/JPoJBD+NN9sA2oZhHr2BkE bnct+GN7t0hJHkVgdyN/y8ErrRNnKNItydR3HYK8eN3YISH75kTfQW3q+umY1p45Wyhf 29T/advplNTNUQYp7OKMPXBRTAMWMWrS95eAD1HHZ9R6RKkI1szTO0wBBqSea623PTP9 Dw3g== ARC-Authentication-Results: i=1; mx.google.com; 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 d67-v6si619290ybb.609.2018.03.01.04.37.09 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 01 Mar 2018 04:37:09 -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; 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]:55848 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1erMjD-0006AA-Q1 for patch@linaro.org; Thu, 01 Mar 2018 06:50:27 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34008) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1erMK5-0003uG-EJ for qemu-devel@nongnu.org; Thu, 01 Mar 2018 06:24:30 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1erMK4-0008Dl-BG for qemu-devel@nongnu.org; Thu, 01 Mar 2018 06:24:29 -0500 Received: from orth.archaic.org.uk ([2001:8b0:1d0::2]:46720) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1erMK4-0008DQ-4t for qemu-devel@nongnu.org; Thu, 01 Mar 2018 06:24:28 -0500 Received: from pm215 by orth.archaic.org.uk with local (Exim 4.89) (envelope-from ) id 1erMK3-0000fQ-87 for qemu-devel@nongnu.org; Thu, 01 Mar 2018 11:24:27 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Date: Thu, 1 Mar 2018 11:23:53 +0000 Message-Id: <20180301112403.12487-33-peter.maydell@linaro.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180301112403.12487-1-peter.maydell@linaro.org> References: <20180301112403.12487-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: 2001:8b0:1d0::2 Subject: [Qemu-devel] [PULL 32/42] arm/translate-a64: add FP16 FRCPX to simd_two_reg_misc_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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Alex Bennée We go with the localised helper. Signed-off-by: Alex Bennée Reviewed-by: Richard Henderson Message-id: 20180227143852.11175-25-alex.bennee@linaro.org Signed-off-by: Peter Maydell --- target/arm/helper-a64.h | 1 + target/arm/helper-a64.c | 29 +++++++++++++++++++++++++++++ target/arm/translate-a64.c | 4 ++++ 3 files changed, 34 insertions(+) -- 2.16.2 diff --git a/target/arm/helper-a64.h b/target/arm/helper-a64.h index 32931b17c6..339323fc3d 100644 --- a/target/arm/helper-a64.h +++ b/target/arm/helper-a64.h @@ -41,6 +41,7 @@ DEF_HELPER_FLAGS_1(neon_addlp_s16, TCG_CALL_NO_RWG_SE, i64, i64) DEF_HELPER_FLAGS_1(neon_addlp_u16, TCG_CALL_NO_RWG_SE, i64, i64) DEF_HELPER_FLAGS_2(frecpx_f64, TCG_CALL_NO_RWG, f64, f64, ptr) DEF_HELPER_FLAGS_2(frecpx_f32, TCG_CALL_NO_RWG, f32, f32, ptr) +DEF_HELPER_FLAGS_2(frecpx_f16, TCG_CALL_NO_RWG, f16, f16, ptr) DEF_HELPER_FLAGS_2(fcvtx_f64_to_f32, TCG_CALL_NO_RWG, f32, f64, env) DEF_HELPER_FLAGS_3(crc32_64, TCG_CALL_NO_RWG_SE, i64, i64, i64, i32) DEF_HELPER_FLAGS_3(crc32c_64, TCG_CALL_NO_RWG_SE, i64, i64, i64, i32) diff --git a/target/arm/helper-a64.c b/target/arm/helper-a64.c index 722fff2349..92a0d55a9c 100644 --- a/target/arm/helper-a64.c +++ b/target/arm/helper-a64.c @@ -356,6 +356,35 @@ uint64_t HELPER(neon_addlp_u16)(uint64_t a) } /* Floating-point reciprocal exponent - see FPRecpX in ARM ARM */ +float16 HELPER(frecpx_f16)(float16 a, void *fpstp) +{ + float_status *fpst = fpstp; + uint16_t val16, sbit; + int16_t exp; + + if (float16_is_any_nan(a)) { + float16 nan = a; + if (float16_is_signaling_nan(a, fpst)) { + float_raise(float_flag_invalid, fpst); + nan = float16_maybe_silence_nan(a, fpst); + } + if (fpst->default_nan_mode) { + nan = float16_default_nan(fpst); + } + return nan; + } + + val16 = float16_val(a); + sbit = 0x8000 & val16; + exp = extract32(val16, 10, 5); + + if (exp == 0) { + return make_float16(deposit32(sbit, 10, 5, 0x1e)); + } else { + return make_float16(deposit32(sbit, 10, 5, ~exp)); + } +} + float32 HELPER(frecpx_f32)(float32 a, void *fpstp) { float_status *fpst = fpstp; diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index 50b4fa4ce4..715dc4333d 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -11312,6 +11312,7 @@ static void disas_simd_two_reg_misc_fp16(DisasContext *s, uint32_t insn) handle_2misc_fcmp_zero(s, fpop, is_scalar, 0, is_q, MO_16, rn, rd); return; case 0x3d: /* FRECPE */ + case 0x3f: /* FRECPX */ break; case 0x18: /* FRINTN */ need_rmode = true; @@ -11436,6 +11437,9 @@ static void disas_simd_two_reg_misc_fp16(DisasContext *s, uint32_t insn) case 0x3d: /* FRECPE */ gen_helper_recpe_f16(tcg_res, tcg_op, tcg_fpstatus); break; + case 0x3f: /* FRECPX */ + gen_helper_frecpx_f16(tcg_res, tcg_op, tcg_fpstatus); + break; case 0x5a: /* FCVTNU */ case 0x5b: /* FCVTMU */ case 0x5c: /* FCVTAU */