From nobody Wed Feb 11 02:08:30 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; 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 1517717633926605.1997133993658; Sat, 3 Feb 2018 20:13:53 -0800 (PST) Received: from localhost ([::1]:58238 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eiBgY-0005qL-UX for importer@patchew.org; Sat, 03 Feb 2018 23:13:47 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47233) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eiBed-0004UD-1o for qemu-devel@nongnu.org; Sat, 03 Feb 2018 23:11:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eiBeY-0004od-Vg for qemu-devel@nongnu.org; Sat, 03 Feb 2018 23:11:47 -0500 Received: from mail-pf0-x244.google.com ([2607:f8b0:400e:c00::244]:42782) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eiBeY-0004oV-Pt for qemu-devel@nongnu.org; Sat, 03 Feb 2018 23:11:42 -0500 Received: by mail-pf0-x244.google.com with SMTP id b25so19452745pfd.9 for ; Sat, 03 Feb 2018 20:11:42 -0800 (PST) Received: from cloudburst.twiddle.net (174-21-6-47.tukw.qwest.net. [174.21.6.47]) by smtp.gmail.com with ESMTPSA id k3sm1399425pgr.12.2018.02.03.20.11.40 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 03 Feb 2018 20:11:40 -0800 (PST) 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=mChd7TEwq3ZdrA6gGr+Hje5KtLZ1BEWCJIdlh6JiFBM=; b=gb9Mo6EmmYrXEihtLOxQVULIiwo60nI7Hxrs5XGmYO3DDkrill0R1hFcBV0a1qi11s tBwciWvwKNwQJINp2g5igiHS0mSiFsKDCEd9Z0XBs5VWLFQLEVI5CGnUYlnJsb0xFNXS 4Q9202RKD4XVgPzOTziK+FLk9IWyG8YQSAzCI= 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=mChd7TEwq3ZdrA6gGr+Hje5KtLZ1BEWCJIdlh6JiFBM=; b=FX+IPX+cKPN1F5fMCUSmKFxie4w4dudzkXJJca4G5L0rUdxSJf/tsQPF7D+pLMzR1y UcTafgztmGGMbufGiex5R15uUfVX4j+eZ/mEdCZ5r542s1HpboaWhKpauLFtrD8wgEfz DVQNvxRlyYC1o6sKrnZiGDVvY36FZFJX7S4IM4humu39NWy8EX589d6YvTYG8K3fGCw0 BADTl1lp4XoXQpvm4+7Ox8uJ8Jpz/Tz52sUcKbnptJphtzNFkS9kBpZjGPUJuaCuthU8 mrQlg8f0FQu7BzSzzQc9BBs2DGpWj//GB5aldKqwM10bgVBWNKV88J4hnkJwrkYdTN30 0jxQ== X-Gm-Message-State: AKwxytcf3ly5ragMELBvI8DyJc9AahNVnmEojyaPjcR6H434lhehNHup 33FmhxhfRyjLsceU6qJKLX2NjaRTC88= X-Google-Smtp-Source: AH8x2259sCkM+m4qS8XrMqHncfdqpOrxoqH8XO4XVcyuWo4Ic+5VR2aN8bHWAZNGOHdHg1LOOEh6Vw== X-Received: by 10.98.31.131 with SMTP id l3mr45360146pfj.116.1517717501378; Sat, 03 Feb 2018 20:11:41 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Sat, 3 Feb 2018 20:11:13 -0800 Message-Id: <20180204041136.17525-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180204041136.17525-1-richard.henderson@linaro.org> References: <20180204041136.17525-1-richard.henderson@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: 2607:f8b0:400e:c00::244 Subject: [Qemu-devel] [PATCH 01/24] 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: peter.maydell@linaro.org, cota@braap.org, alex.bennee@linaro.org, hsp.cat7@gmail.com 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 From: Alex Benn=C3=A9e 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 --- include/fpu/softfloat.h | 1 + fpu/softfloat.c | 15 +++++++++++++++ 2 files changed, 16 insertions(+) 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 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) { --=20 2.14.3