From patchwork Wed May 8 06:47:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: HAO CHEN GUI X-Patchwork-Id: 1932841 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=HZcABds7; 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 4VZ62Q4QBVz1ymg for ; Wed, 8 May 2024 17:18:53 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 9438F3882673 for ; Wed, 8 May 2024 07:18:51 +0000 (GMT) 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 D3507384CB97 for ; Wed, 8 May 2024 07:18:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D3507384CB97 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 D3507384CB97 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=148.163.156.1 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1715152711; cv=none; b=B9GDwcBtTbm2GjMgZUyd+VBdP5FCZlyuTum7OAqA5OCX/R7TpQLPCwDgLm63olokGVtYtsU4C699ZjvYHVxFjqmNLrKUS1AxlgCRlgD/SR0I7mSDM09hiIWh+j66pKhaZFN0XJHLXKMPQ12MJJ2qxZbO2qvEGxBgtT7bW3wT8as= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1715152711; c=relaxed/simple; bh=eWEvNuOnTU7yE4JyLXy5OKJGXFUTlnFPtL5etlYDHdQ=; h=DKIM-Signature:Message-ID:Date:MIME-Version:To:From:Subject; b=ul/6KHPDmL/VgtUHRDK8KGymxp3jwzp2fKwVXusNfwx15ry09M5heS33xfnWPwPSDLxhi0FRMRCvMgiG9s8pvOj2NPpsQroIP5CUm9n3RGFu+s/Im4ZKctEEu8XV0bNL+i7CqE9atxRPaB5Eu98s66Idx4YXPo++WiA/a9mjado= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from pps.filterd (m0353726.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 4487HtNK004334; Wed, 8 May 2024 07:18:29 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=F7daUF3E4nB10rJZ/BXlT3NIxkDfhV9GIBsjCUJoToQ=; b=HZcABds7inLO6o9AC3SvLFCj5nNLMpeYmioQh8dOfyANarx1yptrdTFf5+9wXuklfy1D DHBGSpMtdmTTqGbhlU5KKBD4wF6tFdiGKbq5T8KoNegG2bfRKcK/UUhWyTpDYN5Hzn1+ 4uR450sl6ypdHtn3mHMApWM9+Uf7aqwYufGIFpJ+I109fS/QNoHLAZ3z10f5FvNv5GAi UHkT6VqrF3Rs8Hh1MyynZ8tzHcxYgaION2USV8fUZ28CjfT6NW4/qAy3yvJXcAMdSpbb 6zbxK8Og0bRqCixUv9hQK9u2iR2ZIioQE6gpe0BFurqc8WgfEbUsTUPCvaxJLGIgkE5R lA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3y04ve801j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 08 May 2024 07:18:28 +0000 Received: from m0353726.ppops.net (m0353726.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 4487ISct004748; Wed, 8 May 2024 07:18:28 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 3y04ve801d-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 08 May 2024 07:18:28 +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 4484WIm1017400; Wed, 8 May 2024 06:47:20 GMT Received: from smtprelay04.fra02v.mail.ibm.com ([9.218.2.228]) by ppma11.dal12v.mail.ibm.com (PPS) with ESMTPS id 3xyshsu5gp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 08 May 2024 06:47:20 +0000 Received: from smtpav02.fra02v.mail.ibm.com (smtpav02.fra02v.mail.ibm.com [10.20.54.101]) by smtprelay04.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 4486lDQ211534794 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 8 May 2024 06:47:16 GMT Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D486120040; Wed, 8 May 2024 06:47:13 +0000 (GMT) Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 667E12004B; Wed, 8 May 2024 06:47:12 +0000 (GMT) Received: from [9.200.103.244] (unknown [9.200.103.244]) by smtpav02.fra02v.mail.ibm.com (Postfix) with ESMTP; Wed, 8 May 2024 06:47:12 +0000 (GMT) Message-ID: <5c5c2878-6828-42aa-8cfb-2778aea8050b@linux.ibm.com> Date: Wed, 8 May 2024 14:47:13 +0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US To: gcc-patches Cc: Segher Boessenkool , David , "Kewen.Lin" , Peter Bergner From: HAO CHEN GUI Subject: [PATCH] rs6000: Enable overlapped by-pieces operations X-TM-AS-GCONF: 00 X-Proofpoint-GUID: 9Ce_XtnRO_x7SPdcPornzhyXcgx18Sdj X-Proofpoint-ORIG-GUID: UrZ02uTzpu5NF24_fX6CHHum6pSykrXw X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.650,FMLib:17.11.176.26 definitions=2024-05-08_04,2024-05-08_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 clxscore=1015 lowpriorityscore=0 priorityscore=1501 mlxscore=0 mlxlogscore=956 phishscore=0 malwarescore=0 spamscore=0 suspectscore=0 bulkscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2405010000 definitions=main-2405080052 X-Spam-Status: No, score=-12.7 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 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: , Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Hi, This patch enables overlapped by-piece operations. On rs6000, default move/set/clear ratio is 2. So the overlap is only enabled with compare by-pieces. Bootstrapped and tested on powerpc64-linux BE and LE with no regressions. Is it OK for the trunk? Thanks Gui Haochen ChangeLog rs6000: Enable overlapped by-pieces operations This patch enables overlapped by-piece operations by defining TARGET_OVERLAP_OP_BY_PIECES_P to true. On rs6000, default move/set/clear ratio is 2. So the overlap is only enabled with compare by-pieces. gcc/ * config/rs6000/rs6000.cc (TARGET_OVERLAP_OP_BY_PIECES_P): Define. gcc/testsuite/ * gcc.target/powerpc/block-cmp-9.c: New. patch.diff diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc index 6b9a40fcc66..2b5f5cf1d86 100644 --- a/gcc/config/rs6000/rs6000.cc +++ b/gcc/config/rs6000/rs6000.cc @@ -1774,6 +1774,9 @@ static const scoped_attribute_specs *const rs6000_attribute_table[] = #undef TARGET_CONST_ANCHOR #define TARGET_CONST_ANCHOR 0x8000 +#undef TARGET_OVERLAP_OP_BY_PIECES_P +#define TARGET_OVERLAP_OP_BY_PIECES_P hook_bool_void_true + /* Processor table. */ diff --git a/gcc/testsuite/gcc.target/powerpc/block-cmp-9.c b/gcc/testsuite/gcc.target/powerpc/block-cmp-9.c new file mode 100644 index 00000000000..b5f51affbb7 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/block-cmp-9.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -mdejagnu-cpu=power8" } */ +/* { dg-final { scan-assembler-not {\ml[hb]z\M} } } */ + +/* Test if by-piece overlap compare is enabled and following case is + implemented by two overlap word loads and compares. */ + +int foo (const char* s1, const char* s2) +{ + return __builtin_memcmp (s1, s2, 7) == 0; +}