From patchwork Mon May 14 22:12:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 135780 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp200888lji; Mon, 14 May 2018 15:31:43 -0700 (PDT) X-Google-Smtp-Source: AB8JxZolwqRk9uKeMMEQtGUTOBlVF3ZHp8jOA2CcPTmkJwAkHmYLGDLK+y11n6HY9/UI4fLsvYv/ X-Received: by 2002:a0c:989b:: with SMTP id f27-v6mr10724718qvd.115.1526337103357; Mon, 14 May 2018 15:31:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526337103; cv=none; d=google.com; s=arc-20160816; b=MzoxwkaTh/HF7Ld0Vcp314Kca2AZok9iCyuDCQEJRTx/LjOw53EJ84xa7i0YGYNxbP 6vamnpc/oulfdJjlSXCkMmjWSyLswh3oqONtQZWzTmkpK7o3GhP1mlzcfCzCElyly+9v HT3UhwohvhftCybf8NMqX/gyMtfLDmTBDXd7T/OvCaSwiVugsZx40/s3onzJ38x29fuI oz4p8HqS5jTdkfovBC0zyeBchhOpyn4AE6/ZQPAx1osBakIJDl8ZHNyWO9kTvJnIaj6m +AuvgA2yUrZL8EkHrVKo+AewQuBXnkA77gnLTYcoW76+4H9AQi0UddSyT+ecGPOPH02k ASjQ== 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:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=1q8CvQLaVO8CGA7b0QttcxlJQ18Lc1p3qQpT+0UVsAo=; b=rmhRIXjPUl9qZ2MVJMwEjWQ98ExWPF3BRFM/YI9mKMJFUeZt8JwuNgf6WjCiylgdfD I8jWikqscfbj3xzaolmCY9LWsBwKJxqJmYlLtg9PBHM5QYtfef2vOFfnc6yQkABvJa2G RmgIPFccW4QFJ5Qcb1w6wojjNmDrIYcrQqfIMI+w7nf1M6NE4dXK//9Qj9lNptAdt91U a70tyLAynzXa/cmMLbjVIMxD5habibxOouqeuXC+NrMQ1EGL5rzGrHpzlFXV5DeLLtvx aQ5TeFwJYDY3peVXFs7+EJAVXCg6hmfFLU0rzGZ4m6bDng3jDxdio4WnnA1ffVG2lqs/ o9tA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=PLhE6j6R; 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 e30-v6si3140479qtg.171.2018.05.14.15.31.43 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 14 May 2018 15:31:43 -0700 (PDT) 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=PLhE6j6R; 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]:50038 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fIM0M-0007Nh-MF for patch@linaro.org; Mon, 14 May 2018 18:31:42 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52731) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fILiK-0008OZ-U5 for qemu-devel@nongnu.org; Mon, 14 May 2018 18:13:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fILiH-0000GH-LU for qemu-devel@nongnu.org; Mon, 14 May 2018 18:13:04 -0400 Received: from mail-pg0-x243.google.com ([2607:f8b0:400e:c05::243]:42034) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fILiH-0000EG-Cy for qemu-devel@nongnu.org; Mon, 14 May 2018 18:13:01 -0400 Received: by mail-pg0-x243.google.com with SMTP id p9-v6so6060659pgc.9 for ; Mon, 14 May 2018 15:13:01 -0700 (PDT) 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; bh=1q8CvQLaVO8CGA7b0QttcxlJQ18Lc1p3qQpT+0UVsAo=; b=PLhE6j6RHwTeLpMhHWmfh/+n0R9IrFT1wBxKJYKvhijYAISElXJ4pj0U5jYKmBOlF4 th6lpZn7BEAt9slRPPNhxdmHmx/OgKxd99q4od6A/MwO+SLunpPdCDPDrso2GeLajAFd OENbHXvPQURChSLhb9Ax7Ym0zgMl8+w/Xi5lg= 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; bh=1q8CvQLaVO8CGA7b0QttcxlJQ18Lc1p3qQpT+0UVsAo=; b=IjSmxX1W2Ug+Qi2hBP4xnX+qJi3iquzPPyFjiZYc7R2NrjO3ZEITB2+oUp2TOZQHM0 BKWFvNuKjCqykyJu3oCvuZoxIo5Z8QfXzHNWT0fXVnPpluNN9enyyF4Ru1Zf8DOKoAEC ITThGx+TRrRMT627VWm/YHZXe89X93ZgUgsmLNQeV2SuZTHsVC7Gi7tmUv7eg8bJsBu/ qqME3EaCXM9iWISHAf/irr0ACG2wEFIgVmqbUikUKEdI0vroWSAcOtU1A7HQLxRT2NM4 Vt8+Nf4iCTocp+hrYYYqXmG5uNrNVazMaoaAhthDweb6oCbCPRagba7KLplIpbZbTPuh L3dQ== X-Gm-Message-State: ALKqPwc1PKmJlo+t2wmwqWzSb6oOnNqkBr8zP2DTV7kktnvSbiaE5ypG SpxxLUqBQh7AA9Yn266Mbnwlf03Qejw= X-Received: by 2002:a65:53ca:: with SMTP id z10-v6mr7727398pgr.413.1526335980058; Mon, 14 May 2018 15:13:00 -0700 (PDT) Received: from cloudburst.twiddle.net (97-113-2-170.tukw.qwest.net. [97.113.2.170]) by smtp.gmail.com with ESMTPSA id y2-v6sm14512457pgp.92.2018.05.14.15.12.58 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 14 May 2018 15:12:59 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Mon, 14 May 2018 15:12:19 -0700 Message-Id: <20180514221219.7091-29-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180514221219.7091-1-richard.henderson@linaro.org> References: <20180514221219.7091-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c05::243 Subject: [Qemu-devel] [PATCH v5 28/28] fpu/softfloat: Define floatN_silence_nan in terms of parts_silence_nan 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, alex.bennee@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Isolate the target-specific choice to 3 functions instead of 6. The code in floatx80_default_nan tried to be over-general. There are only two targets that support this format: x86 and m68k. Thus there is no point in inventing a mechanism for snan_bit_is_one. Move routines that no longer have ifdefs out of softfloat-specialize.h. Signed-off-by: Richard Henderson --- fpu/softfloat-specialize.h | 81 ++------------------------------------ fpu/softfloat.c | 19 +++++++++ 2 files changed, 23 insertions(+), 77 deletions(-) -- 2.17.0 Reviewed-by: Alex Bennée diff --git a/fpu/softfloat-specialize.h b/fpu/softfloat-specialize.h index ec4fb6ba8b..16c0bcb6fa 100644 --- a/fpu/softfloat-specialize.h +++ b/fpu/softfloat-specialize.h @@ -278,24 +278,6 @@ int float16_is_signaling_nan(float16 a_, float_status *status) #endif } -/*---------------------------------------------------------------------------- -| Returns a quiet NaN from a signalling NaN for the half-precision -| floating point value `a'. -*----------------------------------------------------------------------------*/ - -float16 float16_silence_nan(float16 a, float_status *status) -{ -#ifdef NO_SIGNALING_NANS - g_assert_not_reached(); -#else - if (snan_bit_is_one(status)) { - return float16_default_nan(status); - } else { - return a | (1 << 9); - } -#endif -} - /*---------------------------------------------------------------------------- | Returns 1 if the single-precision floating-point value `a' is a quiet | NaN; otherwise returns 0. @@ -334,30 +316,6 @@ int float32_is_signaling_nan(float32 a_, float_status *status) #endif } -/*---------------------------------------------------------------------------- -| Returns a quiet NaN from a signalling NaN for the single-precision -| floating point value `a'. -*----------------------------------------------------------------------------*/ - -float32 float32_silence_nan(float32 a, float_status *status) -{ -#ifdef NO_SIGNALING_NANS - g_assert_not_reached(); -#else - if (snan_bit_is_one(status)) { -# ifdef TARGET_HPPA - a &= ~0x00400000; - a |= 0x00200000; - return a; -# else - return float32_default_nan(status); -# endif - } else { - return a | (1 << 22); - } -#endif -} - /*---------------------------------------------------------------------------- | Returns the result of converting the single-precision floating-point NaN | `a' to the canonical NaN format. If `a' is a signaling NaN, the invalid @@ -706,31 +664,6 @@ int float64_is_signaling_nan(float64 a_, float_status *status) #endif } -/*---------------------------------------------------------------------------- -| Returns a quiet NaN from a signalling NaN for the double-precision -| floating point value `a'. -*----------------------------------------------------------------------------*/ - -float64 float64_silence_nan(float64 a, float_status *status) -{ -#ifdef NO_SIGNALING_NANS - g_assert_not_reached(); -#else - if (snan_bit_is_one(status)) { -# ifdef TARGET_HPPA - a &= ~0x0008000000000000ULL; - a |= 0x0004000000000000ULL; - return a; -# else - return float64_default_nan(status); -# endif - } else { - return a | LIT64(0x0008000000000000); - } -#endif -} - - /*---------------------------------------------------------------------------- | Returns the result of converting the double-precision floating-point NaN | `a' to the canonical NaN format. If `a' is a signaling NaN, the invalid @@ -886,16 +819,10 @@ int floatx80_is_signaling_nan(floatx80 a, float_status *status) floatx80 floatx80_silence_nan(floatx80 a, float_status *status) { -#ifdef NO_SIGNALING_NANS - g_assert_not_reached(); -#else - if (snan_bit_is_one(status)) { - return floatx80_default_nan(status); - } else { - a.low |= LIT64(0xC000000000000000); - return a; - } -#endif + /* None of the targets that have snan_bit_is_one use floatx80. */ + assert(!snan_bit_is_one(status)); + a.low |= LIT64(0xC000000000000000); + return a; } /*---------------------------------------------------------------------------- diff --git a/fpu/softfloat.c b/fpu/softfloat.c index b5842f7b1c..40b039ee5b 100644 --- a/fpu/softfloat.c +++ b/fpu/softfloat.c @@ -2128,6 +2128,25 @@ float128 float128_default_nan(float_status *status) return r; } +/*---------------------------------------------------------------------------- +| Returns a quiet NaN from a signalling NaN for the floating point value `a'. +*----------------------------------------------------------------------------*/ + +float16 float16_silence_nan(float16 a, float_status *status) +{ + return float16_pack_raw(parts_silence_nan(float16_unpack_raw(a), status)); +} + +float32 float32_silence_nan(float32 a, float_status *status) +{ + return float32_pack_raw(parts_silence_nan(float32_unpack_raw(a), status)); +} + +float64 float64_silence_nan(float64 a, float_status *status) +{ + return float64_pack_raw(parts_silence_nan(float64_unpack_raw(a), status)); +} + /*---------------------------------------------------------------------------- | Takes a 64-bit fixed-point value `absZ' with binary point between bits 6 | and 7, and returns the properly rounded 32-bit integer corresponding to the