From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by sourceware.org (Postfix) with ESMTPS id F1A27385734E for ; Mon, 6 Jun 2022 08:14:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org F1A27385734E Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 2567SJGP005055; Mon, 6 Jun 2022 08:14:29 GMT Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3gggpvbm9u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 06 Jun 2022 08:14:29 +0000 Received: from m0098409.ppops.net (m0098409.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 2567J4Xq009210; Mon, 6 Jun 2022 08:14:28 GMT Received: from ppma02fra.de.ibm.com (47.49.7a9f.ip4.static.sl-reverse.com [159.122.73.71]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3gggpvbm9a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 06 Jun 2022 08:14:28 +0000 Received: from pps.filterd (ppma02fra.de.ibm.com [127.0.0.1]) by ppma02fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 25685UgF029104; Mon, 6 Jun 2022 08:14:26 GMT Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by ppma02fra.de.ibm.com with ESMTP id 3gfy191m90-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 06 Jun 2022 08:14:26 +0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 2568ENn050135496 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 6 Jun 2022 08:14:23 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id EAF4CA405B; Mon, 6 Jun 2022 08:14:22 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4FDCDA4055; Mon, 6 Jun 2022 08:14:21 +0000 (GMT) Received: from [9.197.236.5] (unknown [9.197.236.5]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Mon, 6 Jun 2022 08:14:21 +0000 (GMT) Message-ID: <7eb60529-5da2-f4e2-033d-e01a51513367@linux.ibm.com> Date: Mon, 6 Jun 2022 16:14:19 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: [PATCH v2, rs6000] Fix ICE on expand bcd__ [PR100736] Content-Language: en-US To: Segher Boessenkool Cc: "Kewen.Lin" , Peter Bergner , gcc-patches , David References: <41da7001-549d-c7ae-fa6b-534a8faf673e@linux.ibm.com> <20220531235600.GU25951@gate.crashing.org> <20220601220514.GY25951@gate.crashing.org> <0660b290-bb3c-9494-d232-4dcb192351eb@linux.ibm.com> <20220602090406.GA25951@gate.crashing.org> From: HAO CHEN GUI In-Reply-To: <20220602090406.GA25951@gate.crashing.org> Content-Type: text/plain; charset=UTF-8 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: 2jCbuS2aslRdw96NBL9GLt1-gCjPqi3P X-Proofpoint-GUID: zPcRyO9huzZSOzvA0DBA2q00yNOgVhqF Content-Transfer-Encoding: 8bit X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.874,Hydra:6.0.517,FMLib:17.11.64.514 definitions=2022-06-06_02,2022-06-03_01,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 priorityscore=1501 lowpriorityscore=0 suspectscore=0 spamscore=0 mlxlogscore=999 mlxscore=0 impostorscore=0 bulkscore=0 phishscore=0 clxscore=1015 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2204290000 definitions=main-2206060037 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, NICE_REPLY_A, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Jun 2022 08:14:32 -0000 On 2/6/2022 下午 5:04, Segher Boessenkool wrote: > Hi! > > On Thu, Jun 02, 2022 at 01:30:04PM +0800, HAO CHEN GUI wrote: >> Segher, >> Does BCD comparison return false when either operand is invalid coding? > > It sets all of LT, GT, and EQ to 0 (it normally sets exactly one of them > to 1). It sets bit 3 (the "SO" bit usually) to 1. > > That is what the machine insns do. What the builtins do is undefined as > far as I know? If So we can do whatever is most convenient, so, not > handle it specifically at all, just go with what falls out. We defined the following unordered BCD builtins in rs6000-builtin.def. They check the bit 3 for overflow. const signed int __builtin_bcdadd_ov_v1ti (vsq, vsq, const int<1>); BCDADD_OV_V1TI bcdadd_unordered_v1ti {} const signed int __builtin_bcdadd_ov_v16qi (vsc, vsc, const int<1>); BCDADD_OV_V16QI bcdadd_unordered_v16qi {} Also Xlc defines three BCD builtins for overflow and invalid coding. https://www.ibm.com/docs/en/xl-c-and-cpp-linux/16.1.1?topic=functions-bcd-test-add-subtract-overflow Shall GCC keep up with Xlc? Please advise. Thanks Gui Haochen > >> If yes, the result could be 3-way. We can check gt and eq bits for ge. > > You can check the LT bit, instead: it is only one branch insn, and also > only one setbc[r] insn (it can be slightly more expensive if you can use > only older insns). > >> We still can't use crnot to only check lt bit as there could be invalid >> coding. >> Also, do you think finite-math-only excludes invalid coding? Seems GCC >> doesn't clear define it. > > This is not floating-point code at all, it should not be influenced at > all by finite-math-only! > > > Segher