public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Kewen.Lin" <linkw@linux.ibm.com>
To: GCC Patches <gcc-patches@gcc.gnu.org>
Cc: Segher Boessenkool <segher@kernel.crashing.org>,
	David Edelsohn <dje.gcc@gmail.com>,
	Peter Bergner <bergner@linux.ibm.com>
Subject: [PATCH] rs6000: Adjust mov optabs for opaque modes [PR103353]
Date: Thu, 3 Mar 2022 16:38:16 +0800	[thread overview]
Message-ID: <26dce79a-be26-95b0-c14d-51852811969a@linux.ibm.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 909 bytes --]

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.

[-- Attachment #2: pr103353.patch --]
[-- Type: text/plain, Size: 2617 bytes --]

---
 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"
-- 
2.25.1


             reply	other threads:[~2022-03-03  8:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-03  8:38 Kewen.Lin [this message]
2022-03-15 11:36 ` PING^1 " Kewen.Lin
2022-04-01 20:50 ` will schmidt
2022-04-01 21:52   ` Peter Bergner
2022-04-07  9:42     ` Kewen.Lin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=26dce79a-be26-95b0-c14d-51852811969a@linux.ibm.com \
    --to=linkw@linux.ibm.com \
    --cc=bergner@linux.ibm.com \
    --cc=dje.gcc@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=segher@kernel.crashing.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).