From patchwork Wed Apr 27 04:39:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 566749 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp4182347map; Tue, 26 Apr 2022 21:43:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwzc6hawdSSuoVsxBh6wZuAork0e7csPMLCPD2J8R2lH0Gh1FN3Y9bQdHGPSvfePJW8UaGW X-Received: by 2002:ac8:7dcc:0:b0:2f2:5c6:91db with SMTP id c12-20020ac87dcc000000b002f205c691dbmr18180983qte.240.1651034628473; Tue, 26 Apr 2022 21:43:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651034628; cv=none; d=google.com; s=arc-20160816; b=VWd7f9Mq0/oAfz3A2phbDn6b8pKJsWdZMP1V28MWnECVc5gyDf4rnBIO1MLx/Q4PzA nr0Y8vtBMBl3wL0RaarHJIYtFMVvhfsah7m9TiQJiJl7d98PGcwKA9+IJKGt9UaHICze jlL0gu87+XBjISak5EFCtM05wVwvEfEDoI1A1bzr6EzNt+8s9J1fTFY+/mD3vnPSajgo XlinjgRaW4dVv4Q/suQUfypJ1pezA7ldCZWUn9f48dwUxAWpCc0wvqgjy6XwXAjoPlC0 ZZOuMJ+7ehEiTzdrRJPpBmU6vRtAV8ivHWguyjvWcwZ98EL7UZYdzjppeU2Q3lYKB3xo X9sg== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=Vj2pfmJyu+VBd81eZurWJYtZCi/tXlPkPdE7lYV8+vU=; b=xghb5t9ws5Tjc+OFaa90dNPIWiOp1MJsGZhee0888pYYqqVQt9XGAV3yXPcX3dQcRG njRI/lzl4Ru4omrsqSP/o8Xj+tFUYsA0iz5YUhKpLdkKSFr1/0BxHEatKiWfkX22rR+/ 71I9wqKgZvG8xL4TcQzuhzB7pfRUc5t8ElmyoVeKdBWxQ27ZrLotFeUhSyrPXyDH5F2J XW/1tW1mIlsbo6RNMBu39sK59hdnqwJ+IsboZ5VA6Z2TA3oNHE60rTWoc4ndJvsw2ZST zNnv7gytshlNvV/nwvZmYT07wTzmkltwwirf4kH+t5nZrHh1JGxqBJkhVroGRytxWQ96 T5IQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jf5CGVy7; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id u14-20020a37ab0e000000b0069f70d0cad3si146012qke.36.2022.04.26.21.43.48 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 26 Apr 2022 21:43:48 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jf5CGVy7; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:56868 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1njZWm-00076y-2C for patch@linaro.org; Wed, 27 Apr 2022 00:43:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50396) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1njZSy-0001JS-8e for qemu-devel@nongnu.org; Wed, 27 Apr 2022 00:39:52 -0400 Received: from mail-pf1-x429.google.com ([2607:f8b0:4864:20::429]:42907) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1njZSw-0007Ss-Pp for qemu-devel@nongnu.org; Wed, 27 Apr 2022 00:39:51 -0400 Received: by mail-pf1-x429.google.com with SMTP id j17so591692pfi.9 for ; Tue, 26 Apr 2022 21:39:50 -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=Vj2pfmJyu+VBd81eZurWJYtZCi/tXlPkPdE7lYV8+vU=; b=jf5CGVy71OVXkDaJBLz3nPkutTSMBLxKgKHhW5khl8DgYuGbP2iLlhWLuU0tMgmdj7 cca0rz2RqMrxm7Nxt50TqBtpgWoKTLGkkuEfUanzVLeZcTUX6zSB8R9Ghi3C2Oxcnq/B o2R3I8AikVKxMWtjgYNFriny0lEJYWxiGccv1DLtdXYUdYVXmShCI+1G6Bxji9C62ROF 8tj5kql9EgmoHui9QyfbFj36fYmMdXxRQqgQehDCKmf35zdSqKHP6yGZ4MNWHgQnScF7 MmiznmER7BohnUWbnjXGjw6VJsrAV9U/BgSebw0M4bIvRm4GUgWq6BzNKIfBqnZvAi7/ 9MZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Vj2pfmJyu+VBd81eZurWJYtZCi/tXlPkPdE7lYV8+vU=; b=7vituUxd+uVRBfq19guCGE7QkD81Dq3afd7iJIRLA5hnN/P/PRBlIXncfKutPeY84A WvlwN+zM5wBIZqJrBeLDqAAuD3Jo4RDL3X0UdbBQGhC2zQGL2+iZCca+r20FVWlA0Bfg IPw8VQ1iV26NMV6aYjaD6etjfjOyVTYq+14EccFgdl0PM098T65qU3WusyQxYoo1HggM dor2x9NGsKQAMjmrXEXJPaj40YttN5lFKzSH4DUMLfhFz4WwIQsNTehLgocsmyDqPWsM afo1gFIR0vbg5j+4Xk0MzcWWVChxZ5D1pyIuOELYAG6GcLiGRGdZt/YIQKvaVv6y356H yH2A== X-Gm-Message-State: AOAM5312GgePt3A7yuPKUUi2meEBI5JI32y+HgCdIl8IN1tF8UqH2BNW 4TaLRo4mgbRkKQfhe72SH71kW8xTgimtHg== X-Received: by 2002:a63:4e62:0:b0:398:cb40:19b0 with SMTP id o34-20020a634e62000000b00398cb4019b0mr22679402pgl.445.1651034389269; Tue, 26 Apr 2022 21:39:49 -0700 (PDT) Received: from stoup.. (174-21-142-130.tukw.qwest.net. [174.21.142.130]) by smtp.gmail.com with ESMTPSA id f16-20020aa78b10000000b0050a81508653sm16875632pfd.198.2022.04.26.21.39.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Apr 2022 21:39:48 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 6/6] softfloat: Use FloatRelation for fracN_cmp Date: Tue, 26 Apr 2022 21:39:42 -0700 Message-Id: <20220427043942.294654-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220427043942.294654-1-richard.henderson@linaro.org> References: <20220427043942.294654-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::429; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x429.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Since the caller, partsN_compare, is now exclusively using FloatRelation, it's clearer to use it here too. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell Message-Id: <20220401132240.79730-4-richard.henderson@linaro.org> --- fpu/softfloat.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/fpu/softfloat.c b/fpu/softfloat.c index e7d7ad56bc..4a871ef2a1 100644 --- a/fpu/softfloat.c +++ b/fpu/softfloat.c @@ -957,21 +957,23 @@ static void frac128_allones(FloatParts128 *a) #define frac_allones(A) FRAC_GENERIC_64_128(allones, A)(A) -static int frac64_cmp(FloatParts64 *a, FloatParts64 *b) +static FloatRelation frac64_cmp(FloatParts64 *a, FloatParts64 *b) { - return a->frac == b->frac ? 0 : a->frac < b->frac ? -1 : 1; + return (a->frac == b->frac ? float_relation_equal + : a->frac < b->frac ? float_relation_less + : float_relation_greater); } -static int frac128_cmp(FloatParts128 *a, FloatParts128 *b) +static FloatRelation frac128_cmp(FloatParts128 *a, FloatParts128 *b) { uint64_t ta = a->frac_hi, tb = b->frac_hi; if (ta == tb) { ta = a->frac_lo, tb = b->frac_lo; if (ta == tb) { - return 0; + return float_relation_equal; } } - return ta < tb ? -1 : 1; + return ta < tb ? float_relation_less : float_relation_greater; } #define frac_cmp(A, B) FRAC_GENERIC_64_128(cmp, A)(A, B)