Message ID | f440fe00-9ac5-48b8-a33e-b0672cf5be94@linux.ibm.com |
---|---|
State | Accepted |
Headers |
Return-Path: <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:24d3:b0:fb:cd0c:d3e with SMTP id r19csp2504190dyi; Wed, 20 Dec 2023 00:57:00 -0800 (PST) X-Google-Smtp-Source: AGHT+IEZ3BEKdGZBK22WcRJJ+LG/oByOvizNRMOAQoXEMDrj+rs/Ob3f8Il5lMhGSHBHLkwrmzxl X-Received: by 2002:a05:620a:8396:b0:77d:a48a:62f3 with SMTP id pb22-20020a05620a839600b0077da48a62f3mr22592235qkn.60.1703062620745; Wed, 20 Dec 2023 00:57:00 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1703062620; cv=pass; d=google.com; s=arc-20160816; b=RSzg4h0W+7SEQ7NS445IN5R/vrRY4nvfLRA9pZuCmg9lNvXq8al1YN18amBV9FsBpI 0zBgNU/8Y4fI+jpt3H6KVN79w5NtiGl0s8fvFnYnF5Lacw8b+JuExa8bF92sP3OG08s0 /xe1kmuBXvvee4LvS6TQc4+Lha3jiCocE9m3HiRDN+uJf3T+a2eNNnukKi4z+kFs8ifv pzMPk4p/NTgBxhA8LzHU8Y7kiwSlpDcyhtBk1HYOkxmZDUYLrCoCOPBjAPpDkvBQmej7 iMEJxnFKOskgtlO7jUEQuy+XszjHh+6p5SUQEqc4R+XoXU2FOH8LtYIo2+VxWN6En64h /8Yg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :subject:from:cc:to:content-language:user-agent:mime-version:date :message-id:dkim-signature:arc-filter:dmarc-filter:delivered-to; bh=NOYjG08phZwDNbX5W5LgxJV9MgmP0xkztCDtLsZkMOk=; fh=3eUSxJU+9IWNwGHlMjnmqDQDnJfeMKAjlglEUO7a4vw=; b=nK92yUic/aY1i1L3ElmdM1Mn6sKICFi3krCjd9RnDUXBAf5anXbH0geZf4uJz+ctAu TyBIfoFtJpwGtB5lYIqR16dXVD1v3/uIbkvHO22slzOEtfTAqOUWy+kyeoC3dBSbpiqo ScBELOwa3K1swvqh0euUqPu8021INe84c0sACRSn3w0fwwM/2LjE9/YpLggBiEF5abSB tAPFOE3MiOIL2FYNyiE8dkp4tnVwmbc73f/cwotEF373bMm4Bjd7BY/DER1ILLd1kAsB yWwVtMbp3pbGC7GoxtYyJRZH+MmEHOhoAQ8GiJFYSIg4s1+HwxkY1kkRm1Zm81D9TzWE o0sQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=qEIOSe14; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id t21-20020a05620a451500b0077573396927si30458215qkp.260.2023.12.20.00.57.00 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Dec 2023 00:57:00 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=qEIOSe14; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 784C6385E443 for <ouuuleilei@gmail.com>; Wed, 20 Dec 2023 08:57:00 +0000 (GMT) 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 2F6293858D20 for <gcc-patches@gcc.gnu.org>; Wed, 20 Dec 2023 08:56:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2F6293858D20 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 ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 2F6293858D20 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1703062597; cv=none; b=nwSLpho07NA54XTpA9g1tP5P2LqcDpziQW3zlgWWiwKF6Ot5pUmBl3odMugr2+LEMK3gzDdUXJ7CdTeXfJDsFn3dt5VHf2wkBOrfEhIoh7oYa96bQRX3+Jh6GvJ76WMKeG+YvC3Wz5rTzd+DRsSZvxGexrgKooAzMscVefv6gH4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1703062597; c=relaxed/simple; bh=muEPOlUeRjiyZgG43dlCoViMq1Rm47asdkzij5zYVr4=; h=DKIM-Signature:Message-ID:Date:MIME-Version:To:From:Subject; b=ajNPu2tGipp3A6WmXaA4jMb5unBA6TRQRmx5v9pwFzAcUUjz1esLUs49LGzebCFrXPnyB/tsgGK4tdOeTkM0HFMh2UjpxXoGTFmwhweUH45Vj0bOqX+l7d/3a54ZUwC4C9nz+x5/wC2MtnHJw8t2McWgQOSBvUdybu029odpQeQ= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from pps.filterd (m0353725.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3BK8CiLA026073; Wed, 20 Dec 2023 08:56:33 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=message-id : date : mime-version : to : cc : from : subject : content-type : content-transfer-encoding; s=pp1; bh=NOYjG08phZwDNbX5W5LgxJV9MgmP0xkztCDtLsZkMOk=; b=qEIOSe14Hw36KsBGOLuBz+p44AnddBDx3Odrj+WHaVaP87Tg+vHKq8HBxorMuIxPPsky v4Jw1GMfZfdriHEtVXjGK8XuxV5wEgHK7cfOr+Pb+jL7yA+aNY8Ed2EhL0TSuJp0YIva WPIqWnNf9nWTRkGzzGWbvlijJ+Xstnc2IOnkENPkzncT4nq2DDVfmgErQfAwmgKyK3rp PzIbloVaaHEeQTHOxhBRv0I6cIH7+lkg1yuUffSG33x1TPGb21/tcF6K41mxsj3F8yZ8 BjyAlI6bpzIrzf3/NjnVihxs42Wp64V2RZOCSrESmPFPz3R2Q47dp6zbIo0KsuPoH6QX Bg== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3v3q9jg5g7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 20 Dec 2023 08:56:33 +0000 Received: from m0353725.ppops.net (m0353725.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3BK8t3AO011894; Wed, 20 Dec 2023 08:56:33 GMT Received: from ppma11.dal12v.mail.ibm.com (db.9e.1632.ip4.static.sl-reverse.com [50.22.158.219]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3v3q9jg5fy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 20 Dec 2023 08:56:33 +0000 Received: from pps.filterd (ppma11.dal12v.mail.ibm.com [127.0.0.1]) by ppma11.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 3BK63D7I012418; Wed, 20 Dec 2023 08:56:32 GMT Received: from smtprelay06.fra02v.mail.ibm.com ([9.218.2.230]) by ppma11.dal12v.mail.ibm.com (PPS) with ESMTPS id 3v1rx1vwr0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 20 Dec 2023 08:56:32 +0000 Received: from smtpav03.fra02v.mail.ibm.com (smtpav03.fra02v.mail.ibm.com [10.20.54.102]) by smtprelay06.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 3BK8uTeh35455290 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 20 Dec 2023 08:56:29 GMT Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 20F2E20043; Wed, 20 Dec 2023 08:56:29 +0000 (GMT) Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9991520040; Wed, 20 Dec 2023 08:56:27 +0000 (GMT) Received: from [9.200.103.64] (unknown [9.200.103.64]) by smtpav03.fra02v.mail.ibm.com (Postfix) with ESMTP; Wed, 20 Dec 2023 08:56:27 +0000 (GMT) Message-ID: <f440fe00-9ac5-48b8-a33e-b0672cf5be94@linux.ibm.com> Date: Wed, 20 Dec 2023 16:56:26 +0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US To: gcc-patches <gcc-patches@gcc.gnu.org> Cc: Segher Boessenkool <segher@kernel.crashing.org>, David <dje.gcc@gmail.com>, "Kewen.Lin" <linkw@linux.ibm.com>, Peter Bergner <bergner@linux.ibm.com> From: HAO CHEN GUI <guihaoc@linux.ibm.com> Subject: [Patch, rs6000] Call library for block memory compare when optimizing for size Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: Xv2XNRXfYc5QiR-A-Xo_0luxluhAflH8 X-Proofpoint-GUID: 10Wb-Xn81b7K1rULxWkk9p9UHbRQpgBI X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-12-20_02,2023-12-14_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 spamscore=0 phishscore=0 mlxscore=0 mlxlogscore=999 impostorscore=0 bulkscore=0 priorityscore=1501 suspectscore=0 malwarescore=0 lowpriorityscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2312200062 X-Spam-Status: No, score=-12.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_MSPIKE_H4, 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 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785790590817776248 X-GMAIL-MSGID: 1785790590817776248 |
Series |
[rs6000] Call library for block memory compare when optimizing for size
|
|
Checks
Context | Check | Description |
---|---|---|
snail/gcc-patch-check | success | Github commit url |
Commit Message
HAO CHEN GUI
Dec. 20, 2023, 8:56 a.m. UTC
Hi, This patch call library function for block memory compare when it's optimized for size. Bootstrapped and tested on x86 and powerpc64-linux BE and LE with no regressions. Is this OK for trunk? Thanks Gui Haochen ChangeLog rs6000: Call library for block memory compare when optimizing for size gcc/ * config/rs6000/rs6000-string.cc (expand_block_compare): Return false when optimizing for size. gcc/testsuite/ * gcc.target/powerpc/block-cm-3.c: New. patch.diff
Comments
Hi Haochen, on 2023/12/20 16:56, HAO CHEN GUI wrote: > Hi, > This patch call library function for block memory compare when it's > optimized for size. > > Bootstrapped and tested on x86 and powerpc64-linux BE and LE with no > regressions. Is this OK for trunk? > > Thanks > Gui Haochen > > ChangeLog > rs6000: Call library for block memory compare when optimizing for size > > gcc/ > * config/rs6000/rs6000-string.cc (expand_block_compare): Return > false when optimizing for size. > > gcc/testsuite/ > * gcc.target/powerpc/block-cm-3.c: New. Nit: s/cm/cmp/ > > patch.diff > diff --git a/gcc/config/rs6000/rs6000-string.cc b/gcc/config/rs6000/rs6000-string.cc > index 05dc41622f4..5149273b80e 100644 > --- a/gcc/config/rs6000/rs6000-string.cc > +++ b/gcc/config/rs6000/rs6000-string.cc > @@ -1947,6 +1947,9 @@ expand_block_compare_gpr(unsigned HOST_WIDE_INT bytes, unsigned int base_align, > bool > expand_block_compare (rtx operands[]) > { > + if (optimize_insn_for_size_p ()) > + return false; Thanks for separating this out. I just noticed that for expander cmpstrnsi and cmpstrsi, we put this check in the associated {} code, since it doesn't need extra checks here, I'd prefer to move this check to cmpmemsi to keep consistent with the existing ones. OK for trunk with this move (also tested well), thanks! BR, Kewen > + > rtx target = operands[0]; > rtx orig_src1 = operands[1]; > rtx orig_src2 = operands[2]; > diff --git a/gcc/testsuite/gcc.target/powerpc/block-cmp-3.c b/gcc/testsuite/gcc.target/powerpc/block-cmp-3.c > new file mode 100644 > index 00000000000..c7e853ad593 > --- /dev/null > +++ b/gcc/testsuite/gcc.target/powerpc/block-cmp-3.c > @@ -0,0 +1,8 @@ > +/* { dg-do compile } */ > +/* { dg-options "-Os" } */ > +/* { dg-final { scan-assembler-times {\mb[l]? memcmp\M} 1 } } */ > + > +int foo (const char* s1, const char* s2) > +{ > + return __builtin_memcmp (s1, s2, 4); > +} >
diff --git a/gcc/config/rs6000/rs6000-string.cc b/gcc/config/rs6000/rs6000-string.cc index 05dc41622f4..5149273b80e 100644 --- a/gcc/config/rs6000/rs6000-string.cc +++ b/gcc/config/rs6000/rs6000-string.cc @@ -1947,6 +1947,9 @@ expand_block_compare_gpr(unsigned HOST_WIDE_INT bytes, unsigned int base_align, bool expand_block_compare (rtx operands[]) { + if (optimize_insn_for_size_p ()) + return false; + rtx target = operands[0]; rtx orig_src1 = operands[1]; rtx orig_src2 = operands[2]; diff --git a/gcc/testsuite/gcc.target/powerpc/block-cmp-3.c b/gcc/testsuite/gcc.target/powerpc/block-cmp-3.c new file mode 100644 index 00000000000..c7e853ad593 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/block-cmp-3.c @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-options "-Os" } */ +/* { dg-final { scan-assembler-times {\mb[l]? memcmp\M} 1 } } */ + +int foo (const char* s1, const char* s2) +{ + return __builtin_memcmp (s1, s2, 4); +}