From nobody Fri Oct 24 22:12:13 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; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 151921126934872.79258805480265; Wed, 21 Feb 2018 03:07:49 -0800 (PST) Received: from localhost ([::1]:60041 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eoSFL-0004vH-Ow for importer@patchew.org; Wed, 21 Feb 2018 06:07:35 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35234) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eoSDM-0003ra-5S for qemu-devel@nongnu.org; Wed, 21 Feb 2018 06:05:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eoSDH-0006aj-IO for qemu-devel@nongnu.org; Wed, 21 Feb 2018 06:05:32 -0500 Received: from mail-wr0-x241.google.com ([2a00:1450:400c:c0c::241]:34340) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eoSDH-0006aU-6g for qemu-devel@nongnu.org; Wed, 21 Feb 2018 06:05:27 -0500 Received: by mail-wr0-x241.google.com with SMTP id m5so3299274wrg.1 for ; Wed, 21 Feb 2018 03:05:27 -0800 (PST) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id y1sm5858662wrh.80.2018.02.21.03.05.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Feb 2018 03:05:23 -0800 (PST) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 249143E01B5; Wed, 21 Feb 2018 11:05:23 +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=6fRZYTkBwQgN0XXVmqeZavsg0TW6RgcOAWFA1Pfoyk8=; b=iiyQUOU56dsbC0rz9aUz26nCK+rSZu2kHunXXDHZH8mvlpMdGNygjI/LtUIE9OEYXc FgFT9SzhYJkUtOCXzyksSA7Uti4ozZQEvP/JzqP9JCg2fHOUXqImJHzOJaIkXr0ceoNx fxROpHPbBk+Yh3CMVYupPf+NfYYAD8USzbJ9w= 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=6fRZYTkBwQgN0XXVmqeZavsg0TW6RgcOAWFA1Pfoyk8=; b=TVaC3lzPhfusVj3uVQE7AJta7uTy0MmQ9zOAzhbuPKm8LsoRIlpqWWUbqoXVPN7u7L xeoZAQg5JwuUVu0SF/ioYOh4g3aNdwUq6WcTEB7oIU6ztyVxcz78QqMuaIcBJMt/kyGe BkITL7Ji3BiEMexN5LTiuC2ZbAzR61qSFaofJlMc4K/0Q5D+Fxyru0zVs4M1rM1Zt168 yN4VoIThLBO7w6dTk6TO/c9BDmYs4pJNOs3kwreWaglvuSd5DJYxk9e6PAoI75pDg1Lt /+3NFAVDotbNn4RFE4VJOqiZ78lav2N9vtQPEZhJy/aSVtnKte6SLgb0KsTVGvnR/qAB /vDQ== X-Gm-Message-State: APf1xPCSW0D9Y78KSma7FCh/vN1JJaTMTgro7TXyREexatY63DPPudVs /lF4HSu0Q6Uc4s/zZ8cXaUJqKw== X-Google-Smtp-Source: AH8x226yxfq79McLGNSU2FELh6eYZzJcwvq2nRR1zQN3f+EoEbiAPmx2hVmnJR02Jj8gRfl5h8w4BA== X-Received: by 10.223.156.145 with SMTP id d17mr2662445wre.1.1519211125987; Wed, 21 Feb 2018 03:05:25 -0800 (PST) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Wed, 21 Feb 2018 11:05:01 +0000 Message-Id: <20180221110523.859-2-alex.bennee@linaro.org> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180221110523.859-1-alex.bennee@linaro.org> References: <20180221110523.859-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::241 Subject: [Qemu-devel] [PULL 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 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