From patchwork Thu Feb 8 17:31:38 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: 127707 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp1728580ljc; Thu, 8 Feb 2018 10:02:19 -0800 (PST) X-Google-Smtp-Source: AH8x2272uDEOA+Eg0OqCYlrB4+Zrb90kJ3K2ZvRV/nUH7XoEzPwbjmd4KBZ5jOMgWpIhV0wei2y8 X-Received: by 10.129.89.136 with SMTP id n130mr49678ywb.120.1518112939075; Thu, 08 Feb 2018 10:02:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518112939; cv=none; d=google.com; s=arc-20160816; b=NlrYY9CeA/Y/WLEiTaKh3V+ea8THMWYACJSsJafB4mc6Q/Fqq7pkDOQa6jqpcYL2tY 3lT/lJUMkufY6qs8LIV8YuC10SQu5cFMspStX+kqfAN1T66bwwdZkw7I7mp1iJ8CqaoP ozOhE1JvMEXkB8e2Vlcdpci2PIP5NOi+yX2ZhwNsv0VhHKARx1T777+pEEgvjpT7MAYi mvY66EbST07Rl2PL4DzbyErTMZEI9E39DbYwLjzDbrzU3Nj0uHRpJVN7KJHNx5mj0o4N jhtKHIj9gM6ChV2AM1uMGl46/R2ij5wPkxldYeIjph7DJL0SbyRKFIrsMRfe+RRbF0gG s01w== 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=pAq6OsJvcEL7YIM5ZKCSeNXORnbygdjHwbQD2LUH//E=; b=hgSfso8zRrlEN+fogXtZmfr87c00RNJS3qX5cUtJiaDwsCGXXVWJ4BzaFOrtvZsh5m wjTOJZmSv82XNb5ekV0PjmlInynVuj32pX1DLLZQ29w/vx+UFe1IqLKzQiVKRmc5OCIx WMapBY5K8Y20ZMPfpmIsFugAw9XJHhtIzfZ5cajYKzxj/WLLfTWJwOGWaUr0kKmaq/vk O42eb6ufAGZUdOx4xa2LOPCkA6edPquXUevY2Gip6tBPvF6jSI0WpkpKcqOjxh1oknvf x7WEcpRSidiXw3rQljiBN1A9StTIL+ovyDDUsBuSG6qetghFLkUiGWScvKryu/RE7Hpp a1Gw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=a+K8mHID; 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 a13si83816ybj.720.2018.02.08.10.02.18 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 08 Feb 2018 10:02:19 -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=a+K8mHID; 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]:58020 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ejqWY-0005eu-Cm for patch@linaro.org; Thu, 08 Feb 2018 13:02:18 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54452) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ejq3V-0003Sv-C5 for qemu-devel@nongnu.org; Thu, 08 Feb 2018 12:32:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ejq3T-0006v2-VJ for qemu-devel@nongnu.org; Thu, 08 Feb 2018 12:32:17 -0500 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:34332) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ejq3T-0006tZ-K1 for qemu-devel@nongnu.org; Thu, 08 Feb 2018 12:32:15 -0500 Received: by mail-wm0-x242.google.com with SMTP id j21so408025wmh.1 for ; Thu, 08 Feb 2018 09:32:15 -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=pAq6OsJvcEL7YIM5ZKCSeNXORnbygdjHwbQD2LUH//E=; b=a+K8mHIDPJqvjzaEh0IfLoiSz7ihZdocnEEtL8FeEj5HJJU/TM//QVblTwwLEAZzcm 0DEe7uRTcIWCHRUSPHKZtZn56izbCJogOJtjJ5UoTF0UMzNuxEK+YtC3MzzA/1C42/6X Elq4/MvKTTNFkU8WTUV7a7vVaSOnBisJFQ5t0= 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=pAq6OsJvcEL7YIM5ZKCSeNXORnbygdjHwbQD2LUH//E=; b=cqkzmiu+bONgk0djguBczvx/iiWgLKcmhOgBWiSLheHYvtQz+DdlVHEbx6ZY7VhjQX g/GkLx8Sqdv89mti52CFVRY4STwnW5A7LsUiz0QQ7bUCfVaRHJTQcCvue6DI0y+cO7el uJsr91D+glqFzqpa2ZiFbYVLXRMigsWwDgVfDS/OBkknaWdhSEt0FTGTVRvE+Eo2ebAa AzVP2HG2UcCYiWdBD7y6Wfoxg0BOM56kRal9+QJFusiQ1nJV3AGGoWFKYeMXVsBiaCFS WY7kuYXrP8+IvDtnYLrMnebTg//TqUKJ/RUDyoAUcST3GOqE0rGaFhmYvqKWQbNfyHf0 K3aQ== X-Gm-Message-State: APf1xPCso/p3j/X1gr2C+SZv38Fm44K7ImhLq/EsuqvLVp1Ghghv/DEr p+aZ0Hr3UWz7aveO5fsCxrgfzw== X-Received: by 10.28.35.200 with SMTP id j191mr33569wmj.146.1518111134471; Thu, 08 Feb 2018 09:32:14 -0800 (PST) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id o82sm415421wmo.30.2018.02.08.09.32.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 08 Feb 2018 09:32:08 -0800 (PST) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id B222B3E0CDE; 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:38 +0000 Message-Id: <20180208173157.24705-14-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:c09::242 Subject: [Qemu-devel] [PATCH v2 13/32] arm/translate-a64: add FP16 FR[ECP/SQRT]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 | 34 ++++++++++++++++++++++++++++++++++ target/arm/helper-a64.h | 2 ++ target/arm/translate-a64.c | 6 ++++++ 3 files changed, 42 insertions(+) -- 2.15.1 Reviewed-by: Richard Henderson diff --git a/target/arm/helper-a64.c b/target/arm/helper-a64.c index bdfcac111f..6358b42472 100644 --- a/target/arm/helper-a64.c +++ b/target/arm/helper-a64.c @@ -192,6 +192,10 @@ uint64_t HELPER(neon_cgt_f64)(float64 a, float64 b, void *fpstp) * versions, these do a fully fused multiply-add or * multiply-add-and-halve. */ +#define float16_two make_float16(0x4000) +#define float16_three make_float16(0x4200) +#define float16_one_point_five make_float16(0x3e00) + #define float32_two make_float32(0x40000000) #define float32_three make_float32(0x40400000) #define float32_one_point_five make_float32(0x3fc00000) @@ -200,6 +204,21 @@ uint64_t HELPER(neon_cgt_f64)(float64 a, float64 b, void *fpstp) #define float64_three make_float64(0x4008000000000000ULL) #define float64_one_point_five make_float64(0x3FF8000000000000ULL) +float16 HELPER(recpsf_f16)(float16 a, float16 b, void *fpstp) +{ + float_status *fpst = fpstp; + + a = float16_squash_input_denormal(a, fpst); + b = float16_squash_input_denormal(b, fpst); + + a = float16_chs(a); + if ((float16_is_infinity(a) && float16_is_zero(b)) || + (float16_is_infinity(b) && float16_is_zero(a))) { + return float16_two; + } + return float16_muladd(a, b, float16_two, 0, fpst); +} + float32 HELPER(recpsf_f32)(float32 a, float32 b, void *fpstp) { float_status *fpst = fpstp; @@ -230,6 +249,21 @@ float64 HELPER(recpsf_f64)(float64 a, float64 b, void *fpstp) return float64_muladd(a, b, float64_two, 0, fpst); } +float16 HELPER(rsqrtsf_f16)(float16 a, float16 b, void *fpstp) +{ + float_status *fpst = fpstp; + + a = float16_squash_input_denormal(a, fpst); + b = float16_squash_input_denormal(b, fpst); + + a = float16_chs(a); + if ((float16_is_infinity(a) && float16_is_zero(b)) || + (float16_is_infinity(b) && float16_is_zero(a))) { + return float16_one_point_five; + } + return float16_muladd(a, b, float16_three, float_muladd_halve_result, fpst); +} + float32 HELPER(rsqrtsf_f32)(float32 a, float32 b, void *fpstp) { float_status *fpst = fpstp; diff --git a/target/arm/helper-a64.h b/target/arm/helper-a64.h index 7900299efd..d347f473d4 100644 --- a/target/arm/helper-a64.h +++ b/target/arm/helper-a64.h @@ -29,8 +29,10 @@ DEF_HELPER_FLAGS_3(vfp_mulxd, TCG_CALL_NO_RWG, f64, f64, f64, ptr) DEF_HELPER_FLAGS_3(neon_ceq_f64, TCG_CALL_NO_RWG, i64, i64, i64, ptr) DEF_HELPER_FLAGS_3(neon_cge_f64, TCG_CALL_NO_RWG, i64, i64, i64, ptr) DEF_HELPER_FLAGS_3(neon_cgt_f64, TCG_CALL_NO_RWG, i64, i64, i64, ptr) +DEF_HELPER_FLAGS_3(recpsf_f16, TCG_CALL_NO_RWG, f16, f16, f16, ptr) DEF_HELPER_FLAGS_3(recpsf_f32, TCG_CALL_NO_RWG, f32, f32, f32, ptr) DEF_HELPER_FLAGS_3(recpsf_f64, TCG_CALL_NO_RWG, f64, f64, f64, ptr) +DEF_HELPER_FLAGS_3(rsqrtsf_f16, TCG_CALL_NO_RWG, f16, f16, f16, ptr) DEF_HELPER_FLAGS_3(rsqrtsf_f32, TCG_CALL_NO_RWG, f32, f32, f32, ptr) DEF_HELPER_FLAGS_3(rsqrtsf_f64, TCG_CALL_NO_RWG, f64, f64, f64, ptr) DEF_HELPER_FLAGS_1(neon_addlp_s8, TCG_CALL_NO_RWG_SE, i64, i64) diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index 3eec52eb34..06fbf9df24 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -9869,6 +9869,9 @@ static void disas_simd_three_reg_same_fp16(DisasContext *s, uint32_t insn) case 0x6: /* FMAX */ gen_helper_advsimd_maxh(tcg_res, tcg_op1, tcg_op2, fpst); break; + case 0x7: /* FRECPS */ + gen_helper_recpsf_f16(tcg_res, tcg_op1, tcg_op2, fpst); + break; case 0x8: /* FMINNM */ gen_helper_advsimd_minnumh(tcg_res, tcg_op1, tcg_op2, fpst); break; @@ -9885,6 +9888,9 @@ static void disas_simd_three_reg_same_fp16(DisasContext *s, uint32_t insn) case 0xe: /* FMIN */ gen_helper_advsimd_minh(tcg_res, tcg_op1, tcg_op2, fpst); break; + case 0xf: /* FRSQRTS */ + gen_helper_rsqrtsf_f16(tcg_res, tcg_op1, tcg_op2, fpst); + break; case 0x13: /* FMUL */ gen_helper_advsimd_mulh(tcg_res, tcg_op1, tcg_op2, fpst); break;