From nobody Wed Feb 11 02:54:52 2026 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 1512997337473610.7529363954967; Mon, 11 Dec 2017 05:02:17 -0800 (PST) Received: from localhost ([::1]:52608 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eONio-0006Hr-2O for importer@patchew.org; Mon, 11 Dec 2017 08:02:14 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51416) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eONdv-0002JW-VX for qemu-devel@nongnu.org; Mon, 11 Dec 2017 07:57:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eONdt-0007Y5-At for qemu-devel@nongnu.org; Mon, 11 Dec 2017 07:57:12 -0500 Received: from mail-wr0-x244.google.com ([2a00:1450:400c:c0c::244]:43926) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eONdt-0007XB-4U for qemu-devel@nongnu.org; Mon, 11 Dec 2017 07:57:09 -0500 Received: by mail-wr0-x244.google.com with SMTP id z34so17439199wrz.10 for ; Mon, 11 Dec 2017 04:57:08 -0800 (PST) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id r14sm20060585wrb.43.2017.12.11.04.57.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Dec 2017 04:57:06 -0800 (PST) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 76C5B3E042D; Mon, 11 Dec 2017 12:57:05 +0000 (GMT) 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=kFWWImcJFakK6Q/MS9IUPme+eMbtlWRk0/W9mj8nEvI=; b=ea6sGEAVJgWF1bzup+xnZvuOFG8RCcJnt+M36usCfZx2qxRSCj/r3lmSntOkiucKWU HGfh1d3GtuRJOGBFQQSvNmdFXFdDFZhURtqCa3gIfp4+mmlyvm9+bmoJGHnzBpvdMpdu h5b1I+X3yJJ/ATHTz1upZIKH3vlXYtPSVqcU8= 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=kFWWImcJFakK6Q/MS9IUPme+eMbtlWRk0/W9mj8nEvI=; b=WvsjEc4ck0ymMKTlBVwAQAXwV9/qJN1btQQQk/GNUu/kRdW3gy42j8nHDTcICwoOAz pAeDxRL9Q3tteDDxLF62dEgLxzTHDuMPzKhY7iqjrQdm42RptauBFieol+WckcNqvjPk XCo7Gu9N3Tpym8oDEngvnkZC93rbPGt3c0wPZgVpygTXXcuLO0WXB18ChjAJHVPUXTuY jpMNoaI1yhqqHRtgl2IvmlXs5Nu3buaXjMtzL9qgopYE6UjIUJx6y1Pia0aLLE37Qd4L 5A42TqqVJhRe6VeDUoAZEQLET+zL05DDi73dhlldlP4adGzIf7C8LlK4z3NDhaewRbbw mXCw== X-Gm-Message-State: AKGB3mII6uO/C7wflZfIAaj0YWGLigEKQJjuSLt5f7mUMF+7Eh6+cSJV gNoaJ8u48/g/QAk5kHMGtznMmQ== X-Google-Smtp-Source: ACJfBoucH4+IUEGa9BWJoii3GRhsL9vHmzwr87V/na07PMrPVWVofFyQRt+1hgowsVlXH06lempE/w== X-Received: by 10.223.176.113 with SMTP id g46mr300933wra.267.1512997027866; Mon, 11 Dec 2017 04:57:07 -0800 (PST) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: richard.henderson@linaro.org, peter.maydell@linaro.org, laurent@vivier.eu, bharata@linux.vnet.ibm.com, andrew@andrewdutcher.com, aleksandar.markovic@imgtec.com Date: Mon, 11 Dec 2017 12:56:47 +0000 Message-Id: <20171211125705.16120-2-alex.bennee@linaro.org> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20171211125705.16120-1-alex.bennee@linaro.org> References: <20171211125705.16120-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:c0c::244 Subject: [Qemu-devel] [PATCH v1 01/19] fpu/softfloat: 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: =?UTF-8?q?Alex=20Benn=C3=A9e?= , qemu-devel@nongnu.org, Aurelien Jarno 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 Reviewed-by: Richard Henderson --- fpu/softfloat.c | 15 +++++++++++++++ include/fpu/softfloat.h | 1 + 2 files changed, 16 insertions(+) diff --git a/fpu/softfloat.c b/fpu/softfloat.c index 433c5dad2d..3a4ab1355f 100644 --- a/fpu/softfloat.c +++ b/fpu/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/softfloat.h b/include/fpu/softfloat.h index 0f96a0edd1..d5e99667b6 100644 --- a/include/fpu/softfloat.h +++ b/include/fpu/softfloat.h @@ -277,6 +277,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.15.1