From nobody Thu Oct 30 15:33:07 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 (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1526085946189158.55091369722822; Fri, 11 May 2018 17:45:46 -0700 (PDT) Received: from localhost ([::1]:59093 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fHIfQ-0002RH-Q2 for importer@patchew.org; Fri, 11 May 2018 20:45:45 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33242) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fHId7-00048I-QA for qemu-devel@nongnu.org; Fri, 11 May 2018 20:43:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fHId6-0002ov-57 for qemu-devel@nongnu.org; Fri, 11 May 2018 20:43:21 -0400 Received: from mail-pf0-x241.google.com ([2607:f8b0:400e:c00::241]:43296) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fHId5-0002og-TG for qemu-devel@nongnu.org; Fri, 11 May 2018 20:43:20 -0400 Received: by mail-pf0-x241.google.com with SMTP id j20-v6so3426706pff.10 for ; Fri, 11 May 2018 17:43:19 -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 k84-v6sm10756406pfh.93.2018.05.11.17.43.17 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 11 May 2018 17:43:17 -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 :mime-version:content-transfer-encoding; bh=olimn3ekHRDV+cAwPhqm4nCUN2El89E2UfOyxJwGVa8=; b=FWApbiTJI6Pm5ncaqDOcMv7QLf4Nu07g6wUUsrQHCdwVL7AhxO9vxjHcqe9lPRE8SH UIQOREjkI+ms+ldnRttlBwLAZADdsEAp+el0ey7F+pYhdsLdDvlu3ii7HV5mDmlJdlE7 uXz4wpkJrhMLtVoqzPK3hjSaw2hu7zs93ih+M= 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=olimn3ekHRDV+cAwPhqm4nCUN2El89E2UfOyxJwGVa8=; b=bZxNCIBPu1Tzf7xVTrSEl7TdrjiUEHmrIuN8plD4XI1/lddYWWWe7RVYKHwPlk3jZJ 2rTmXoDMdh+DFjCVAAPmHqlnAwmv3odv69hVTMKs/M/tIRO3E9AOkzULMYYevZ7MAQHA ps2NvtDvTKZTqlxTvsOqd88o23T1fd79OVxzR+xO1k/rfEeplsrQJoKC4KBNeSDuSXlB 90ydQGQQrLSnFJnpJzw/PsWq2VlFcDuCXWfNHOqoXtUysOpjFkPr8LE8/lIWQgSP1yV4 Me+zbNcSW7iIIMdmjFodkRGpmRaW2BDjUP0ImJVqfO28adLnd2w39wAyNVpy3QCaQvyA Yd/A== X-Gm-Message-State: ALKqPwfB4oXF4dVEP129+iLqIqQw+bW733MDTkt58OFI2rwsmiMhGN1P 3MM3Y9lN9UCJskSW9l4/ME8LqCCm3Mo= X-Google-Smtp-Source: AB8JxZpdBTM0Eaqf26/WqD21exF8I43l5x2PsKCWAvwjK9zdQG5sAzBeCEa9evgw3C7FKQU56J+oHA== X-Received: by 2002:a63:7a44:: with SMTP id j4-v6mr1019954pgn.172.1526085798509; Fri, 11 May 2018 17:43:18 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Fri, 11 May 2018 17:42:47 -0700 Message-Id: <20180512004311.9299-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180512004311.9299-1-richard.henderson@linaro.org> References: <20180512004311.9299-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::241 Subject: [Qemu-devel] [PATCH v2 03/27] fpu/softfloat: Merge NO_SIGNALING_NANS definitions 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+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 Move the ifdef inside the relevant functions instead of duplicating the function declarations. Reviewed-by: Alex Benn=C3=A9e Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- fpu/softfloat-specialize.h | 100 +++++++++++++++---------------------- 1 file changed, 40 insertions(+), 60 deletions(-) diff --git a/fpu/softfloat-specialize.h b/fpu/softfloat-specialize.h index 27834af0de..58b05718c8 100644 --- a/fpu/softfloat-specialize.h +++ b/fpu/softfloat-specialize.h @@ -233,17 +233,6 @@ typedef struct { uint64_t high, low; } commonNaNT; =20 -#ifdef NO_SIGNALING_NANS -int float16_is_quiet_nan(float16 a_, float_status *status) -{ - return float16_is_any_nan(a_); -} - -int float16_is_signaling_nan(float16 a_, float_status *status) -{ - return 0; -} -#else /*------------------------------------------------------------------------= ---- | Returns 1 if the half-precision floating-point value `a' is a quiet | NaN; otherwise returns 0. @@ -251,12 +240,16 @@ int float16_is_signaling_nan(float16 a_, float_status= *status) =20 int float16_is_quiet_nan(float16 a_, float_status *status) { +#ifdef NO_SIGNALING_NANS + return float16_is_any_nan(a_); +#else uint16_t a =3D float16_val(a_); if (status->snan_bit_is_one) { return (((a >> 9) & 0x3F) =3D=3D 0x3E) && (a & 0x1FF); } else { return ((a & ~0x8000) >=3D 0x7C80); } +#endif } =20 /*------------------------------------------------------------------------= ---- @@ -266,14 +259,17 @@ int float16_is_quiet_nan(float16 a_, float_status *st= atus) =20 int float16_is_signaling_nan(float16 a_, float_status *status) { +#ifdef NO_SIGNALING_NANS + return 0; +#else uint16_t a =3D float16_val(a_); if (status->snan_bit_is_one) { return ((a & ~0x8000) >=3D 0x7C80); } else { return (((a >> 9) & 0x3F) =3D=3D 0x3E) && (a & 0x1FF); } -} #endif +} =20 /*------------------------------------------------------------------------= ---- | Returns a quiet NaN if the half-precision floating point value `a' is a @@ -333,17 +329,6 @@ static float16 commonNaNToFloat16(commonNaNT a, float_= status *status) } } =20 -#ifdef NO_SIGNALING_NANS -int float32_is_quiet_nan(float32 a_, float_status *status) -{ - return float32_is_any_nan(a_); -} - -int float32_is_signaling_nan(float32 a_, float_status *status) -{ - return 0; -} -#else /*------------------------------------------------------------------------= ---- | Returns 1 if the single-precision floating-point value `a' is a quiet | NaN; otherwise returns 0. @@ -351,12 +336,16 @@ int float32_is_signaling_nan(float32 a_, float_status= *status) =20 int float32_is_quiet_nan(float32 a_, float_status *status) { +#ifdef NO_SIGNALING_NANS + return float32_is_any_nan(a_); +#else uint32_t a =3D float32_val(a_); if (status->snan_bit_is_one) { return (((a >> 22) & 0x1FF) =3D=3D 0x1FE) && (a & 0x003FFFFF); } else { return ((uint32_t)(a << 1) >=3D 0xFF800000); } +#endif } =20 /*------------------------------------------------------------------------= ---- @@ -366,14 +355,17 @@ int float32_is_quiet_nan(float32 a_, float_status *st= atus) =20 int float32_is_signaling_nan(float32 a_, float_status *status) { +#ifdef NO_SIGNALING_NANS + return 0; +#else uint32_t a =3D float32_val(a_); if (status->snan_bit_is_one) { return ((uint32_t)(a << 1) >=3D 0xFF800000); } else { return (((a >> 22) & 0x1FF) =3D=3D 0x1FE) && (a & 0x003FFFFF); } -} #endif +} =20 /*------------------------------------------------------------------------= ---- | Returns a quiet NaN if the single-precision floating point value `a' is a @@ -744,17 +736,6 @@ static float32 propagateFloat32NaN(float32 a, float32 = b, float_status *status) } } =20 -#ifdef NO_SIGNALING_NANS -int float64_is_quiet_nan(float64 a_, float_status *status) -{ - return float64_is_any_nan(a_); -} - -int float64_is_signaling_nan(float64 a_, float_status *status) -{ - return 0; -} -#else /*------------------------------------------------------------------------= ---- | Returns 1 if the double-precision floating-point value `a' is a quiet | NaN; otherwise returns 0. @@ -762,6 +743,9 @@ int float64_is_signaling_nan(float64 a_, float_status *= status) =20 int float64_is_quiet_nan(float64 a_, float_status *status) { +#ifdef NO_SIGNALING_NANS + return float64_is_any_nan(a_); +#else uint64_t a =3D float64_val(a_); if (status->snan_bit_is_one) { return (((a >> 51) & 0xFFF) =3D=3D 0xFFE) @@ -769,6 +753,7 @@ int float64_is_quiet_nan(float64 a_, float_status *stat= us) } else { return ((a << 1) >=3D 0xFFF0000000000000ULL); } +#endif } =20 /*------------------------------------------------------------------------= ---- @@ -778,6 +763,9 @@ int float64_is_quiet_nan(float64 a_, float_status *stat= us) =20 int float64_is_signaling_nan(float64 a_, float_status *status) { +#ifdef NO_SIGNALING_NANS + return 0; +#else uint64_t a =3D float64_val(a_); if (status->snan_bit_is_one) { return ((a << 1) >=3D 0xFFF0000000000000ULL); @@ -785,8 +773,8 @@ int float64_is_signaling_nan(float64 a_, float_status *= status) return (((a >> 51) & 0xFFF) =3D=3D 0xFFE) && (a & LIT64(0x0007FFFFFFFFFFFF)); } -} #endif +} =20 /*------------------------------------------------------------------------= ---- | Returns a quiet NaN if the double-precision floating point value `a' is a @@ -899,17 +887,6 @@ static float64 propagateFloat64NaN(float64 a, float64 = b, float_status *status) } } =20 -#ifdef NO_SIGNALING_NANS -int floatx80_is_quiet_nan(floatx80 a_, float_status *status) -{ - return floatx80_is_any_nan(a_); -} - -int floatx80_is_signaling_nan(floatx80 a_, float_status *status) -{ - return 0; -} -#else /*------------------------------------------------------------------------= ---- | Returns 1 if the extended double-precision floating-point value `a' is a | quiet NaN; otherwise returns 0. This slightly differs from the same @@ -918,6 +895,9 @@ int floatx80_is_signaling_nan(floatx80 a_, float_status= *status) =20 int floatx80_is_quiet_nan(floatx80 a, float_status *status) { +#ifdef NO_SIGNALING_NANS + return floatx80_is_any_nan(a); +#else if (status->snan_bit_is_one) { uint64_t aLow; =20 @@ -929,6 +909,7 @@ int floatx80_is_quiet_nan(floatx80 a, float_status *sta= tus) return ((a.high & 0x7FFF) =3D=3D 0x7FFF) && (LIT64(0x8000000000000000) <=3D ((uint64_t)(a.low << 1))); } +#endif } =20 /*------------------------------------------------------------------------= ---- @@ -939,6 +920,9 @@ int floatx80_is_quiet_nan(floatx80 a, float_status *sta= tus) =20 int floatx80_is_signaling_nan(floatx80 a, float_status *status) { +#ifdef NO_SIGNALING_NANS + return 0; +#else if (status->snan_bit_is_one) { return ((a.high & 0x7FFF) =3D=3D 0x7FFF) && ((a.low << 1) >=3D 0x8000000000000000ULL); @@ -950,8 +934,8 @@ int floatx80_is_signaling_nan(floatx80 a, float_status = *status) && (uint64_t)(aLow << 1) && (a.low =3D=3D aLow); } -} #endif +} =20 /*------------------------------------------------------------------------= ---- | Returns a quiet NaN if the extended double-precision floating point value @@ -1060,17 +1044,6 @@ floatx80 propagateFloatx80NaN(floatx80 a, floatx80 b= , float_status *status) } } =20 -#ifdef NO_SIGNALING_NANS -int float128_is_quiet_nan(float128 a_, float_status *status) -{ - return float128_is_any_nan(a_); -} - -int float128_is_signaling_nan(float128 a_, float_status *status) -{ - return 0; -} -#else /*------------------------------------------------------------------------= ---- | Returns 1 if the quadruple-precision floating-point value `a' is a quiet | NaN; otherwise returns 0. @@ -1078,6 +1051,9 @@ int float128_is_signaling_nan(float128 a_, float_stat= us *status) =20 int float128_is_quiet_nan(float128 a, float_status *status) { +#ifdef NO_SIGNALING_NANS + return float128_is_any_nan(a); +#else if (status->snan_bit_is_one) { return (((a.high >> 47) & 0xFFFF) =3D=3D 0xFFFE) && (a.low || (a.high & 0x00007FFFFFFFFFFFULL)); @@ -1085,6 +1061,7 @@ int float128_is_quiet_nan(float128 a, float_status *s= tatus) return ((a.high << 1) >=3D 0xFFFF000000000000ULL) && (a.low || (a.high & 0x0000FFFFFFFFFFFFULL)); } +#endif } =20 /*------------------------------------------------------------------------= ---- @@ -1094,6 +1071,9 @@ int float128_is_quiet_nan(float128 a, float_status *s= tatus) =20 int float128_is_signaling_nan(float128 a, float_status *status) { +#ifdef NO_SIGNALING_NANS + return 0; +#else if (status->snan_bit_is_one) { return ((a.high << 1) >=3D 0xFFFF000000000000ULL) && (a.low || (a.high & 0x0000FFFFFFFFFFFFULL)); @@ -1101,8 +1081,8 @@ int float128_is_signaling_nan(float128 a, float_statu= s *status) return (((a.high >> 47) & 0xFFFF) =3D=3D 0xFFFE) && (a.low || (a.high & LIT64(0x00007FFFFFFFFFFF))); } -} #endif +} =20 /*------------------------------------------------------------------------= ---- | Returns a quiet NaN if the quadruple-precision floating point value `a' = is --=20 2.17.0