From patchwork Mon Dec 17 10:56:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 153994 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp2348411ljp; Mon, 17 Dec 2018 03:22:06 -0800 (PST) X-Google-Smtp-Source: AFSGD/XfE3xBkVnSyg/5qLzNb26xApVS2r1jre1yhjychQMrLVYnyb3h1IkyA43sKCwS8SSU4cYA X-Received: by 2002:a37:18e5:: with SMTP id 98mr12202865qky.333.1545045726057; Mon, 17 Dec 2018 03:22:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545045726; cv=none; d=google.com; s=arc-20160816; b=XfKZyOa6h4z2yLlMyVv0WKrjKFojAh+1wUIC8SvNHv33qupuWvgLxJMuFQcA7p7qJz x7ppsc4oEJZiGDNM81sM7dl4SM6qO71z5cZTEGrearshyahcVi9HM1QtiE/RJ573xyxF wQtb54T0t+mPcuCXKL6ilCbA1xotN1WNmQGYwWXRRjYM2compoDtnfASJQYEE7XFQwXj U+On+A3a730q+KM+WcI6h6DeaGViGBj2olHWn6Toksb7HXzxjemmVIHTvtee4Kj4TM9r bkaT/sixdwrexzQXwm8UaobK3jD1erbNUPwfRiJPlZfZl2gZDU4utB/pDmnjsD7Y4rY4 M/6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=v/G8a/aDMb6V6+YDboZPGVLMWpsRQK32FHAFTNc/jVo=; b=F6BJy4V7fxCXAV6vWky+AdJdhrGSTMaRRqRL1PXCBXkiCm8deeaHYIwXjno+UfPSyd 8cXjNlG2PbXn8tWrQ5i7roXg+Cfh63+KTYftTPqntYo0Xl80nQK67D++b7CXy5ap2Vx6 jgbvrLTFy0icFWj98kJTMupws+jD4+bXQz62LBZQ8EovR97feDt5Qi/biSPOj1Xh1Wsm rHhqquNnUJRX/tApNyYIMXOvUERxZfhpahUyClUjNLJyfwrZUAmKkgbWnVeykPJkcqi9 jvbqm0Nk/7TFnROdL6XMl5UPROuGDegMwLtVeFRI7orow5KauHQXj9rdtyjJ7eS27v4y llTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=US8qaGX2; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id h136si2551899qke.111.2018.12.17.03.22.05 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 17 Dec 2018 03:22:06 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=US8qaGX2; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:46046 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gYqyL-00045N-GD for patch@linaro.org; Mon, 17 Dec 2018 06:22:05 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37274) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gYqbw-0002Y7-Hb for qemu-devel@nongnu.org; Mon, 17 Dec 2018 05:59:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gYqa0-000070-0U for qemu-devel@nongnu.org; Mon, 17 Dec 2018 05:56:58 -0500 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]:40650) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gYqZz-00006U-QP for qemu-devel@nongnu.org; Mon, 17 Dec 2018 05:56:55 -0500 Received: by mail-wm1-x336.google.com with SMTP id q26so12077886wmf.5 for ; Mon, 17 Dec 2018 02:56:55 -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=v/G8a/aDMb6V6+YDboZPGVLMWpsRQK32FHAFTNc/jVo=; b=US8qaGX27KFTVo4JQBIBr/xp/Lmdw0iEcJBD+Vx6rHIvBe4tIvCPc9NUHrr1MGrZzy cKx8nwSRw8YCKWdsSpxDMZqhkeZfykKRN6bjp0U+MLX7I0EuCmfszNalijHsI4p66BCP SCMMPhqa5y4eOFieY5T31uCkqMJq2bFkFQPQk= 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=v/G8a/aDMb6V6+YDboZPGVLMWpsRQK32FHAFTNc/jVo=; b=qY2dc5YUxj5W7ssO38NOf5PFV3f3wbvk1A/5kfyhTCvoZRD26x1/+a11xLaVfYIx/H dfkxeX2+YxyOWMsxYUyBo8X6aoINmb+tr7OAptg4AomDG9ZLjcqPvbPzIKJw2QeH68fK Aea4wFGNKVghZZKOp1PBPRPPl430czkB1n50StRssh8loqve60Z4+Wds03Xbe87sz3vD zORYwwsu0rAi9CDxujzi5/S2fmTGWh3AqmTs61AguEo5k7Uy0Ku3v1Sfv5eJeMGEtihD gDqVfSDmAAXpdGt+h7xFvqGgnvRiHYUtAdslHddPgtTJRRRSYMm0bDMbd7XFaeNSKWDY siJw== X-Gm-Message-State: AA+aEWaj0K7g9FFA969tXgwGif+PcT1VZPIhptQWHTYmGCJRAhiorMrq 7UvVEy6y13Yey6saegr4t516Ug== X-Received: by 2002:a1c:2d42:: with SMTP id t63mr11835718wmt.9.1545044214746; Mon, 17 Dec 2018 02:56:54 -0800 (PST) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id l202sm28581351wma.33.2018.12.17.02.56.51 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 17 Dec 2018 02:56:51 -0800 (PST) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id F05A83E0561; Mon, 17 Dec 2018 10:56:50 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Mon, 17 Dec 2018 10:56:39 +0000 Message-Id: <20181217105650.27361-5-alex.bennee@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181217105650.27361-1-alex.bennee@linaro.org> References: <20181217105650.27361-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::336 Subject: [Qemu-devel] [PULL v3 04/15] softfloat: add float{32, 64}_is_{de, }normal 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: "Emilio G. Cota" , =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-devel@nongnu.org, Aurelien Jarno Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" This paves the way for upcoming work. Reviewed-by: Bastian Koppelmann Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota Signed-off-by: Alex Bennée -- 2.17.1 diff --git a/include/fpu/softfloat.h b/include/fpu/softfloat.h index 8fd9f9bbae..9eeccd88a5 100644 --- a/include/fpu/softfloat.h +++ b/include/fpu/softfloat.h @@ -464,6 +464,16 @@ static inline int float32_is_zero_or_denormal(float32 a) return (float32_val(a) & 0x7f800000) == 0; } +static inline bool float32_is_normal(float32 a) +{ + return ((float32_val(a) + 0x00800000) & 0x7fffffff) >= 0x01000000; +} + +static inline bool float32_is_denormal(float32 a) +{ + return float32_is_zero_or_denormal(a) && !float32_is_zero(a); +} + static inline float32 float32_set_sign(float32 a, int sign) { return make_float32((float32_val(a) & 0x7fffffff) | (sign << 31)); @@ -605,6 +615,16 @@ static inline int float64_is_zero_or_denormal(float64 a) return (float64_val(a) & 0x7ff0000000000000LL) == 0; } +static inline bool float64_is_normal(float64 a) +{ + return ((float64_val(a) + (1ULL << 52)) & -1ULL >> 1) >= 1ULL << 53; +} + +static inline bool float64_is_denormal(float64 a) +{ + return float64_is_zero_or_denormal(a) && !float64_is_zero(a); +} + static inline float64 float64_set_sign(float64 a, int sign) { return make_float64((float64_val(a) & 0x7fffffffffffffffULL)