From patchwork Fri Oct 13 16:24:38 2017 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: 115812 Delivered-To: patch@linaro.org Received: by 10.140.22.163 with SMTP id 32csp943389qgn; Fri, 13 Oct 2017 09:51:25 -0700 (PDT) X-Received: by 10.237.55.66 with SMTP id i60mr2826771qtb.176.1507913485613; Fri, 13 Oct 2017 09:51:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1507913485; cv=none; d=google.com; s=arc-20160816; b=JYeXcTBNMNV+x8LTiwgMr5ojeAWrZ5am8A/QnpolgS9iWBBa91czHEvTjhdLQZ4j7m zYq0SYFRScevEPPASqr4wkdzl8FQescd6WLXNhxM+rUuOeBdr/DG9EJvWY1QL+3sjH0P 7/BJCRPVneTbz3s3EPRbb4TRZiPFPGU17TNCBf9pgt+kiqmbUyfrxe2lrHS5QHNdbQ8p oI9NtH0WNdCX1qIIQ1Pp4aJpsHMXzIHlyLHNlQxis4xdI7+0ktsj09ZMWPbyJDdC3+dE ou3j1dYdHqWHtdgFdFIq6elrPszV8g/36DrF/WcjgDxR8PAZgptIpoYo2xfUdWomDmTW p0xA== 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=87WPXtEq182CYCLMvUSkyQhzyZD3smXOGfqeGXUeGV8=; b=K/Af4wbsAH/ox30wtaCNgwig+ZdWiuGCAkr8zMDRk9M2KZG69ECjLRImn8PCOlEHte ipjNEj/alEr3XOPJYnm/lGTSnbjR2R/WxiY6r0W/3YOkmG/ucQJpdO1PmojpYVtJvxND QqHzkWzh5u1SvTyMh0ZUCubhkmR3BGD/te/brzV2dOS7PMEomYfgedi1xi0CRZTHVcff 43jCZ70lE9jlRXHxDh3loP2ljQDOpNkhSf6EU5hVg35zQfn3leBdEU7dJGcv9PtOE2fM /Nbq/0i37bKhBD2bQObB5jOIV9rJnBdW1yLa38JgW9IhVOJSY40x4u+QHBryxp8kU1Ly uyvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=PLLyW+kY; 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 j102si609535qkh.206.2017.10.13.09.51.25 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 13 Oct 2017 09:51:25 -0700 (PDT) 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=PLLyW+kY; 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]:51172 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e33BD-0007FJ-42 for patch@linaro.org; Fri, 13 Oct 2017 12:51:23 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44242) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e32si-0000is-8E for qemu-devel@nongnu.org; Fri, 13 Oct 2017 12:32:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e32sg-0002Rk-Op for qemu-devel@nongnu.org; Fri, 13 Oct 2017 12:32:16 -0400 Received: from mail-wm0-x235.google.com ([2a00:1450:400c:c09::235]:55189) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1e32sg-0002Q1-Fz for qemu-devel@nongnu.org; Fri, 13 Oct 2017 12:32:14 -0400 Received: by mail-wm0-x235.google.com with SMTP id i124so22850347wmf.3 for ; Fri, 13 Oct 2017 09:32:14 -0700 (PDT) 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=87WPXtEq182CYCLMvUSkyQhzyZD3smXOGfqeGXUeGV8=; b=PLLyW+kYCV5tRs5Df6tTqns+BmO2rf15YskIsX7tmCbhJPtRRJV9pkLb4hom8atnfs HlUjdyZSZLhIfeHW0r3Aisr2bqmPcu8LXDNWFeZkEVpyE3IfjaR9Cc1GlKLF4EXLSOyY zBNQtwu62mWUC9GUCnvwRRDQ+0nLYqvaF1L9U= 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=87WPXtEq182CYCLMvUSkyQhzyZD3smXOGfqeGXUeGV8=; b=OSU7wR9G5ZOjo2uZwit+TvGvRW8fjaQUvQzMEC2GYzRmC8Qg8AEBjM8CNDS+hzp5Oy PvWTAfAEo4rDVg9WVGaiSsyW0AmufUxsW9dbSGxbipmqBmyUyViqGatY4RCMOGcL4KHT WsmJz61rv7DnJ3BtGP94F3YUmx1mYDT+U3IUxEyA3QBrLFiXK72lBvuyBE7ju+s8/zEC mJE/9jpNhf9UxDtPzfsTRloi4kyPKgrMYG3gfIQl/3J1YxzYJgkaB+X5Uo3cKzK+WCK3 mlCquaHiaHBJWJ3tvcziZjzMnsj580lsVgQycdOvD+o0GnzfBPBAnlZ/7dJ8u+XS+Qr5 i8aA== X-Gm-Message-State: AMCzsaUF1C7csJ5nCOFV0blZatG9LtFOsIaowKgi3ZWvaMXhjStNm2Z0 qS+8jndzFcbBt77JAKX7uNOM/w== X-Google-Smtp-Source: ABhQp+SIaYC6HMo2HEM7HBmSdvNXMtKUu7tHApORGaUKnPCvPxdbBFK5m9me166EIMd/tXWvu/z1Yw== X-Received: by 10.28.203.136 with SMTP id b130mr2090885wmg.105.1507912333359; Fri, 13 Oct 2017 09:32:13 -0700 (PDT) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id b190sm1223429wma.41.2017.10.13.09.32.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 13 Oct 2017 09:32:12 -0700 (PDT) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 9E6DC3E151E; Fri, 13 Oct 2017 17:24:40 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: richard.henderson@linaro.org Date: Fri, 13 Oct 2017 17:24:38 +0100 Message-Id: <20171013162438.32458-31-alex.bennee@linaro.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20171013162438.32458-1-alex.bennee@linaro.org> References: <20171013162438.32458-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::235 Subject: [Qemu-devel] [RFC PATCH 30/30] target/arm/translate-a64.c: add FP16 FCVTPS to 2 reg misc 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@linaro.org, qemu-arm@nongnu.org, =?utf-8?q?Alex_Benn?= =?utf-8?b?w6ll?= , 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 | 20 ++++++++++++++++++++ target/arm/helper-a64.h | 1 + target/arm/translate-a64.c | 7 +++++++ 3 files changed, 28 insertions(+) -- 2.14.1 diff --git a/target/arm/helper-a64.c b/target/arm/helper-a64.c index 63b2bbd4b2..1cc2758eac 100644 --- a/target/arm/helper-a64.c +++ b/target/arm/helper-a64.c @@ -639,3 +639,23 @@ uint32_t HELPER(advsimd_acgt_f16)(float16 a, float16 b, void *fpstp) float16 f1 = float16_abs(b); return -float16_lt(f1, f0, fpst); } + +/* + * Half-precision floating point conversion functions + * + * There are a multitude of conversion functions with various + * different rounding modes. This is dealt with by the calling code + * setting the mode appropriately before calling the helper. + */ + +uint32_t HELPER(advsimd_f16tosinth)(float16 a, void *fpstp) +{ + float_status *fpst = fpstp; + + /* Invalid if we are passed a NaN */ + if (float16_is_any_nan(a)) { + float_raise(float_flag_invalid, fpst); + return 0; + } + return float16_to_int16(a, fpst); +} diff --git a/target/arm/helper-a64.h b/target/arm/helper-a64.h index ce36d81091..73a985d1a4 100644 --- a/target/arm/helper-a64.h +++ b/target/arm/helper-a64.h @@ -60,3 +60,4 @@ 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_2(advsimd_rinth, f16, f16, ptr) +DEF_HELPER_2(advsimd_f16tosinth, i32, f16, ptr) diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index bbc0d96f01..ac71911a1a 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -10620,6 +10620,10 @@ static void disas_simd_two_reg_misc_fp16(DisasContext *s, uint32_t insn) need_rmode = true; rmode = FPROUNDING_POSINF; break; + case 0x2a: /* FCVTPS */ + need_rmode = true; + rmode = FPROUNDING_POSINF; + break; default: fprintf(stderr,"%s: insn %#04x fpop %#2x\n", __func__, insn, fpop); g_assert_not_reached(); @@ -10647,6 +10651,9 @@ static void disas_simd_two_reg_misc_fp16(DisasContext *s, uint32_t insn) read_vec_element_i32(s, tcg_op, rn, pass, MO_16); switch (fpop) { + case 0x2a: /* FCVTPS */ + gen_helper_advsimd_f16tosinth(tcg_res, tcg_op, tcg_fpstatus); + break; case 0x28: /* FRINTP */ gen_helper_advsimd_rinth(tcg_res, tcg_op, tcg_fpstatus); break;