From patchwork Thu Mar 3 08:38:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kewen.Lin" X-Patchwork-Id: 51524 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 DDA78385800C for ; Thu, 3 Mar 2022 08:38:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DDA78385800C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1646296734; bh=8lKFriRNNBA9PnOglN+TR3CY2P4Roj3fTgQh5NVumMo=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=nKzE05+27m+O4XIiaBFbHEq62AupfFdEGBzwCpY8QzFqRIiX8Up745I1ghADJ4ckF 689RDS8sxwuNiekNIZBtfBPOA7Z3CCbvOQqVZ4STdAk4WR+RvmCF5rKaA6p2TQkm8i ABoEb3p/HY4laVxGXjcOyRYb1CTY1mIweloEEo2M= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by sourceware.org (Postfix) with ESMTPS id C643C3858D39 for ; Thu, 3 Mar 2022 08:38:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C643C3858D39 Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 2235rLDO029076; Thu, 3 Mar 2022 08:38:24 GMT Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3ejqx3jv23-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 03 Mar 2022 08:38:24 +0000 Received: from m0098417.ppops.net (m0098417.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 2238cB9A015955; Thu, 3 Mar 2022 08:38:23 GMT Received: from ppma04ams.nl.ibm.com (63.31.33a9.ip4.static.sl-reverse.com [169.51.49.99]) by mx0a-001b2d01.pphosted.com with ESMTP id 3ejqx3jv1n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 03 Mar 2022 08:38:23 +0000 Received: from pps.filterd (ppma04ams.nl.ibm.com [127.0.0.1]) by ppma04ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 2238Nd9i022695; Thu, 3 Mar 2022 08:38:21 GMT Received: from b06avi18878370.portsmouth.uk.ibm.com (b06avi18878370.portsmouth.uk.ibm.com [9.149.26.194]) by ppma04ams.nl.ibm.com with ESMTP id 3egbj1cag0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 03 Mar 2022 08:38:21 +0000 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06avi18878370.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 2238cJLM45613504 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 3 Mar 2022 08:38:19 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9EFFE5204F; Thu, 3 Mar 2022 08:38:19 +0000 (GMT) Received: from [9.197.239.43] (unknown [9.197.239.43]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id 2124D5204E; Thu, 3 Mar 2022 08:38:17 +0000 (GMT) Message-ID: <26dce79a-be26-95b0-c14d-51852811969a@linux.ibm.com> Date: Thu, 3 Mar 2022 16:38:16 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.6.1 Content-Language: en-US To: GCC Patches Subject: [PATCH] rs6000: Adjust mov optabs for opaque modes [PR103353] X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: V-sOgvas3gLyl_Uy1pC55OZmZxINbSp3 X-Proofpoint-GUID: Z0jhrSeQolW3Im4kUiCrLxQDb0N4BeyM X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.816,Hydra:6.0.425,FMLib:17.11.64.514 definitions=2022-03-03_05,2022-02-26_01,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 adultscore=0 bulkscore=0 impostorscore=0 mlxlogscore=999 priorityscore=1501 malwarescore=0 clxscore=1015 mlxscore=0 spamscore=0 phishscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2201110000 definitions=main-2203030040 X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE 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: "Kewen.Lin via Gcc-patches" From: "Kewen.Lin" Reply-To: "Kewen.Lin" Cc: Peter Bergner , David Edelsohn , Segher Boessenkool Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" Hi, As PR103353 shows, we may want to continue to expand a MMA built-in function like a normal function, even if we have already emitted error messages about some missing required conditions. As shown in that PR, without one explicit mov optab on OOmode provided, it would call emit_move_insn recursively. So this patch is to allow the mov pattern to be generated when we are expanding to RTL and have seen errors even without MMA supported, it's expected that the generated pattern would not cause further ICEs as the compilation would stop soon after expanding. Bootstrapped and regtested on powerpc64-linux-gnu P8 and powerpc64le-linux-gnu P9 and P10. Is it ok for trunk? BR, Kewen ------ PR target/103353 gcc/ChangeLog: * config/rs6000/mma.md (define_expand movoo): Move TARGET_MMA condition check to preparation statements and add handlings for !TARGET_MMA. (define_expand movxo): Likewise. --- gcc/config/rs6000/mma.md | 42 ++++++++++++++++++++++++++++++++++------ 1 file changed, 36 insertions(+), 6 deletions(-) diff --git a/gcc/config/rs6000/mma.md b/gcc/config/rs6000/mma.md index 907c9d6d516..f76a87b4a21 100644 --- a/gcc/config/rs6000/mma.md +++ b/gcc/config/rs6000/mma.md @@ -268,10 +268,25 @@ (define_int_attr avvi4i4i4 [(UNSPEC_MMA_PMXVI8GER4PP "pmxvi8ger4pp") (define_expand "movoo" [(set (match_operand:OO 0 "nonimmediate_operand") (match_operand:OO 1 "input_operand"))] - "TARGET_MMA" + "" { - rs6000_emit_move (operands[0], operands[1], OOmode); - DONE; + if (TARGET_MMA) { + rs6000_emit_move (operands[0], operands[1], OOmode); + DONE; + } + /* Opaque modes are only expected to be available when MMA is supported, + but PR103353 shows we may want to continue to expand a MMA built-in + function like a normal function, even if we have already emitted + error messages about some missing required conditions. + As shown in that PR, without one explicit mov optab on OOmode provided, + it would call emit_move_insn recursively. So we allow this pattern to + be generated when we are expanding to RTL and have seen errors, even + though there is no MMA support. It would not cause further ICEs as + the compilation would stop soon after expanding. */ + else if (currently_expanding_to_rtl && seen_error ()) + ; + else + gcc_unreachable (); }) (define_insn_and_split "*movoo" @@ -300,10 +315,25 @@ (define_insn_and_split "*movoo" (define_expand "movxo" [(set (match_operand:XO 0 "nonimmediate_operand") (match_operand:XO 1 "input_operand"))] - "TARGET_MMA" + "" { - rs6000_emit_move (operands[0], operands[1], XOmode); - DONE; + if (TARGET_MMA) { + rs6000_emit_move (operands[0], operands[1], XOmode); + DONE; + } + /* Opaque modes are only expected to be available when MMA is supported, + but PR103353 shows we may want to continue to expand a MMA built-in + function like a normal function, even if we have already emitted + error messages about some missing required conditions. + As shown in that PR, without one explicit mov optab on OOmode provided, + it would call emit_move_insn recursively. So we allow this pattern to + be generated when we are expanding to RTL and have seen errors, even + though there is no MMA support. It would not cause further ICEs as + the compilation would stop soon after expanding. */ + else if (currently_expanding_to_rtl && seen_error ()) + ; + else + gcc_unreachable (); }) (define_insn_and_split "*movxo"