From nobody Wed Feb 11 05:00:45 2026 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1622757161; cv=none; d=zohomail.com; s=zohoarc; b=YPPYq67VFxXjL56Q5xb+ZHsGxDu2Ibx8gs+WR6ial26nftSULyRFEd0keI9ZFq6JTreshyTQEgNVAQ0w1Js9yc982GfY+UKQ34PLK8lnjAdnDc4fnBBZ59YI25r3pHrj3GaDi5TuSEWKSghMfEnIKPyYWFrE720NzLM/iEAktjY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1622757161; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ndVa83SIfMh7/NYhgST6dDyuB+J+HvB1UgKzExjE9v8=; b=FMbizngUKzCrJwDVY23s778VA4KJdZ0kn7mlMKRULmliGvHAosKJ3KeWt2BAfxk0IC5y3q4HQfP4iYkRsVWiCv9nSJuQm3eGiDemqarZU10nCpZ4fJlyiYqpnRZX1YFGTpmKLJ8QdneNhgZ0nr3lgcwiYWSatfVKxJbTIwvjY74= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1622757161989139.42212918142627; Thu, 3 Jun 2021 14:52:41 -0700 (PDT) Received: from localhost ([::1]:33212 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lovGa-0006aG-U4 for importer2@patchew.org; Thu, 03 Jun 2021 17:52:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58526) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lov6F-0002qP-BX for qemu-devel@nongnu.org; Thu, 03 Jun 2021 17:41:59 -0400 Received: from mail-pg1-x52e.google.com ([2607:f8b0:4864:20::52e]:41883) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lov65-0001A7-HU for qemu-devel@nongnu.org; Thu, 03 Jun 2021 17:41:59 -0400 Received: by mail-pg1-x52e.google.com with SMTP id r1so6165568pgk.8 for ; Thu, 03 Jun 2021 14:41:49 -0700 (PDT) Received: from localhost.localdomain (174-21-70-228.tukw.qwest.net. [174.21.70.228]) by smtp.gmail.com with ESMTPSA id p65sm40115pfb.62.2021.06.03.14.41.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Jun 2021 14:41:48 -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=ndVa83SIfMh7/NYhgST6dDyuB+J+HvB1UgKzExjE9v8=; b=qrpAHubuOPfTL1yxgHwgrzkF/fMrBaJzUWnxWaCJnhMUgipGZ8Ibkg/noq4M1T0xpN Zby1WhTVqjaU4uxItGlf7saaleTOtanK8FsUTyCpqUu8WQOOMK4bWTLDIgwGaTzffVeu 19Fj9bHlwMkMZ7uTlnpGDtObqVtLB88XV9MFaOMImA2ZENKcso29oBqsczNU1JWYIlz+ vO7tbxoAK6RyBex/QPXdVlPUPDbEXVjfRniPtyfQbmofFI/jo8fTiag5CXpMS6zetn+0 Sj0jEDPhNZs/QTvrvl14oqHMiUcSOSLAppKMYbvamVFiwD2O22Hv0LBBwVQLNsqZvXva 50CA== 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=ndVa83SIfMh7/NYhgST6dDyuB+J+HvB1UgKzExjE9v8=; b=stcmT1F9r2y7k6vfxGXqDHkIu5st84IKHP36DOS8xdwI/qSjaChvgI6VlG/f1QqVU+ txmW3QxXvetsWYxe7Y6WZd93Nt4FczN8teZpjl+4+WjK69/0Adw0UQYEFlf6FAIhCGHX NPbooXicxfFKI25wvL7iZrdhh2wuRD/gF7wVELdEa8Sj4F+agosLzpK8ZIn2eCwpf4Uc WA2Ppg0LCDluRBeeMBcaDbnXhIbM22xJX75nYndmsDUeVIMJ5SHpoMe6+beUhkMQ4DFv +tpJ3LYqZq7Z9tkViuF+cWo4QAyrfZzjm9gKMtDZx+EnUVbkkkB+a+BaZYkCe0VUP8a+ +r+Q== X-Gm-Message-State: AOAM531D5TwL463QyzO0F79Le1t7dxjuCRxDegNzuq5RVnkRtB8/ZOyk FPb3Djjm+P6oDk2iIUr4rvXpOO7pKVR3cQ== X-Google-Smtp-Source: ABdhPJzab6JPv2ZPjM3k0EnLAJwZmv39tDc+ZsdkZLc7vEJZUb5lNkEMk0IMBlcOJdgLwRKDQHqfjA== X-Received: by 2002:a05:6a00:10c2:b029:2de:7333:1343 with SMTP id d2-20020a056a0010c2b02902de73331343mr1381577pfu.42.1622756508387; Thu, 03 Jun 2021 14:41:48 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 24/29] softfloat: Convert floatx80 compare to FloatParts Date: Thu, 3 Jun 2021 14:41:26 -0700 Message-Id: <20210603214131.629841-25-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210603214131.629841-1-richard.henderson@linaro.org> References: <20210603214131.629841-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::52e; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Reviewed-by: Alex Benn=C3=A9e Signed-off-by: Richard Henderson --- fpu/softfloat.c | 82 +++++++++++++------------------------------------ 1 file changed, 22 insertions(+), 60 deletions(-) diff --git a/fpu/softfloat.c b/fpu/softfloat.c index 770badd447..c32b1c7113 100644 --- a/fpu/softfloat.c +++ b/fpu/softfloat.c @@ -3862,6 +3862,28 @@ FloatRelation float128_compare_quiet(float128 a, flo= at128 b, float_status *s) return float128_do_compare(a, b, s, true); } =20 +static FloatRelation QEMU_FLATTEN +floatx80_do_compare(floatx80 a, floatx80 b, float_status *s, bool is_quiet) +{ + FloatParts128 pa, pb; + + if (!floatx80_unpack_canonical(&pa, a, s) || + !floatx80_unpack_canonical(&pb, b, s)) { + return float_relation_unordered; + } + return parts_compare(&pa, &pb, s, is_quiet); +} + +FloatRelation floatx80_compare(floatx80 a, floatx80 b, float_status *s) +{ + return floatx80_do_compare(a, b, s, false); +} + +FloatRelation floatx80_compare_quiet(floatx80 a, floatx80 b, float_status = *s) +{ + return floatx80_do_compare(a, b, s, true); +} + /* * Scale by 2**N */ @@ -5696,66 +5718,6 @@ float128 float128_rem(float128 a, float128 b, float_= status *status) return normalizeRoundAndPackFloat128(aSign ^ zSign, bExp - 4, aSig0, a= Sig1, status); } - -static inline FloatRelation -floatx80_compare_internal(floatx80 a, floatx80 b, bool is_quiet, - float_status *status) -{ - bool aSign, bSign; - - if (floatx80_invalid_encoding(a) || floatx80_invalid_encoding(b)) { - float_raise(float_flag_invalid, status); - return float_relation_unordered; - } - if (( ( extractFloatx80Exp( a ) =3D=3D 0x7fff ) && - ( extractFloatx80Frac( a )<<1 ) ) || - ( ( extractFloatx80Exp( b ) =3D=3D 0x7fff ) && - ( extractFloatx80Frac( b )<<1 ) )) { - if (!is_quiet || - floatx80_is_signaling_nan(a, status) || - floatx80_is_signaling_nan(b, status)) { - float_raise(float_flag_invalid, status); - } - return float_relation_unordered; - } - aSign =3D extractFloatx80Sign( a ); - bSign =3D extractFloatx80Sign( b ); - if ( aSign !=3D bSign ) { - - if ( ( ( (uint16_t) ( ( a.high | b.high ) << 1 ) ) =3D=3D 0) && - ( ( a.low | b.low ) =3D=3D 0 ) ) { - /* zero case */ - return float_relation_equal; - } else { - return 1 - (2 * aSign); - } - } else { - /* Normalize pseudo-denormals before comparison. */ - if ((a.high & 0x7fff) =3D=3D 0 && a.low & UINT64_C(0x8000000000000= 000)) { - ++a.high; - } - if ((b.high & 0x7fff) =3D=3D 0 && b.low & UINT64_C(0x8000000000000= 000)) { - ++b.high; - } - if (a.low =3D=3D b.low && a.high =3D=3D b.high) { - return float_relation_equal; - } else { - return 1 - 2 * (aSign ^ ( lt128( a.high, a.low, b.high, b.low = ) )); - } - } -} - -FloatRelation floatx80_compare(floatx80 a, floatx80 b, float_status *statu= s) -{ - return floatx80_compare_internal(a, b, 0, status); -} - -FloatRelation floatx80_compare_quiet(floatx80 a, floatx80 b, - float_status *status) -{ - return floatx80_compare_internal(a, b, 1, status); -} - static void __attribute__((constructor)) softfloat_init(void) { union_float64 ua, ub, uc, ur; --=20 2.25.1