From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by sourceware.org (Postfix) with ESMTPS id 7A9593858D33 for ; Wed, 8 Mar 2023 23:01:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7A9593858D33 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 Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 328KRj3e027498; Wed, 8 Mar 2023 23:01:43 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=7/gNUUpj6j6fuRsf3jw9RAhZf9KDEVlhh1coMcykAoI=; b=f9CB6gxbIfKK1bXWOE4qIpjswz7DC7LLksj8PcqGazllM5adc4/MW1tBFcr+xsBvN+ls ctdiQ7anK4nLuJmyu14BWddA9enQ62QZDGZ0/UWb2ApkCcczeH7/KUEdfzL0kYjqFA0E 0sOl0AVutTSiFmzyuYtgiHHyU2x1f/6iE4rYGN3VmKQCPODG7Dm4mWXLZEdO7x1mT+IF gPRiY25UuUhdd3RwMXvzGBn+wkzVyOVprbPRaY7tdueXfgEtB9q3rY5m5HDMOkIQm38N f+vdKMXGb84KTq3U/d76FtKd20lMytpYR5DH3aMHEU3EnMIImct7PXclp0uMmHAK++2s ow== Received: from ppma04wdc.us.ibm.com (1a.90.2fa9.ip4.static.sl-reverse.com [169.47.144.26]) by mx0b-001b2d01.pphosted.com (PPS) with ESMTPS id 3p6pa7db9e-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 08 Mar 2023 23:01:43 +0000 Received: from pps.filterd (ppma04wdc.us.ibm.com [127.0.0.1]) by ppma04wdc.us.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 328KIH1P016629; Wed, 8 Mar 2023 23:01:42 GMT Received: from smtprelay05.wdc07v.mail.ibm.com ([9.208.129.117]) by ppma04wdc.us.ibm.com (PPS) with ESMTPS id 3p6fhk5xf6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 08 Mar 2023 23:01:42 +0000 Received: from smtpav02.wdc07v.mail.ibm.com (smtpav02.wdc07v.mail.ibm.com [10.39.53.229]) by smtprelay05.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 328N1dKC9634422 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 8 Mar 2023 23:01:39 GMT Received: from smtpav02.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7D19558061; Wed, 8 Mar 2023 23:01:39 +0000 (GMT) Received: from smtpav02.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 063BA58060; Wed, 8 Mar 2023 23:01:39 +0000 (GMT) Received: from [9.211.90.110] (unknown [9.211.90.110]) by smtpav02.wdc07v.mail.ibm.com (Postfix) with ESMTP; Wed, 8 Mar 2023 23:01:38 +0000 (GMT) Message-ID: <40ecb0c8-2821-a72b-549d-6de6876b5d45@linux.ibm.com> Date: Wed, 8 Mar 2023 17:01:38 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Content-Language: en-US To: GCC Patches Cc: Segher Boessenkool , Chip Kerchner From: Peter Bergner Subject: [PATCH] rs6000: Accept const pointer operands for MMA builtins [PR109073] Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: dufYjXAaSSxTQcX4S9TIkOK6c3UKTrTj X-Proofpoint-ORIG-GUID: dufYjXAaSSxTQcX4S9TIkOK6c3UKTrTj X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-08_15,2023-03-08_03,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 suspectscore=0 bulkscore=0 priorityscore=1501 phishscore=0 mlxlogscore=999 clxscore=1011 lowpriorityscore=0 mlxscore=0 spamscore=0 adultscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2303080189 X-Spam-Status: No, score=-10.9 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,GIT_PATCH_0,KAM_SHORT,RCVD_IN_MSPIKE_H2,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: PR109073 shows a problem where GCC 11 and GCC 10 do not accept a const __vector_pair pointer operand to some MMA builtins, which GCC 12 and later correctly accept. Fixed here by initializing the builtins to accept const pointers. This patch was tested in both GCC 11 and GCC 10 on powerpc64le-linux and showed no regressions. Ok for backports? Peter gcc/ PR target/109073 * config/rs6000/rs6000-call.c (mma_init_builtins): Accept const pointer operands for lxvp, stxvp and disassemble builtins. gcc/testsuite/ PR target/109073 * gcc.target/powerpc/mma-builtin-4.c): New const * test. Update expected instruction counts. * gcc.target/powerpc/mma-builtin-5.c: Likewise. * gcc.target/powerpc/mma-builtin-7.c: Likewise. diff --git a/gcc/config/rs6000/rs6000-call.c b/gcc/config/rs6000/rs6000-call.c index 1be4797e834..3b6d40f0aef 100644 --- a/gcc/config/rs6000/rs6000-call.c +++ b/gcc/config/rs6000/rs6000-call.c @@ -14343,22 +14343,30 @@ mma_init_builtins (void) { op[nopnds++] = build_pointer_type (void_type_node); if (d->code == MMA_BUILTIN_DISASSEMBLE_ACC) - op[nopnds++] = build_pointer_type (vector_quad_type_node); + op[nopnds++] = build_pointer_type (build_qualified_type + (vector_quad_type_node, + TYPE_QUAL_CONST)); else - op[nopnds++] = build_pointer_type (vector_pair_type_node); + op[nopnds++] = build_pointer_type (build_qualified_type + (vector_pair_type_node, + TYPE_QUAL_CONST)); } else if (d->code == VSX_BUILTIN_LXVP) { op[nopnds++] = vector_pair_type_node; op[nopnds++] = sizetype; - op[nopnds++] = build_pointer_type (vector_pair_type_node); + op[nopnds++] = build_pointer_type (build_qualified_type + (vector_pair_type_node, + TYPE_QUAL_CONST)); } else if (d->code == VSX_BUILTIN_STXVP) { op[nopnds++] = void_type_node; op[nopnds++] = vector_pair_type_node; op[nopnds++] = sizetype; - op[nopnds++] = build_pointer_type (vector_pair_type_node); + op[nopnds++] = build_pointer_type (build_qualified_type + (vector_pair_type_node, + TYPE_QUAL_CONST)); } else { diff --git a/gcc/testsuite/gcc.target/powerpc/mma-builtin-4.c b/gcc/testsuite/gcc.target/powerpc/mma-builtin-4.c index a9fb0107d12..0ba650fcee7 100644 --- a/gcc/testsuite/gcc.target/powerpc/mma-builtin-4.c +++ b/gcc/testsuite/gcc.target/powerpc/mma-builtin-4.c @@ -46,6 +46,15 @@ bar2 (vec_t *dst, __vector_pair *src) dst[4] = res[1]; } +void +bar3 (vec_t *dst, const __vector_pair *src) +{ + vec_t res[2]; + __builtin_vsx_disassemble_pair (res, src); + dst[0] = res[0]; + dst[4] = res[1]; +} + #if !__has_builtin (__builtin_vsx_assemble_pair) # error "__has_builtin (__builtin_vsx_assemble_pair) failed" #endif @@ -67,7 +76,7 @@ bar2 (vec_t *dst, __vector_pair *src) #endif /* { dg-final { scan-assembler-times {\mlxv\M} 6 } } */ -/* { dg-final { scan-assembler-times {\mlxvp\M} 2 } } */ -/* { dg-final { scan-assembler-times {\mstxv\M} 4 } } */ +/* { dg-final { scan-assembler-times {\mlxvp\M} 3 } } */ +/* { dg-final { scan-assembler-times {\mstxv\M} 6 } } */ /* { dg-final { scan-assembler-times {\mstxvp\M} 3 } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/mma-builtin-5.c b/gcc/testsuite/gcc.target/powerpc/mma-builtin-5.c index 00503b7343d..998c436a8bb 100644 --- a/gcc/testsuite/gcc.target/powerpc/mma-builtin-5.c +++ b/gcc/testsuite/gcc.target/powerpc/mma-builtin-5.c @@ -31,6 +31,17 @@ bar (vec_t *dst, __vector_quad *src) dst[12] = res[3]; } +void +bar2 (vec_t *dst, const __vector_quad *src) +{ + vec_t res[4]; + __builtin_mma_disassemble_acc (res, src); + dst[0] = res[0]; + dst[4] = res[1]; + dst[8] = res[2]; + dst[12] = res[3]; +} + #if !__has_builtin (__builtin_mma_assemble_acc) # error "__has_builtin (__builtin_mma_assemble_acc) failed" #endif @@ -40,8 +51,8 @@ bar (vec_t *dst, __vector_quad *src) #endif /* { dg-final { scan-assembler-times {\mlxv\M} 8 } } */ -/* { dg-final { scan-assembler-times {\mlxvp\M} 2 } } */ -/* { dg-final { scan-assembler-times {\mstxv\M} 4 } } */ +/* { dg-final { scan-assembler-times {\mlxvp\M} 4 } } */ +/* { dg-final { scan-assembler-times {\mstxv\M} 8 } } */ /* { dg-final { scan-assembler-times {\mstxvp\M} 4 } } */ -/* { dg-final { scan-assembler-times {\mxxmfacc\M} 3 } } */ -/* { dg-final { scan-assembler-times {\mxxmtacc\M} 3 } } */ +/* { dg-final { scan-assembler-times {\mxxmfacc\M} 4 } } */ +/* { dg-final { scan-assembler-times {\mxxmtacc\M} 4 } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/mma-builtin-7.c b/gcc/testsuite/gcc.target/powerpc/mma-builtin-7.c index c661a4b84bc..23becfde15e 100644 --- a/gcc/testsuite/gcc.target/powerpc/mma-builtin-7.c +++ b/gcc/testsuite/gcc.target/powerpc/mma-builtin-7.c @@ -14,13 +14,25 @@ foo (__vector_pair *dst, __vector_pair *src, long idx) dst[8] = __builtin_vsx_lxvp (257, src); } +void +bar (__vector_pair *dst, const __vector_pair *src, long idx) +{ + dst[0] = __builtin_vsx_lxvp (0, src); + dst[2] = __builtin_vsx_lxvp (32, src); + dst[4] = __builtin_vsx_lxvp (64, src); + /* Non-constant offset should generate a lxvpx. */ + dst[6] = __builtin_vsx_lxvp (idx, src); + /* Non-aligned offset should generate a plxvp. */ + dst[8] = __builtin_vsx_lxvp (257, src); +} + #if !__has_builtin (__builtin_vsx_lxvp) # error "__has_builtin (__builtin_vsx_lxvp) failed" #endif /* { dg-final { scan-assembler-not {\mlxv\M} } } */ /* { dg-final { scan-assembler-not {\mstxv\M} } } */ -/* { dg-final { scan-assembler-times {\mlxvp\M} 3 } } */ -/* { dg-final { scan-assembler-times {\mlxvpx\M} 1 } } */ -/* { dg-final { scan-assembler-times {\mplxvp\M} 1 } } */ -/* { dg-final { scan-assembler-times {\mstxvp\M} 5 } } */ +/* { dg-final { scan-assembler-times {\mlxvp\M} 6 } } */ +/* { dg-final { scan-assembler-times {\mlxvpx\M} 2 } } */ +/* { dg-final { scan-assembler-times {\mplxvp\M} 2 } } */ +/* { dg-final { scan-assembler-times {\mstxvp\M} 10 } } */