From patchwork Thu Apr 7 09:29:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kewen.Lin" X-Patchwork-Id: 52697 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 242CB3857C41 for ; Thu, 7 Apr 2022 09:30:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 242CB3857C41 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1649323837; bh=ktdpERLqOczsBGAimOO6XsAQjz+05ZNKe3v51PEwb6E=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=t1PoXrykp+zfNMTMsKVdYkSShKBjy2QqeDBwoiLcJRe7401vLnl4/Ro2rCE0IrsVs MJdPDi+F+5Ts/YBOj5TULtuQtUuxPQxy3AAjAQ+d4MG+mjEifSQO1Rsv7jvAYJkg6D YDXrP+QI4xv7LrSJIJRh/KaqIPYJ9DkpUoxLKv3M= 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 5F1DC3858405 for ; Thu, 7 Apr 2022 09:29:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 5F1DC3858405 Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 2379JdrV029801; Thu, 7 Apr 2022 09:29:52 GMT Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3f97nbhypk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 07 Apr 2022 09:29:51 +0000 Received: from m0098410.ppops.net (m0098410.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 2379ALX6026618; Thu, 7 Apr 2022 09:29:51 GMT Received: from ppma06ams.nl.ibm.com (66.31.33a9.ip4.static.sl-reverse.com [169.51.49.102]) by mx0a-001b2d01.pphosted.com with ESMTP id 3f97nbhyp3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 07 Apr 2022 09:29:51 +0000 Received: from pps.filterd (ppma06ams.nl.ibm.com [127.0.0.1]) by ppma06ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 2379RHXG022821; Thu, 7 Apr 2022 09:29:49 GMT Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by ppma06ams.nl.ibm.com with ESMTP id 3f6drhsgdg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 07 Apr 2022 09:29:48 +0000 Received: from d06av24.portsmouth.uk.ibm.com (d06av24.portsmouth.uk.ibm.com [9.149.105.60]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 2379TkUR38994406 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 7 Apr 2022 09:29:46 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9833542047; Thu, 7 Apr 2022 09:29:46 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9420F42041; Thu, 7 Apr 2022 09:29:44 +0000 (GMT) Received: from [9.200.47.76] (unknown [9.200.47.76]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 7 Apr 2022 09:29:44 +0000 (GMT) Message-ID: <4073d7a8-6365-db64-c407-061f21423b2a@linux.ibm.com> Date: Thu, 7 Apr 2022 17:29:42 +0800 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 v2] rs6000: Adjust mov optabs for opaque modes [PR103353] X-TM-AS-GCONF: 00 X-Proofpoint-GUID: 44cPtSrQjHjGxF6Pmo7qEF_Yxro3Z2Sk X-Proofpoint-ORIG-GUID: 7ZvN6jDamTrG-JOs26r7fReyp5DM8PwV X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.850,Hydra:6.0.425,FMLib:17.11.64.514 definitions=2022-04-06_13,2022-04-06_01,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 clxscore=1015 malwarescore=0 priorityscore=1501 phishscore=0 bulkscore=0 spamscore=0 mlxlogscore=999 adultscore=0 lowpriorityscore=0 impostorscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2204070047 X-Spam-Status: No, score=-11.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, 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. v1: https://gcc.gnu.org/pipermail/gcc-patches/2022-March/591150.html v2: Polish some comments and add one test case as Will and Peter suggested. Is it ok for trunk or upcoming stage1? 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/testsuite/ChangeLog: * gcc.target/powerpc/pr103353.c: New test. --- gcc/config/rs6000/mma.md | 42 ++++++++++++++++++--- gcc/testsuite/gcc.target/powerpc/pr103353.c | 22 +++++++++++ 2 files changed, 58 insertions(+), 6 deletions(-) create mode 100644 gcc/testsuite/gcc.target/powerpc/pr103353.c -- 2.27.0 diff --git a/gcc/config/rs6000/mma.md b/gcc/config/rs6000/mma.md index 907c9d6d516..746a77a0957 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, 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, even if we have already emitted error messages about some + missing required conditions. As shown in that PR, without one + explicit mov optab on XOmode 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" diff --git a/gcc/testsuite/gcc.target/powerpc/pr103353.c b/gcc/testsuite/gcc.target/powerpc/pr103353.c new file mode 100644 index 00000000000..6b0bedbb958 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/pr103353.c @@ -0,0 +1,22 @@ +/* { dg-require-effective-target powerpc_altivec_ok } */ +/* If the default cpu type is power10 or later, MMA is enabled by default. + To keep the test point available all the time, this case specifies + -mdejagnu-cpu=power6 to make it be tested without MMA. */ +/* { dg-options "-maltivec -mdejagnu-cpu=power6" } */ + +/* Verify there is no ICE and don't check the error messages on MMA + requirement since they could be fragile and are not test points + of this case. */ + +void +foo (__vector_pair *dst, double *x) +{ + dst[0] = __builtin_vsx_lxvp (0, (__vector_pair *)(void *)x); + /* { dg-error ".*" "pr103353" { target *-*-* } .-1 } */ +} + +void +bar (__vector_pair *src, double *x) +{ + __builtin_vsx_stxvp (src[0], 0, (__vector_pair *)(void *)x); +}