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 85BDF3858C66 for ; Tue, 1 Aug 2023 09:36:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 85BDF3858C66 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=linux.ibm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linux.ibm.com Received: from pps.filterd (m0356517.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3719WL51007492; Tue, 1 Aug 2023 09:36:13 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=date : from : to : cc : subject : message-id : references : content-type : in-reply-to : content-transfer-encoding : mime-version; s=pp1; bh=SYIj06eUnR6/VIgX1A6e4MJVtUuUuagLINBGu5BYjVs=; b=G9igQYWg5PAYxy+9a/2zENeqTZDxqW/dSg5CAT0G1jQDeP6NLCArSwgbw088vOr/7WHL JG9RvMYJCW5f9XoFvm1WpQsNSYSmI2m9F6v+BiwePh9JiGcbuKn8OARLiWjOTCW4uydI QAnPMXRq/33kHnb3XC+JP1FyChGj5aUKMntdfu7uvzqFaY/xaUuDHGbjZAqVHTJY4lUs pNlZbdG5A29oq4MIC/Q9y6yYQj+TKrYOPCuT+/VAHXYTVyRV+ibyXyzgCkcEBwgphQ4r G0yLiT++Cmk5PK7mcRrA+PBKn7e2sfXEB6zvNN/tZgaIi/Tiw+JvuR2jaIEHhUgIiR8Y Tw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3s6ygp08cb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 01 Aug 2023 09:36:12 +0000 Received: from m0356517.ppops.net (m0356517.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3719XEvg011786; Tue, 1 Aug 2023 09:36:12 GMT Received: from ppma23.wdc07v.mail.ibm.com (5d.69.3da9.ip4.static.sl-reverse.com [169.61.105.93]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3s6ygp089q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 01 Aug 2023 09:36:11 +0000 Received: from pps.filterd (ppma23.wdc07v.mail.ibm.com [127.0.0.1]) by ppma23.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 3719E2PN019090; Tue, 1 Aug 2023 09:36:10 GMT Received: from smtprelay06.fra02v.mail.ibm.com ([9.218.2.230]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3s5ekkah7h-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 01 Aug 2023 09:36:10 +0000 Received: from smtpav04.fra02v.mail.ibm.com (smtpav04.fra02v.mail.ibm.com [10.20.54.103]) by smtprelay06.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 3719a8NS39977660 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 1 Aug 2023 09:36:08 GMT Received: from smtpav04.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 21B8320043; Tue, 1 Aug 2023 09:36:08 +0000 (GMT) Received: from smtpav04.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CA42B20040; Tue, 1 Aug 2023 09:36:07 +0000 (GMT) Received: from li-819a89cc-2401-11b2-a85c-cca1ce6aa768.ibm.com (unknown [9.171.45.120]) by smtpav04.fra02v.mail.ibm.com (Postfix) with ESMTPS; Tue, 1 Aug 2023 09:36:07 +0000 (GMT) Date: Tue, 1 Aug 2023 11:36:07 +0200 From: Stefan Schulze Frielinghaus To: Prathamesh Kulkarni Cc: Jeff Law , gcc-patches@gcc.gnu.org Subject: Re: [PATCH v2] combine: Narrow comparison of memory and constant Message-ID: References: <20230619142356.345159-1-stefansf@linux.ibm.com> <0d598847-2fb0-7ee3-db3c-259632c9a91a@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-TM-AS-GCONF: 00 X-Proofpoint-GUID: VPU0HkUbWmJShium96BgFA9_7gV8QDCv X-Proofpoint-ORIG-GUID: sSh1T8QYvu_91Ymeo1RaNxpdSiyZ8VhL 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.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-08-01_04,2023-07-31_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 mlxscore=0 mlxlogscore=959 clxscore=1011 malwarescore=0 lowpriorityscore=0 spamscore=0 suspectscore=0 bulkscore=0 phishscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2308010087 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,KAM_SHORT,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,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 List-Id: On Tue, Aug 01, 2023 at 01:52:16PM +0530, Prathamesh Kulkarni wrote: > On Tue, 1 Aug 2023 at 05:20, Jeff Law wrote: > > > > > > > > On 7/31/23 15:43, Prathamesh Kulkarni via Gcc-patches wrote: > > > On Mon, 19 Jun 2023 at 19:59, Stefan Schulze Frielinghaus via > > > Gcc-patches wrote: > > >> > > >> Comparisons between memory and constants might be done in a smaller mode > > >> resulting in smaller constants which might finally end up as immediates > > >> instead of in the literal pool. > > >> > > >> For example, on s390x a non-symmetric comparison like > > >> x <= 0x3fffffffffffffff > > >> results in the constant being spilled to the literal pool and an 8 byte > > >> memory comparison is emitted. Ideally, an equivalent comparison > > >> x0 <= 0x3f > > >> where x0 is the most significant byte of x, is emitted where the > > >> constant is smaller and more likely to materialize as an immediate. > > >> > > >> Similarly, comparisons of the form > > >> x >= 0x4000000000000000 > > >> can be shortened into x0 >= 0x40. > > >> > > >> Bootstrapped and regtested on s390x, x64, aarch64, and powerpc64le. > > >> Note, the new tests show that for the mentioned little-endian targets > > >> the optimization does not materialize since either the costs of the new > > >> instructions are higher or they do not match. Still ok for mainline? > > > Hi Stefan, > > > Unfortunately this patch (committed in 7cdd0860949c6c3232e6cff1d7ca37bb5234074c) > > > caused the following ICE on armv8l-unknown-linux-gnu: > > > during RTL pass: combine > > > ../../../gcc/libgcc/fixed-bit.c: In function ‘__gnu_saturate1sq’: > > > ../../../gcc/libgcc/fixed-bit.c:210:1: internal compiler error: in > > > decompose, at rtl.h:2297 > > > 210 | } > > > | ^ > > > 0xaa23e3 wi::int_traits > > >> ::decompose(long long*, unsigned int, std::pair > > machine_mode> const&) > > > ../../gcc/gcc/rtl.h:2297 > > [ ... ] > > Yea, we're seeing something very similar on nios2-linux-gnu building the > > kernel. > > > > Prathamesh, can you extract the .i file for fixed-bit on armv8 and open > > a bug for this issue, attaching the .i file as well as the right command > > line options necessary to reproduce the failure. THat way Stefan can > > tackle it with a cross compiler. > Hi Jeff, > Filed the issue in https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110867 Hi Prathamesh, Sorry for the inconvenience. I will have a look at this and thanks for the small reproducer. I already started to come up with a cross compiler. Thanks, Stefan > > Thanks, > Prathamesh > > > > Thanks, > > jeff