From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate.crashing.org (gate.crashing.org [63.228.1.57]) by sourceware.org (Postfix) with ESMTP id A5D983858D37 for ; Thu, 18 Apr 2024 10:36:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A5D983858D37 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=kernel.crashing.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=kernel.crashing.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org A5D983858D37 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=63.228.1.57 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1713436609; cv=none; b=TX8AAW5WWqkSJ8kzmtmyiUlpIjLhgmI6PQRSlFO/J7dR7HL93UiG4iYycZX7KKvwto0xLlCCeKH8frn42a/dI9jsHwyDaYzVqAHBqEmlssI+Jr93CB74hTBfFBhRmv8CuyVwGUjwD0r/x9mV89ccrT5+Kzhta5DspHKgMb8oNVY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1713436609; c=relaxed/simple; bh=Rpp8rz5yk+rJXggktjEX4Rp5NETb6664qnITXn3XUj4=; h=Date:From:To:Subject:Message-ID:Mime-Version; b=cJ17e0N5R5GMkfYje6kyEc+JlXAR3ss5cfKfIHmnQFoYYHOJVFrlMV09aNEjFSJldKHWH7m/SDN38mV+u+WbcLiOuG9MgduIb8MkT1jkImP/Io9gF0c3xaDl7Kg0NEld8TugPUEJgVynMwCjR4pH+sgz9bD8vqfpDOqdqQZh3JQ= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from gate.crashing.org (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.14.1) with ESMTP id 43IAZgO4019002; Thu, 18 Apr 2024 05:35:42 -0500 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id 43IAZfli018999; Thu, 18 Apr 2024 05:35:41 -0500 X-Authentication-Warning: gate.crashing.org: segher set sender to segher@kernel.crashing.org using -f Date: Thu, 18 Apr 2024 05:35:41 -0500 From: Segher Boessenkool To: "Kewen.Lin" Cc: HAO CHEN GUI , David , Peter Bergner , gcc-patches Subject: Re: [PATCH, rs6000] Use bcdsub. instead of bcdadd. for bcd invalid number checking Message-ID: <20240418103541.GR19790@gate.crashing.org> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,JMQ_SPF_NEUTRAL,KAM_DMARC_STATUS,SPF_HELO_PASS,SPF_PASS,TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Thu, Apr 18, 2024 at 11:14:42AM +0800, Kewen.Lin wrote: > on 2024/4/18 10:01, HAO CHEN GUI wrote: > > This patch replace bcdadd. with bcdsub. for bcd invalid number checking. > > bcdadd on two same numbers might cause overflow which also set > > overflow/invalid bit so that we can't distinguish it's invalid or overflow. > > The bcdsub doesn't have the problem as subtracting on two same number never > > causes overflow. > > > > Bootstrapped and tested on powerpc64-linux BE and LE with no > > regressions. Is it OK for the trunk? > > Considering that this issue affects some basic functionality of bcd bifs > and the fix itself is simple and very safe, OK for trunk, thanks for fixing! Yup. If a number X is invalid the X-X calculation might set the overflow flag as well, but we cannot see that difference at all anyway, it always has set the invalid flag after all. Thanks! Segher