From patchwork Tue Nov 9 21:46:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Li, Pan2 via Gcc-patches" X-Patchwork-Id: 47339 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 343AC3858430 for ; Tue, 9 Nov 2021 21:47:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 343AC3858430 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1636494449; bh=60fxa4n/NJNxucN1rN9polJTcmECb/siWJmZ6qch3OY=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=EWEhQXuhI1tIDCoxsDb3AsyA0zXG4+QWWzFVoiF8FcdNRmvLcsZ8C/SpQgEld/bSb iQqIIpSJGxgEV+mi0kIvn6UvgYbPW75DzJkA+xNMDMykD59EQxEbxSd5Bp+YuZQal8 U6kAYSxhN6udLXngcaQSbYCySX21JpNKQB1uc218= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by sourceware.org (Postfix) with ESMTPS id 95B9B3858405 for ; Tue, 9 Nov 2021 21:46:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 95B9B3858405 Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 1A9Lgj6e012987; Tue, 9 Nov 2021 21:46:59 GMT Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 3c815302eh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 09 Nov 2021 21:46:58 +0000 Received: from m0098416.ppops.net (m0098416.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 1A9LghGS012934; Tue, 9 Nov 2021 21:46:58 GMT Received: from ppma02dal.us.ibm.com (a.bd.3ea9.ip4.static.sl-reverse.com [169.62.189.10]) by mx0b-001b2d01.pphosted.com with ESMTP id 3c815302ea-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 09 Nov 2021 21:46:58 +0000 Received: from pps.filterd (ppma02dal.us.ibm.com [127.0.0.1]) by ppma02dal.us.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 1A9LhECc024299; Tue, 9 Nov 2021 21:46:57 GMT Received: from b01cxnp23033.gho.pok.ibm.com (b01cxnp23033.gho.pok.ibm.com [9.57.198.28]) by ppma02dal.us.ibm.com with ESMTP id 3c5hbbn1v2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 09 Nov 2021 21:46:57 +0000 Received: from b01ledav005.gho.pok.ibm.com (b01ledav005.gho.pok.ibm.com [9.57.199.110]) by b01cxnp23033.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 1A9LkuNf38535586 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 9 Nov 2021 21:46:56 GMT Received: from b01ledav005.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A2039AE064; Tue, 9 Nov 2021 21:46:56 +0000 (GMT) Received: from b01ledav005.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E1B29AE05F; Tue, 9 Nov 2021 21:46:55 +0000 (GMT) Received: from [9.211.99.43] (unknown [9.211.99.43]) by b01ledav005.gho.pok.ibm.com (Postfix) with ESMTP; Tue, 9 Nov 2021 21:46:55 +0000 (GMT) Message-ID: <4792cfc9-59bb-15b9-4f45-67f1e2f9c037@linux.ibm.com> Date: Tue, 9 Nov 2021 15:46:54 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.3.0 To: GCC Patches Subject: [PATCH] rs6000: Fix a handful of 32-bit built-in function problems in the new support X-TM-AS-GCONF: 00 X-Proofpoint-GUID: fR-HVJTnDIlrYJzGdh9sWrixrxlvXKLD X-Proofpoint-ORIG-GUID: c4ckFQ7L_Oxkrl9q0cqiw2Y8B4_Wd1Gd X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.0.607.475 definitions=2021-11-09_06,2021-11-08_02,2020-04-07_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 impostorscore=0 adultscore=0 mlxlogscore=999 lowpriorityscore=0 malwarescore=0 mlxscore=0 bulkscore=0 clxscore=1015 suspectscore=0 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2110150000 definitions=main-2111090117 X-Spam-Status: No, score=-11.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.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Bill Schmidt via Gcc-patches From: "Li, Pan2 via Gcc-patches" Reply-To: wschmidt@linux.ibm.com Cc: David Edelsohn , Segher Boessenkool Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" Hi! Some time ago I realized I hadn't tested the new builtin support against 32-bit big-endian in quite a while. When I did, I found a handful of errors that needed correcting. - One builtin needs to be disabled for 32-bit. - One builtin needs to be restricted to 32-bit only. - One builtin used unsigned long when it needed unsigned long long. - Six builtins used unsigned long long when they needed unsigned long. - One test case needed its expected error message adjusted. Otherwise things were fine. Bootstrapped and tested on powerpc64le-linux-gnu and powerpc64-linux-gnu with no regressions. Is this okay for trunk? Thanks! Bill 2021-09-02 Bill Schmidt gcc/ * config/rs6000/rs6000-builtin-new.def (CMPB): Flag as no32bit. (BPERMD): Flag as 32bit. (UNPACK_TD): Return unsigned long long instead of unsigned long. (SET_TEXASR): Pass unsigned long instead of unsigned long long. (SET_TEXASRU): Likewise. (SET_TFHAR): Likewise. (SET_TFIAR): Likewise. (TABORTDC): Likewise. (TABORTDCI): Likewise. * config/rs6000/rs6000-call.c (rs6000_expand_new_builtin): Fix error handling for no32bit. Add 32bit handling for RS6000_BIF_BPERMD. gcc/testsuite/ * gcc.target/powerpc/cmpb-3.c: Adjust error message. --- gcc/config/rs6000/rs6000-builtin-new.def | 22 +++++++++++----------- gcc/config/rs6000/rs6000-call.c | 9 ++++++--- gcc/testsuite/gcc.target/powerpc/cmpb-3.c | 2 +- 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/gcc/config/rs6000/rs6000-builtin-new.def b/gcc/config/rs6000/rs6000-builtin-new.def index 1dd8f6b40b2..b9f7768c2f4 100644 --- a/gcc/config/rs6000/rs6000-builtin-new.def +++ b/gcc/config/rs6000/rs6000-builtin-new.def @@ -267,7 +267,7 @@ ; Power6 builtins (ISA 2.05). [power6] const signed long __builtin_p6_cmpb (signed long, signed long); - CMPB cmpbdi3 {} + CMPB cmpbdi3 {no32bit} const signed int __builtin_p6_cmpb_32 (signed int, signed int); CMPB_32 cmpbsi3 {} @@ -2015,7 +2015,7 @@ ADDG6S addg6s {} const signed long __builtin_bpermd (signed long, signed long); - BPERMD bpermd_di {} + BPERMD bpermd_di {32bit} const unsigned int __builtin_cbcdtd (unsigned int); CBCDTD cbcdtd {} @@ -2968,7 +2968,7 @@ void __builtin_set_fpscr_drn (const int[0,7]); SET_FPSCR_DRN rs6000_set_fpscr_drn {} - const unsigned long __builtin_unpack_dec128 (_Decimal128, const int<1>); + const unsigned long long __builtin_unpack_dec128 (_Decimal128, const int<1>); UNPACK_TD unpacktd {} @@ -3023,27 +3023,27 @@ unsigned long long __builtin_get_tfiar (); GET_TFIAR nothing {htm,htmspr} - void __builtin_set_texasr (unsigned long long); + void __builtin_set_texasr (unsigned long); SET_TEXASR nothing {htm,htmspr} - void __builtin_set_texasru (unsigned long long); + void __builtin_set_texasru (unsigned long); SET_TEXASRU nothing {htm,htmspr} - void __builtin_set_tfhar (unsigned long long); + void __builtin_set_tfhar (unsigned long); SET_TFHAR nothing {htm,htmspr} - void __builtin_set_tfiar (unsigned long long); + void __builtin_set_tfiar (unsigned long); SET_TFIAR nothing {htm,htmspr} unsigned int __builtin_tabort (unsigned int); TABORT tabort {htm,htmcr} - unsigned int __builtin_tabortdc (unsigned long long, unsigned long long, \ - unsigned long long); + unsigned int __builtin_tabortdc (unsigned long, unsigned long, \ + unsigned long); TABORTDC tabortdc {htm,htmcr} - unsigned int __builtin_tabortdci (unsigned long long, unsigned long long, \ - unsigned long long); + unsigned int __builtin_tabortdci (unsigned long, unsigned long, \ + unsigned long); TABORTDCI tabortdci {htm,htmcr} unsigned int __builtin_tabortwc (unsigned int, unsigned int, unsigned int); diff --git a/gcc/config/rs6000/rs6000-call.c b/gcc/config/rs6000/rs6000-call.c index 83e1abb6118..800a3bb8a33 100644 --- a/gcc/config/rs6000/rs6000-call.c +++ b/gcc/config/rs6000/rs6000-call.c @@ -15732,9 +15732,10 @@ rs6000_expand_new_builtin (tree exp, rtx target, } if (bif_is_no32bit (*bifaddr) && TARGET_32BIT) - fatal_error (input_location, - "%<%s%> is not supported in 32-bit mode", - bifaddr->bifname); + { + error ("%<%s%> is not supported in 32-bit mode", bifaddr->bifname); + return const0_rtx; + } if (bif_is_cpu (*bifaddr)) return new_cpu_expand_builtin (fcode, exp, target); @@ -15758,6 +15759,8 @@ rs6000_expand_new_builtin (tree exp, rtx target, { if (fcode == RS6000_BIF_MFTB) icode = CODE_FOR_rs6000_mftb_si; + else if (fcode == RS6000_BIF_BPERMD) + icode = CODE_FOR_bpermd_si; else gcc_unreachable (); } diff --git a/gcc/testsuite/gcc.target/powerpc/cmpb-3.c b/gcc/testsuite/gcc.target/powerpc/cmpb-3.c index de111a80144..9c465de383f 100644 --- a/gcc/testsuite/gcc.target/powerpc/cmpb-3.c +++ b/gcc/testsuite/gcc.target/powerpc/cmpb-3.c @@ -8,7 +8,7 @@ void abort (); long long int do_compare (long long int a, long long int b) { - return __builtin_cmpb (a, b); /* { dg-error "'__builtin_cmpb' is not supported in this compiler configuration" } */ + return __builtin_cmpb (a, b); /* { dg-error "'__builtin_p6_cmpb' is not supported in 32-bit mode" } */ } void expect (long long int pattern, long long int value)