| Message ID | 20260927005630.8202-1-kaloz@kernel.org |
|---|---|
| State | New |
| Headers | show
Return-Path: <SRS0=jMT5=HT=vger.kernel.org=sparclinux+bounces-8069-patchwork-incoming=ozlabs.org@ozlabs.org> X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=BFvrXsK4; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.org (client-ip=150.107.74.76; helo=mail.ozlabs.org; envelope-from=srs0=jmt5=ht=vger.kernel.org=sparclinux+bounces-8069-patchwork-incoming=ozlabs.org@ozlabs.org; receiver=patchwork.ozlabs.org) Received: from mail.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (secp384r1 raw public key) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4hsmJB0Y7Sz1xyl for <incoming@patchwork.ozlabs.org>; Sun, 27 Sep 2026 10:57:44 +1000 (AEST) Received: from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4hsmHd0yfcz4wLb for <incoming@patchwork.ozlabs.org>; Sun, 27 Sep 2026 10:57:17 +1000 (AEST) Received: by gandalf.ozlabs.org (Postfix) id 4hsmHd0rNbz4wLp; Sun, 27 Sep 2026 10:57:17 +1000 (AEST) Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: gandalf.ozlabs.org; arc=pass smtp.remote-ip=172.105.105.114 arc.chain=subspace.kernel.org ARC-Seal: i=2; a=rsa-sha256; d=ozlabs.org; s=201707; t=1790470637; cv=pass; b=rzRhz+WR0TwJNupXqt9Oh6OrqgqbFeTlUHRPVv9EWluuMoJu1aYRmeCsmxRzWygqiPGZvaQMhAxSk4+QQaPwA+o1/hDvC6QENR73DQ1cJ5QkTQyn5kqvLHVGaL4BlcG+wq9VZPrjrhPven/eg0WURP4A+vhdjEJrJReJhK5rjiqzFmaqdlC3qhUQyUTvyZmKiWOCgjfJxs1EhhfuMkDcPO+kxAdKkDzHUImwEHN3IQkiBD2f2iVkAI2BnPmi9ioM0zU41eRNGPni4PduyFNi7TT5ClCLGPAIYn2KqFQ80u4jpj4NyvjdufOQTTw9XuUWu9KLWAzSH8bNLgiKrNIA9w== ARC-Message-Signature: i=2; a=rsa-sha256; d=ozlabs.org; s=201707; t=1790470637; c=relaxed/relaxed; bh=mlGblNF0KjkLghO+zmfgnegg8eN2gwMPX91bcyPsmTw=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=DfYGdY4CQ2SeaKPWyvztkzlTmMyKR3rHGIAyDEGf+bMQ/Ir9UT0bt67/d0Sljkx7jtSMpGD7VEX1DODZ3NxL4BnjCHjpcx9GbZ3AlfX+65qbn57MDSiWXcRlSsW4AsMw2Jx5Psobd4Od5Vyv15qifQb9ZN3OcZMp3gugckvcY1SMM7G9kHzbJ22ce0MZSQdZqdxW16Mtcs15Wl83p8JHSjJd5b1BB6d46ZvEYvA483TzvEBU0BuBmg34VUUR9eNQKK/wrxrlzm8xXU02zCsm0MgiRzzZVjmN05egWqr8Q50EB6yi4YftnOFPB47LkVbXhGIRIP/h1BRl5VsBbQixjQ== ARC-Authentication-Results: i=2; gandalf.ozlabs.org; dmarc=pass (p=quarantine dis=none) header.from=kernel.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=BFvrXsK4; dkim-atps=neutral; spf=pass (client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=sparclinux+bounces-8069-patchwork-incoming=ozlabs.org@vger.kernel.org; receiver=ozlabs.org) smtp.mailfrom=vger.kernel.org Authentication-Results: gandalf.ozlabs.org; dmarc=pass (p=quarantine dis=none) header.from=kernel.org Authentication-Results: gandalf.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=BFvrXsK4; dkim-atps=neutral Authentication-Results: gandalf.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=sparclinux+bounces-8069-patchwork-incoming=ozlabs.org@vger.kernel.org; receiver=ozlabs.org) Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519) (No client certificate requested) by gandalf.ozlabs.org (Postfix) with ESMTPS id 4hsmHY4BVhz4wLb for <patchwork-incoming@ozlabs.org>; Sun, 27 Sep 2026 10:57:13 +1000 (AEST) Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1]) by tor.lore.kernel.org (Postfix) with ESMTP id 6BD7E29606 for <patchwork-incoming@ozlabs.org>; Sun, 27 Sep 2026 00:57:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CCE7927057D; Sun, 27 Sep 2026 00:57:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="BFvrXsK4" X-Original-To: sparclinux@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A25FE846A; Sun, 27 Sep 2026 00:57:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790470654; cv=none; b=D8d99eMFIXBuOa5w+guphAOOJ6XBlKCdZRlxbTK/4AHjM5fpbM9RTl3zrF+4F03C1kYZhIAO90fIZOLBMgIanGbG4N+X/fT1oQOx/ShkOH3JE/YAtzWI5/r9jqdqbJMPOaNCe0GR3VHckWwz5LbpgECSW5EHZzUxNoTsFw+Oz80= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790470654; c=relaxed/simple; bh=kWIOhGRUlAQyfvB6LGJ7tanRtsf+WUVQo1enbwMxuLw=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=F5nF/nu12ApivQ5SxDdZNYQTGVEfhs9GhSO1fqyTpYoLvNME6EfV3jpfUOg5RlH+40trOOeudKvMotsvW/7NXTVbs/xZSI78ycEDOPoXk7hLXStMGKQi0M18FQN3ycb/iyTkWmKA3omdimyGioSrbDiPM6kiCFdXj/YlV5w4r2E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=BFvrXsK4; arc=none smtp.client-ip=100.103.45.18 Received: by smtp.kernel.org (Postfix) with ESMTPSA id E19A51F000FF; Sun, 27 Sep 2026 00:57:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1790470653; bh=mlGblNF0KjkLghO+zmfgnegg8eN2gwMPX91bcyPsmTw=; h=From:To:Cc:Subject:Date; b=BFvrXsK4Z2evgqJht13bk8twZr1rA0W6y6Yaj44gk28lZyGl0o8dM3b5S3YtNlIZO knkE1+eFF4LZz0OKFCTu57sY7YDLFZ66brfNeEEiMkgSlqeuTW0fXMyrPqo4NIxJy0 2cEv1Hq+MtNqi4xsqMjNkDIqi/QZUaXZX1kzGrWynoipmap3GGaYp8fSr+9dbPX/OW fFETXxYRJmchojdxtrMcryp8iABdQFNRJskE740OCGbnbCP8cTZnEYnCViv800SUnA V5zSw/KKRU8PZTO4dOxNhjEsSBCiZtm7oEDeNu0rERl5d7Dku1IYwTqSYYXeT3e8sg rjZX0B6Vm/HLA== From: Imre Kaloz <kaloz@kernel.org> To: Andreas Larsson <andreas@gaisler.com>, sparclinux@vger.kernel.org Cc: "David S. Miller" <davem@davemloft.net>, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH] math-emu: fix wrong word index in _FP_FRAC_CLZ_4 Date: Sun, 27 Sep 2026 02:56:30 +0200 Message-ID: <20260927005630.8202-1-kaloz@kernel.org> X-Mailer: git-send-email 2.47.3 Precedence: bulk X-Mailing-List: sparclinux@vger.kernel.org List-Id: <sparclinux.vger.kernel.org> List-Subscribe: <mailto:sparclinux+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:sparclinux+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DMARC_PASS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=disabled version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on gandalf.ozlabs.org |
| Series |
math-emu: fix wrong word index in _FP_FRAC_CLZ_4
|
expand
|
diff --git a/include/math-emu/op-4.h b/include/math-emu/op-4.h index ba226f8237a6..429c8f5cbf8a 100644 --- a/include/math-emu/op-4.h +++ b/include/math-emu/op-4.h @@ -170,7 +170,7 @@ } \ else if (X##_f[1]) \ { \ - __FP_CLZ(R,X##_f[2]); \ + __FP_CLZ(R,X##_f[1]); \ R += _FP_W_TYPE_SIZE*2; \ } \ else \
_FP_FRAC_CLZ_4 picks a word by testing X##_f[3], X##_f[2] and X##_f[1] in turn and counts the leading zeros of the first non-zero one. The X##_f[1] branch passes X##_f[2] to __FP_CLZ, a word already known to be zero, so the result is 3 * _FP_W_TYPE_SIZE - 1 whatever X##_f[1] holds. Normalizing a quad then shifts by up to a word too much whenever the leading set bit falls in word 1. sparc traps every quad operation to do_mathemu(), so hex floats parsed by strtod() and scanf() in ordinary user code come back wrong. With this, the affected float-parse tests pass on a SPARCstation 20. The wrong index has been there since 2.1.97. Cc: stable@vger.kernel.org Signed-off-by: Imre Kaloz <kaloz@kernel.org> --- Notes: - _FP_FRAC_CLZ_4 is the generic 4-word helper in include/math-emu/op-4.h, which is why LKML is on Cc. - The checkpatch error "space required after that ','" is the surrounding soft-fp idiom: every neighbouring line in op-4.h is written __FP_CLZ(R,X##_f[N]). - No Fixes: tag: this has been broken since 2.1.97, before the git history. checkpatch asks for one to go with the stable@ Cc, but there is no commit to name. include/math-emu/op-4.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) base-commit: 62f4c998b297cf233997a2b4cd6fc2d2df0319c9