From patchwork Tue Sep 19 05:23:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiufu Guo X-Patchwork-Id: 1836511 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=k/7BNShc; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RqVTX6fKDz1ynZ for ; Tue, 19 Sep 2023 15:24:27 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id F2655385701D for ; Tue, 19 Sep 2023 05:24:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org F2655385701D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1695101064; bh=2aMN5/hbA6R/U4XYoCD8X/fh2SRIBjZR94YkIrG1BPw=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=k/7BNShcXv2ff4Vv3YG809lOsRkOJJvFtG1B+AGhZsBzlAR82bLzZfYG1SBCTNIdO 9/8TeqYPFatM7hodFW8uHaPVv63aBvhAuUw+8za6iKEEUbcDQo4NpZ1L3EuU1LJ2U8 Zt0h+W7oGHrbwSjpuiDqOGLq/EkXh/XnH7h7JXpY= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by sourceware.org (Postfix) with ESMTPS id 070143858D39; Tue, 19 Sep 2023 05:24:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 070143858D39 Received: from pps.filterd (m0356516.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 38J5HKea027992; Tue, 19 Sep 2023 05:24:01 GMT Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3t71fecm9x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 19 Sep 2023 05:24:00 +0000 Received: from m0356516.ppops.net (m0356516.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 38J57c4B029587; Tue, 19 Sep 2023 05:24:00 GMT Received: from ppma22.wdc07v.mail.ibm.com (5c.69.3da9.ip4.static.sl-reverse.com [169.61.105.92]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3t71fecm9d-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 19 Sep 2023 05:24:00 +0000 Received: from pps.filterd (ppma22.wdc07v.mail.ibm.com [127.0.0.1]) by ppma22.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 38J3OsLK005540; Tue, 19 Sep 2023 05:23:59 GMT Received: from smtprelay02.fra02v.mail.ibm.com ([9.218.2.226]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3t5q2yhdye-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 19 Sep 2023 05:23:59 +0000 Received: from smtpav04.fra02v.mail.ibm.com (smtpav04.fra02v.mail.ibm.com [10.20.54.103]) by smtprelay02.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 38J5NuCG26149548 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 19 Sep 2023 05:23:56 GMT Received: from smtpav04.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0E34720043; Tue, 19 Sep 2023 05:23:56 +0000 (GMT) Received: from smtpav04.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 122A320040; Tue, 19 Sep 2023 05:23:54 +0000 (GMT) Received: from genoa.aus.stglabs.ibm.com (unknown [9.40.192.157]) by smtpav04.fra02v.mail.ibm.com (Postfix) with ESMTP; Tue, 19 Sep 2023 05:23:53 +0000 (GMT) To: gcc-patches@gcc.gnu.org Cc: rguenther@suse.de, jeffreyalaw@gmail.com, richard.sandiford@arm.com, segher@kernel.crashing.org, dje.gcc@gmail.com, linkw@gcc.gnu.org, bergner@linux.ibm.com, guojiufu@linux.ibm.com, amacleod@redhat.com, aldyh@redhat.com Subject: [PATCH 1/2] using overflow_free_p to simplify pattern Date: Tue, 19 Sep 2023 13:23:52 +0800 Message-Id: <20230919052353.3208707-1-guojiufu@linux.ibm.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: ZyWXKLm2-LoRlwYyLkoHh9WDw1E_RoC_ X-Proofpoint-GUID: pPl8f8ze0xZylx8DAvT9oYJ7cX7s_mkn X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.980,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-09-18_11,2023-09-18_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 bulkscore=0 lowpriorityscore=0 mlxlogscore=999 suspectscore=0 adultscore=0 priorityscore=1501 impostorscore=0 malwarescore=0 spamscore=0 mlxscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2308100000 definitions=main-2309190043 X-Spam-Status: No, score=-10.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP 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.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Jiufu Guo via Gcc-patches From: Jiufu Guo Reply-To: Jiufu Guo Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" Hi, In r14-3582, an "overflow_free_p" interface is added. The pattern of "(t * 2) / 2" in match.pd can be simplified by using this interface. Bootstrap & regtest pass on ppc64{,le} and x86_64. Is this ok for trunk? BR, Jeff (Jiufu) gcc/ChangeLog: * match.pd ((t * 2) / 2): Update to use overflow_free_p. --- gcc/match.pd | 37 +++++++------------------------------ 1 file changed, 7 insertions(+), 30 deletions(-) diff --git a/gcc/match.pd b/gcc/match.pd index 87edf0e75c3..8bba7056000 100644 --- a/gcc/match.pd +++ b/gcc/match.pd @@ -926,36 +926,13 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) (if (TYPE_OVERFLOW_UNDEFINED (type)) @0 #if GIMPLE - (with - { - bool overflowed = true; - value_range vr0, vr1; - if (INTEGRAL_TYPE_P (type) - && get_range_query (cfun)->range_of_expr (vr0, @0) - && get_range_query (cfun)->range_of_expr (vr1, @1) - && !vr0.varying_p () && !vr0.undefined_p () - && !vr1.varying_p () && !vr1.undefined_p ()) - { - wide_int wmin0 = vr0.lower_bound (); - wide_int wmax0 = vr0.upper_bound (); - wide_int wmin1 = vr1.lower_bound (); - wide_int wmax1 = vr1.upper_bound (); - /* If the multiplication can't overflow/wrap around, then - it can be optimized too. */ - wi::overflow_type min_ovf, max_ovf; - wi::mul (wmin0, wmin1, TYPE_SIGN (type), &min_ovf); - wi::mul (wmax0, wmax1, TYPE_SIGN (type), &max_ovf); - if (min_ovf == wi::OVF_NONE && max_ovf == wi::OVF_NONE) - { - wi::mul (wmin0, wmax1, TYPE_SIGN (type), &min_ovf); - wi::mul (wmax0, wmin1, TYPE_SIGN (type), &max_ovf); - if (min_ovf == wi::OVF_NONE && max_ovf == wi::OVF_NONE) - overflowed = false; - } - } - } - (if (!overflowed) - @0)) + (with {value_range vr0, vr1;} + (if (INTEGRAL_TYPE_P (type) + && get_range_query (cfun)->range_of_expr (vr0, @0) + && get_range_query (cfun)->range_of_expr (vr1, @1) + && !vr0.varying_p () && !vr1.varying_p () + && range_op_handler (MULT_EXPR).overflow_free_p (vr0, vr1)) + @0)) #endif )))) From patchwork Tue Sep 19 05:23:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiufu Guo X-Patchwork-Id: 1836512 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=nEmg492H; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RqVTZ2WxHz1yny for ; Tue, 19 Sep 2023 15:24:34 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 72DA53856DE7 for ; Tue, 19 Sep 2023 05:24:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 72DA53856DE7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1695101066; bh=EPEv342b7pwoYOCisIvO0jFNM+wKIsJqMXYQcpBdcU8=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=nEmg492HePFRzRq2GqlWjq/SOXBsEzR0VExPJC9gQnmDjNPhqhlWJs3TqIowBVYyF 4cjumGr0z2Me1+cnHrAXwWE7i2MpdvGcFAlzrc/M/BvAhALZHXKOGKT3GI1PlSmj9z ODHdIVwCjM+dhU0jNHlydRjdXrUgwQ/DaSBHTWh4= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by sourceware.org (Postfix) with ESMTPS id DE11E3858C2A; Tue, 19 Sep 2023 05:24:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DE11E3858C2A Received: from pps.filterd (m0360083.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 38J58aUO015419; Tue, 19 Sep 2023 05:24:03 GMT Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3t6tywkrs0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 19 Sep 2023 05:24:03 +0000 Received: from m0360083.ppops.net (m0360083.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 38J5EkNo001064; Tue, 19 Sep 2023 05:24:03 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 3t6tywkrr5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 19 Sep 2023 05:24:02 +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 38J4ScQs031177; Tue, 19 Sep 2023 05:24:01 GMT Received: from smtprelay06.fra02v.mail.ibm.com ([9.218.2.230]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3t5r6kh17q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 19 Sep 2023 05:24:01 +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 38J5NwTA21561874 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 19 Sep 2023 05:23:58 GMT Received: from smtpav04.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 461312004D; Tue, 19 Sep 2023 05:23:58 +0000 (GMT) Received: from smtpav04.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5596020040; Tue, 19 Sep 2023 05:23:56 +0000 (GMT) Received: from genoa.aus.stglabs.ibm.com (unknown [9.40.192.157]) by smtpav04.fra02v.mail.ibm.com (Postfix) with ESMTP; Tue, 19 Sep 2023 05:23:56 +0000 (GMT) To: gcc-patches@gcc.gnu.org Cc: rguenther@suse.de, jeffreyalaw@gmail.com, richard.sandiford@arm.com, segher@kernel.crashing.org, dje.gcc@gmail.com, linkw@gcc.gnu.org, bergner@linux.ibm.com, guojiufu@linux.ibm.com, amacleod@redhat.com, aldyh@redhat.com Subject: [PATCH 2/2] testcase: rename pr111303.c to pr111324.c Date: Tue, 19 Sep 2023 13:23:53 +0800 Message-Id: <20230919052353.3208707-2-guojiufu@linux.ibm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230919052353.3208707-1-guojiufu@linux.ibm.com> References: <20230919052353.3208707-1-guojiufu@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: v4-gHRqEnddffuCWKjVJxQ0MycIoW8zn X-Proofpoint-ORIG-GUID: iXTlgkNRZjycsWY2aHtlgoxuhJ71qzQ5 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.980,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-09-18_11,2023-09-18_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=942 mlxscore=0 priorityscore=1501 bulkscore=0 lowpriorityscore=0 phishscore=0 clxscore=1015 spamscore=0 malwarescore=0 impostorscore=0 suspectscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2308100000 definitions=main-2309190043 X-Spam-Status: No, score=-10.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP 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.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Jiufu Guo via Gcc-patches From: Jiufu Guo Reply-To: Jiufu Guo Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" Hi, When commit the fix for pr111324, the test cases was named as pr111303.c by mistake. Here, rename it to pr111324.c Is this ok for trunk? BR, Jeff (Jiufu Guo) gcc/testsuite/ChangeLog: * gcc.dg/tree-ssa/pr111303.c: Rename to ... * gcc.dg/tree-ssa/pr111324.c: ... this. --- gcc/testsuite/gcc.dg/tree-ssa/{pr111303.c => pr111324.c} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename gcc/testsuite/gcc.dg/tree-ssa/{pr111303.c => pr111324.c} (100%) diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr111303.c b/gcc/testsuite/gcc.dg/tree-ssa/pr111324.c similarity index 100% rename from gcc/testsuite/gcc.dg/tree-ssa/pr111303.c rename to gcc/testsuite/gcc.dg/tree-ssa/pr111324.c