From nobody Fri Dec 19 19:14:20 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 150056389005697.3267051669028; Thu, 20 Jul 2017 08:18:10 -0700 (PDT) Received: from localhost ([::1]:38548 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dYDDH-0000Ci-S2 for importer@patchew.org; Thu, 20 Jul 2017 11:18:03 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55580) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dYD83-00039T-0o for qemu-devel@nongnu.org; Thu, 20 Jul 2017 11:12:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dYD82-0004Jx-3W for qemu-devel@nongnu.org; Thu, 20 Jul 2017 11:12:39 -0400 Received: from mail-wm0-x229.google.com ([2a00:1450:400c:c09::229]:35043) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dYD81-0004JN-T7 for qemu-devel@nongnu.org; Thu, 20 Jul 2017 11:12:38 -0400 Received: by mail-wm0-x229.google.com with SMTP id w126so27195883wme.0 for ; Thu, 20 Jul 2017 08:12:37 -0700 (PDT) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id r3sm4081875wra.97.2017.07.20.08.12.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Jul 2017 08:12:32 -0700 (PDT) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id B8A753E0B27; Thu, 20 Jul 2017 16:04:33 +0100 (BST) 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=+YSM1TSI70fvNJ6R6uDo0JFbaepCnTrr91TNW11bOvo=; b=KYYJYL6Radr40XChi4rkuqRlvevwtiwtkkZ/UcTPK90dRE9vjFnqanjGdY8mAXJAJr 5dXc9YqAWb4p2xi5anuzLgVnngccLqraJ3+NAMLKfmPCP1h6TSye/R2SGxAQ8labvudf UDSu5sX3iNJzHkfnwBSahVdaaes7is4jPz9fI= 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=+YSM1TSI70fvNJ6R6uDo0JFbaepCnTrr91TNW11bOvo=; b=A4ehnw7Rg7C5YfbYp0ENYF3FVswRG05Q8cmtD9xowsYMsyooDdlQPAFM5HJq4cD9G/ kQmIZouqt58uKMXoBW7Y0sQDQM5FI+PjGLtR2YyxfhJ7/PYrDxp+6vqGr5wsPNHkHWrS EqVzWjt1xdjrT7Bf316h73myHRo+T1EnCyhrywMrrtymyIqnxdRaqlzKcOay9rR3N92i E6D4bvf5BpfJTeh4Iu8W+5GK8Fphs73w7h5SsSgHmYf7t8qh7U0AB+u1b/ScBocnWbrR tzxTnjClIH4E9X+n15H+oSCWDEMNPW9mS3u2YK7qMFCJM6/Ys3DRre0L3n6yBPo9f1Fq RkrQ== X-Gm-Message-State: AIVw113H0PCDpZXF6H9G51vPp97Fww2hkc0j1faqxfcUNUlnqKlOQyWk S/tZlFDHEU8YZw3YFKRAEA== X-Received: by 10.28.178.204 with SMTP id b195mr2327003wmf.99.1500563556869; Thu, 20 Jul 2017 08:12:36 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Thu, 20 Jul 2017 16:04:21 +0100 Message-Id: <20170720150426.12393-19-alex.bennee@linaro.org> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170720150426.12393-1-alex.bennee@linaro.org> References: <20170720150426.12393-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::229 Subject: [Qemu-devel] [RFC PATCH for 2.11 18/23] fpu/softfloat2a: implement float16_squash_input_denormal 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: qemu-arm@nongnu.org, =?UTF-8?q?Alex=20Benn=C3=A9e?= , qemu-devel@nongnu.org, Aurelien Jarno , rth@twiddle.net Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 This will be required when expanding the MINMAX() macro for 16 bit/half-precision operations. Signed-off-by: Alex Benn=C3=A9e --- fpu/softfloat2a/softfloat.c | 15 +++++++++++++++ include/fpu/softfloat2a/softfloat.h | 1 + 2 files changed, 16 insertions(+) diff --git a/fpu/softfloat2a/softfloat.c b/fpu/softfloat2a/softfloat.c index 59b9bc9e24..4f1abbe08f 100644 --- a/fpu/softfloat2a/softfloat.c +++ b/fpu/softfloat2a/softfloat.c @@ -3488,6 +3488,21 @@ static float16 roundAndPackFloat16(flag zSign, int z= Exp, return packFloat16(zSign, zExp, zSig >> 13); } =20 +/*------------------------------------------------------------------------= ---- +| If `a' is denormal and we are in flush-to-zero mode then set the +| input-denormal exception and return zero. Otherwise just return the valu= e. +*-------------------------------------------------------------------------= ---*/ +float16 float16_squash_input_denormal(float16 a, float_status *status) +{ + if (status->flush_inputs_to_zero) { + if (extractFloat16Exp(a) =3D=3D 0 && extractFloat16Frac(a) !=3D 0)= { + float_raise(float_flag_input_denormal, status); + return make_float16(float16_val(a) & 0x8000); + } + } + return a; +} + static void normalizeFloat16Subnormal(uint32_t aSig, int *zExpPtr, uint32_t *zSigPtr) { diff --git a/include/fpu/softfloat2a/softfloat.h b/include/fpu/softfloat2a/= softfloat.h index d9689eca2a..a274dc7419 100644 --- a/include/fpu/softfloat2a/softfloat.h +++ b/include/fpu/softfloat2a/softfloat.h @@ -282,6 +282,7 @@ void float_raise(uint8_t flags, float_status *status); | If `a' is denormal and we are in flush-to-zero mode then set the | input-denormal exception and return zero. Otherwise just return the valu= e. *-------------------------------------------------------------------------= ---*/ +float16 float16_squash_input_denormal(float16 a, float_status *status); float32 float32_squash_input_denormal(float32 a, float_status *status); float64 float64_squash_input_denormal(float64 a, float_status *status); =20 --=20 2.13.0