From nobody Mon Feb 9 03:05:20 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 (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1516799745111946.2645929726747; Wed, 24 Jan 2018 05:15:45 -0800 (PST) Received: from localhost ([::1]:48197 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eeKtt-0004dT-7X for importer@patchew.org; Wed, 24 Jan 2018 08:15:37 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55518) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eeKrh-0003DN-LY for qemu-devel@nongnu.org; Wed, 24 Jan 2018 08:13:22 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eeKre-0003cn-VX for qemu-devel@nongnu.org; Wed, 24 Jan 2018 08:13:21 -0500 Received: from mail-wr0-x242.google.com ([2a00:1450:400c:c0c::242]:40016) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eeKre-0003cL-Ov for qemu-devel@nongnu.org; Wed, 24 Jan 2018 08:13:18 -0500 Received: by mail-wr0-x242.google.com with SMTP id 100so3980067wrb.7 for ; Wed, 24 Jan 2018 05:13:18 -0800 (PST) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id f48sm2208774wra.72.2018.01.24.05.13.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Jan 2018 05:13:16 -0800 (PST) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 8683E3E023D; Wed, 24 Jan 2018 13:13:15 +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=h31NeeUXL9yU7R2Yb4mynZARITWdaJeJqTMLzgQtKsM=; b=d4her53z9wFSvj+el7oQeZuUHsZ2qYJxWwMg5GxTQ9r5PZtpv6uj5cF7onWZumkInJ 1wx3v2CQrh+Kq4t9b3mbdrjy2AqyyxykI8ycUoKs4e8jVDRMhNdk7tepiNyzHfaOIRId Yo/dGV8GxwJXEfR5QlkBhNwC91Tp14RXQkPlQ= 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=h31NeeUXL9yU7R2Yb4mynZARITWdaJeJqTMLzgQtKsM=; b=lG7AeOUDkgeBGC+13+ObcqAaMdcDi+e3fZbhY5YDKcMd978U4f84AmJOhMpGktgKLL A8DonVNuOEuUW8xCc3G34zsQMUueRZKFtQnH7A6mUjclDgHQN0co2AG47Mpf6h7KV4UL fYZTxpkPiplzrXEPWNB/V8ixhiLGK1sGB51xJsEGRRDOgf3LSX4UpbfXWiELWBO5CYzq GRW+cQPX7lW6t10joTIT7J20rBd0IcM9lOSOJuc6l49GfswbwexV9/b6gqHoWULZXo/Q LkvyyBWWCN9zhzCSsyz1hFyWSKAj0eP8aAhvhx0Pe1rFEdsIcUBflsxl1NohIW7DzTvu ZvfQ== X-Gm-Message-State: AKwxytekljN+4sLhsCY9c/lleV9Ns/0H7YdTaYuOdVbUeqGLDzTRiPN7 RiOe+uC/EWjiMZeRI3bOjL+K7g== X-Google-Smtp-Source: AH8x224pLbQvHxME8+RSXZD2okwoZYEvo4vB61//acMnBbyaG0kQCVMTs/7/MLVwj2rxaZAcNEspTg== X-Received: by 10.223.164.22 with SMTP id d22mr5479666wra.186.1516799597729; Wed, 24 Jan 2018 05:13:17 -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 Date: Wed, 24 Jan 2018 13:12:54 +0000 Message-Id: <20180124131315.30567-2-alex.bennee@linaro.org> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180124131315.30567-1-alex.bennee@linaro.org> References: <20180124131315.30567-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::242 Subject: [Qemu-devel] [PATCH v3 01/22] 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 Reviewed-by: Peter Maydell --- 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