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 DDD56386F422 for ; Tue, 9 Apr 2024 14:30:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DDD56386F422 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 DDD56386F422 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=1712673007; cv=none; b=Uw/W2vUzDaRvJkrgAikLJcTKrG1bzBNsEuiW6r2FfK8tqqhJz1oPIN4e6Nxs1r60Gj5yV/gQOa9S9bfdjyPmSgbhhnUoW3+XDutXdmtptuHTQCq10CgBm4VAKszYMEc0EELyf0tueMrTPPgw9YgPCAxRfV10LFIuB2E6vIUggnI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712673007; c=relaxed/simple; bh=Qwuh2fwUr7/cklqrXeyzJH62JLqgwurg2nGL2BlNz6k=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=Caauy8Nh4FRKs/BY3akZ+0tqC4tjJMZ/BRKxKqqs/1UHAsL6eBZhixSfBTmFKw/+UvHBjcMw7QyMvCQSAzy7evOtikk6wqUibn0Vkl/6ry7tXtSkvnzsDbqfmoNFLtQyRXTUinneahZS6+AzBDrWjQrY6Nntu0BhZsyafoJFXEg= ARC-Authentication-Results: i=1; server2.sourceware.org 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 439E3F7G017686 for ; Tue, 9 Apr 2024 14:30:04 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : content-transfer-encoding : in-reply-to; s=pp1; bh=KgYfyUCaiWSrkM43yR8dSZl3flyffQMFaJSYBGZ8Ukc=; b=mdkxq/bKEodgc9NR83st3DAgO/pQtnytlo5C6V0tMKOlgXP9yksif+qVsbrd2Phe3Ib6 033E85X8lakJ8UDat9yRohq6faaoNGW91pMbqhJWloou3oKzHbbNlu4C7cR1AF7xIPhu kl4rZZFhsKwqQ0e9YxrpTN9KeRmMBhLGEo1tcy3LUncck1Cd56gT9DVQl0q8moKdSlvp B+rO8eNZ/UB2runlO2qc4CBz3rU590HXulBZJOY7KxyCaeNh2nKNkRZuCJASbNe7XAUK quFRuDqsG9o0Y5PD+VKpBQGplJVyV0drv6OeaemzoFRUPrnOXTm6HvC8604BwQ62yzma Cw== Received: from ppma21.wdc07v.mail.ibm.com (5b.69.3da9.ip4.static.sl-reverse.com [169.61.105.91]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3xd73b03ca-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 09 Apr 2024 14:30:04 +0000 Received: from pps.filterd (ppma21.wdc07v.mail.ibm.com [127.0.0.1]) by ppma21.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 439CKQLW022587 for ; Tue, 9 Apr 2024 14:30:03 GMT Received: from smtprelay01.fra02v.mail.ibm.com ([9.218.2.227]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3xbhqnxqew-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 09 Apr 2024 14:30:03 +0000 Received: from smtpav06.fra02v.mail.ibm.com (smtpav06.fra02v.mail.ibm.com [10.20.54.105]) by smtprelay01.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 439ETvjf47055158 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 9 Apr 2024 14:29:59 GMT Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4BB9A20065; Tue, 9 Apr 2024 14:29:57 +0000 (GMT) Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2AB442005A; Tue, 9 Apr 2024 14:29:57 +0000 (GMT) Received: from li-3a824ecc-34fe-11b2-a85c-eae455c7d911.ibm.com (unknown [9.152.222.38]) by smtpav06.fra02v.mail.ibm.com (Postfix) with ESMTPS; Tue, 9 Apr 2024 14:29:57 +0000 (GMT) Date: Tue, 9 Apr 2024 16:29:45 +0200 From: Juergen Christ To: Stefan Schulze Frielinghaus Cc: gcc-patches@gcc.gnu.org, krebbel@linux.ibm.com Subject: Re: [PATCH] s390x: Optimize vector permute with constant indexes Message-ID: References: <20240402075601.7733-1-jchrist@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: O3Hezvl2GFdVJAEkm_jERKudSUOIbB42 X-Proofpoint-GUID: O3Hezvl2GFdVJAEkm_jERKudSUOIbB42 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-04-09_10,2024-04-09_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 suspectscore=0 clxscore=1011 mlxscore=0 impostorscore=0 lowpriorityscore=0 mlxlogscore=999 adultscore=0 phishscore=0 spamscore=0 malwarescore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2404010000 definitions=main-2404090094 X-Spam-Status: No, score=-13.1 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 List-Id: Am Tue, Apr 09, 2024 at 11:51:00AM +0200 schrieb Stefan Schulze Frielinghaus: > > +static bool expand_perm_as_replicate (const struct expand_vec_perm_d &d) > ^~~~~~~~~~~~~~~~~~~~~~~~ > Function names start on a new line. Fixed > > +{ > > + unsigned char i; > > + unsigned char elem; > > + rtx base = d.op0; > > + rtx insn; > > + /* Needed to silence maybe-uninitialized warning. */ > > + gcc_assert(d.nelt > 0); > ~~~~~~~~~~^~~~~~~~~~~~ > Between function name and open bracket whitespace is missing. Fixed. > Curiously enough, the error is about d which is a reference and cannot > be null. If you are eager you could reduce this and open a PR. > > s390.cc:17935:8: warning: ā€˜dā€™ may be used uninitialized [-Wmaybe-uninitialized] > 17935 | elem = d.perm[0]; > | ~~~~~^~~~~~~~~~~ Weirdly enough it is not `d`, but `d.perm[0]` that seems to be the problem. But I did not reduce this. As the assertion suggests, it is known that all elements in d.perm in the range [0,d.nelts) are initialized. I would like to defer that to a time when I (hopefully) have some more spare time. > > + if (expand_perm_as_replicate(d)) > ~~~~~~~~~~~~~~~~~~~~~~~~^~~ > Between function name and open bracket whitespace is missing. Fixed > > diff --git a/gcc/testsuite/gcc.target/s390/vector/vec-expand-replicate.c b/gcc/testsuite/gcc.target/s390/vector/vec-expand-replicate.c > > new file mode 100644 > > index 000000000000..27563a00f22b > > --- /dev/null > > +++ b/gcc/testsuite/gcc.target/s390/vector/vec-expand-replicate.c > > @@ -0,0 +1,30 @@ > > +/* Check that the vectorize_vec_perm_const expander correctly deals with > > + replication. Extracted from spec "nab". */ > > + > > +/* { dg-do compile } */ > > +/* { dg-options "-O3 -mzarch -march=z13 -fvect-cost-model=unlimited" } */ > > + > > + > > +#define REAL_T double > > +typedef REAL_T MATRIX_T[ 4 ][ 4 ]; > > + > > +int concat_mat_i, concat_mat_j; > > +static void concat_mat(MATRIX_T m1, MATRIX_T, MATRIX_T m3); > > +MATRIX_T *rot4p() { > > + MATRIX_T mat3, mat4; > > + static MATRIX_T mat5; > > + concat_mat(mat4, mat3, mat5); > > +} > > +void concat_mat(MATRIX_T m1, MATRIX_T, MATRIX_T m3) { > > + int k; > > + for (;; concat_mat_i++) { > > + concat_mat_j = 0; > > + for (; 4; concat_mat_j++) { > > + k = 0; > > + for (; k < 4; k++) > > + m3[concat_mat_i][concat_mat_j] += m1[concat_mat_i][k]; > > + } > > Just nitpicking, if we could come up with a test case which does not > involve integer overflows due to non-terminating loops, I would prefer > that. Well, I have a version without integer overflows, but it still has non-terminating loops... Will send a v2, Juergen