From patchwork Thu Aug 31 11:37:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajit Agarwal X-Patchwork-Id: 1828251 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=BEBXj9+m; 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 4Rbzgp1cvJz1yfm for ; Thu, 31 Aug 2023 21:38:30 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2D9063858438 for ; Thu, 31 Aug 2023 11:38:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2D9063858438 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1693481908; bh=dZO4VPuCqGemApj/Xd57kdv0zWet7uBnfb+XyxArdaQ=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=BEBXj9+mHVpnKmCh7ZNEPZhrkIe9E5bGJ972WaiJt3cDZtXW2RGPRtgefXWaDYmxz 0hiCvcT7+UdTFS+IjO2EsXlvzumIpcKi3Pl20D/PbyMwkEWA0B/fbnAwUD02nlECK3 iR8YIs7d06gRRBQBOFKSCT9nOnw7QEtl+5RJalGE= 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 13421385841D for ; Thu, 31 Aug 2023 11:37:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 13421385841D Received: from pps.filterd (m0353728.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 37VBW2T2017237; Thu, 31 Aug 2023 11:37:28 GMT Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3stt2q0bqa-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 31 Aug 2023 11:37:27 +0000 Received: from m0353728.ppops.net (m0353728.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 37VBWCXG017594; Thu, 31 Aug 2023 11:37:25 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 3stt2q0bk5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 31 Aug 2023 11:37:25 +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 37VAdjMW020520; Thu, 31 Aug 2023 11:37:18 GMT Received: from smtprelay06.wdc07v.mail.ibm.com ([172.16.1.73]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3sqv3yv8xg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 31 Aug 2023 11:37:18 +0000 Received: from smtpav03.dal12v.mail.ibm.com (smtpav03.dal12v.mail.ibm.com [10.241.53.102]) by smtprelay06.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 37VBbHtQ000756 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 31 Aug 2023 11:37:17 GMT Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6C44C58063; Thu, 31 Aug 2023 11:37:17 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 232FF5805A; Thu, 31 Aug 2023 11:37:15 +0000 (GMT) Received: from [9.43.85.141] (unknown [9.43.85.141]) by smtpav03.dal12v.mail.ibm.com (Postfix) with ESMTP; Thu, 31 Aug 2023 11:37:14 +0000 (GMT) Message-ID: <821f2e31-e3a4-5b2c-17db-8317d3da448e@linux.ibm.com> Date: Thu, 31 Aug 2023 17:07:13 +0530 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.14.0 Content-Language: en-US To: gcc-patches Subject: [PATCH] rs6000: unnecessary clear after vctzlsbb in vec_first_match_or_eos_index X-TM-AS-GCONF: 00 X-Proofpoint-GUID: O55GXNkj1dUCz6-rdgPBHSi2BOw7vfed X-Proofpoint-ORIG-GUID: E0p1PT0rvFHZO6sX_k6gy0F2iV8AgG30 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-08-31_09,2023-08-31_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 impostorscore=0 clxscore=1015 phishscore=0 mlxscore=0 adultscore=0 priorityscore=1501 malwarescore=0 mlxlogscore=999 bulkscore=0 lowpriorityscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2308100000 definitions=main-2308310103 X-Spam-Status: No, score=-12.6 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: Ajit Agarwal via Gcc-patches From: Ajit Agarwal Reply-To: Ajit Agarwal Cc: Peter Bergner , Segher Boessenkool Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" This patch removes zero extension from vctzlsbb as it already zero extends. Bootstrapped and regtested on powerpc64-linux-gnu. Thanks & Regards Ajit rs6000: unnecessary clear after vctzlsbb in vec_first_match_or_eos_index For rs6000 target we dont need zero_extend after vctzlsbb as vctzlsbb already zero extend. 2023-08-31 Ajit Kumar Agarwal gcc/ChangeLog: * config/rs6000/vsx.md: Add new pattern. gcc/testsuite/ChangeLog: * g++.target/powerpc/altivec-19.C: New testcase. --- gcc/config/rs6000/vsx.md | 17 ++++++++++++++--- gcc/testsuite/g++.target/powerpc/altivec-19.C | 11 +++++++++++ 2 files changed, 25 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/g++.target/powerpc/altivec-19.C diff --git a/gcc/config/rs6000/vsx.md b/gcc/config/rs6000/vsx.md index 19abfeb565a..09d21a6d00a 100644 --- a/gcc/config/rs6000/vsx.md +++ b/gcc/config/rs6000/vsx.md @@ -5846,11 +5846,22 @@ [(set_attr "type" "vecsimple")]) ;; Vector Count Trailing Zero Least-Significant Bits Byte -(define_insn "vctzlsbb_" - [(set (match_operand:SI 0 "register_operand" "=r") +(define_insn "vctzlsbbzext_" + [(set (match_operand:DI 0 "register_operand" "=r") + (zero_extend:DI (unspec:SI [(match_operand:VSX_EXTRACT_I 1 "altivec_register_operand" "v")] - UNSPEC_VCTZLSBB))] + UNSPEC_VCTZLSBB)))] + "TARGET_P9_VECTOR" + "vctzlsbb %0,%1" + [(set_attr "type" "vecsimple")]) + +;; Vector Count Trailing Zero Least-Significant Bits Byte +(define_insn "vctzlsbb_" + [(set (match_operand:SI 0 "register_operand" "=r") + (unspec:SI + [(match_operand:VSX_EXTRACT_I 1 "altivec_register_operand" "v")] + UNSPEC_VCTZLSBB))] "TARGET_P9_VECTOR" "vctzlsbb %0,%1" [(set_attr "type" "vecsimple")]) diff --git a/gcc/testsuite/g++.target/powerpc/altivec-19.C b/gcc/testsuite/g++.target/powerpc/altivec-19.C new file mode 100644 index 00000000000..2d630b2fc1f --- /dev/null +++ b/gcc/testsuite/g++.target/powerpc/altivec-19.C @@ -0,0 +1,11 @@ +/* { dg-do compile { target { powerpc*-*-* } } } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target powerpc_p9vector_ok } */ +/* { dg-options "-mcpu=power9 -O2 " } */ + +#include + +unsigned int foo (vector unsigned char a, vector unsigned char b) { + return vec_first_match_or_eos_index (a, b); +} +/* { dg-final { scan-assembler-not "rldicl" } } */