From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2063) id 4A33F385AC3C; Wed, 24 Aug 2022 02:35:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4A33F385AC3C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1661308540; bh=iSJcl/9fIrLfEFHUJQXIq8/Jd6bsJV1Z2iwRI8HC0UY=; h=From:To:Subject:Date:From; b=pSf79C2pZLSzLIBUNidQBfNk2Ncsz13NLIrkh5eAs2vB4hyuzCmIkf83T1EyTSBT4 UnFIMDNe+hMNNGUYx7Oi7NzY/N2UPFa3teUlM/xQ7N/WbVhlhvpmiohzFrI01MdVaB IeRmU5ysPKSag28G9m8P/khUoP6MjzPnQiy3Fb9M= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Kewen Lin To: gcc-cvs@gcc.gnu.org Subject: [gcc r10-10959] rs6000: Adjust mov optabs for opaque modes [PR103353] X-Act-Checkin: gcc X-Git-Author: Kewen Lin X-Git-Refname: refs/heads/releases/gcc-10 X-Git-Oldrev: 9b72dfbcc08bc5ecb7fecb6750a07cdb90658cce X-Git-Newrev: 501fba663052b0b4a1eb6a42c32b74c254cbedbc Message-Id: <20220824023540.4A33F385AC3C@sourceware.org> Date: Wed, 24 Aug 2022 02:35:40 +0000 (GMT) List-Id: https://gcc.gnu.org/g:501fba663052b0b4a1eb6a42c32b74c254cbedbc commit r10-10959-g501fba663052b0b4a1eb6a42c32b74c254cbedbc Author: Kewen Lin Date: Tue Aug 23 03:31:17 2022 -0500 rs6000: Adjust mov optabs for opaque modes [PR103353] As PR103353 shows, we may want to continue to expand built-in function __builtin_vsx_lxvp, 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 during expanding phase if compiler has already seen errors. PR target/103353 gcc/ChangeLog: * config/rs6000/mma.md (define_expand movpoi): Move TARGET_MMA condition check to preparation statements and add handlings for !TARGET_MMA. (define_expand movpxi): Likewise. gcc/testsuite/ChangeLog: * gcc.target/powerpc/pr103353.c: New test. (cherry picked from commit 9367e3a65f874dffc8f8a3b6760e77fd9ed67117) Diff: --- gcc/config/rs6000/mma.md | 39 ++++++++++++++++++++++++----- gcc/testsuite/gcc.target/powerpc/pr103353.c | 22 ++++++++++++++++ 2 files changed, 55 insertions(+), 6 deletions(-) diff --git a/gcc/config/rs6000/mma.md b/gcc/config/rs6000/mma.md index 27f64d2cb7c..c6e07e5dd78 100644 --- a/gcc/config/rs6000/mma.md +++ b/gcc/config/rs6000/mma.md @@ -283,10 +283,25 @@ (define_expand "movpoi" [(set (match_operand:POI 0 "nonimmediate_operand") (match_operand:POI 1 "input_operand"))] - "TARGET_MMA" + "" { - rs6000_emit_move (operands[0], operands[1], POImode); - DONE; + if (TARGET_MMA) + { + rs6000_emit_move (operands[0], operands[1], POImode); + DONE; + } + else if (currently_expanding_to_rtl && seen_error ()) + { + /* PR103353 shows we may want to continue to expand the __builtin_vsx_lxvp + 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 POImode 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. It would not cause further ICEs + as the compilation would stop soon after expanding. */ + } + else + gcc_unreachable (); }) (define_insn_and_split "*movpoi" @@ -323,10 +338,22 @@ (define_expand "movpxi" [(set (match_operand:PXI 0 "nonimmediate_operand") (match_operand:PXI 1 "input_operand"))] - "TARGET_MMA" + "" { - rs6000_emit_move (operands[0], operands[1], PXImode); - DONE; + if (TARGET_MMA) + { + rs6000_emit_move (operands[0], operands[1], PXImode); + DONE; + } + else if (currently_expanding_to_rtl && seen_error ()) + { + /* PR103353 shows we may want to continue to expand the __builtin_vsx_lxvp + built-in function, even if we have already emitted error messages about + some missing required conditions. So do the same handlings for PXImode + as POImode here. */ + } + else + gcc_unreachable (); }) (define_insn_and_split "*movpxi" diff --git a/gcc/testsuite/gcc.target/powerpc/pr103353.c b/gcc/testsuite/gcc.target/powerpc/pr103353.c new file mode 100644 index 00000000000..5d519fb1b7b --- /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. */ +/* { dg-excess-errors "pr103353" } */ + +void +foo (__vector_pair *dst, double *x) +{ + dst[0] = __builtin_vsx_lxvp (0, (__vector_pair *)(void *)x); +} + +void +bar (__vector_pair *src, double *x) +{ + __builtin_vsx_stxvp (src[0], 0, (__vector_pair *)(void *)x); +}