public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/112623] [14 Regression] ICE: in emit_move_insn, at expr.cc:4249 with -O -mavx512vl -mavx512fp16 on vector conversion since r14-1707
Date: Tue, 21 Nov 2023 12:13:29 +0000	[thread overview]
Message-ID: <bug-112623-4-bf4wNDETWo@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-112623-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112623

--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
But the problem is of course that you then can't have both at the same time,
vec_pack_trunk_v4sf from V8HF and V8BF unless we'd support "VOIDmode" there.

Note there's the "better" {s,z}ext optabs which have two modes and could
support V8HF to V8SF conversions, but it doesn't work to model the
pack/unpack style of ISA with this.

The ambiguities would support using a conversion optab for the various
pack/unpack optabs but we have very many of those ... and the problem
extends to even/odd and lo/hi widen ops as well.  I don't think
mass-changing those at this point is desirable (that definitely looks like
a stage1 problem).

As long as we don't have both we can circumvent the ICE with patches like
proposed.  Fixed patch, "complete":

diff --git a/gcc/tree-ssa-forwprop.cc b/gcc/tree-ssa-forwprop.cc
index d39dfc1065f..0fb21e58138 100644
--- a/gcc/tree-ssa-forwprop.cc
+++ b/gcc/tree-ssa-forwprop.cc
@@ -47,6 +47,8 @@ along with GCC; see the file COPYING3.  If not see
 #include "tree-cfgcleanup.h"
 #include "cfganal.h"
 #include "optabs-tree.h"
+#include "insn-config.h"
+#include "recog.h"
 #include "tree-vector-builder.h"
 #include "vec-perm-indices.h"
 #include "internal-fn.h"
@@ -2978,6 +2980,7 @@ simplify_vector_constructor (gimple_stmt_iterator *gsi)
          /* Only few targets implement direct conversion patterns so try
             some simple special cases via VEC_[UN]PACK[_FLOAT]_LO_EXPR.  */
          optab optab;
+         insn_code icode;
          tree halfvectype, dblvectype;
          enum tree_code unpack_op;

@@ -3015,8 +3018,9 @@ simplify_vector_constructor (gimple_stmt_iterator *gsi)
              && (optab = optab_for_tree_code (unpack_op,
                                               dblvectype,
                                               optab_default))
-             && (optab_handler (optab, TYPE_MODE (dblvectype))
-                 != CODE_FOR_nothing))
+             && ((icode = optab_handler (optab, TYPE_MODE (dblvectype)))
+                 != CODE_FOR_nothing)
+             && (insn_data[icode].operand[0].mode == TYPE_MODE (type)))
            {
              gimple_seq stmts = NULL;
              tree dbl;
@@ -3054,8 +3058,9 @@ simplify_vector_constructor (gimple_stmt_iterator *gsi)
                   && (optab = optab_for_tree_code (VEC_PACK_TRUNC_EXPR,
                                                    halfvectype,
                                                    optab_default))
-                  && (optab_handler (optab, TYPE_MODE (halfvectype))
-                      != CODE_FOR_nothing))
+                  && ((icode = optab_handler (optab, TYPE_MODE (halfvectype)))
+                      != CODE_FOR_nothing)
+                  && (insn_data[icode].operand[0].mode == TYPE_MODE (type)))
            {
              gimple_seq stmts = NULL;
              tree low = gimple_build (&stmts, BIT_FIELD_REF, halfvectype,

  parent reply	other threads:[~2023-11-21 12:13 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-19 16:43 [Bug target/112623] New: [14 Regression] ICE: in emit_move_insn, at expr.cc:4249 with -O -mavx512vl -mavx512fp16 on vector conversion zsojka at seznam dot cz
2023-11-20 10:35 ` [Bug target/112623] " rguenth at gcc dot gnu.org
2023-11-21 10:29 ` [Bug target/112623] [14 Regression] ICE: in emit_move_insn, at expr.cc:4249 with -O -mavx512vl -mavx512fp16 on vector conversion since r14-1707 jakub at gcc dot gnu.org
2023-11-21 11:09 ` jakub at gcc dot gnu.org
2023-11-21 11:56 ` rguenth at gcc dot gnu.org
2023-11-21 12:02 ` rguenth at gcc dot gnu.org
2023-11-21 12:13 ` rguenth at gcc dot gnu.org [this message]
2023-11-21 13:41 ` jakub at gcc dot gnu.org
2023-11-21 13:49 ` rguenth at gcc dot gnu.org
2023-11-21 14:47 ` cvs-commit at gcc dot gnu.org
2023-11-21 14:48 ` rguenth at gcc dot gnu.org

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=bug-112623-4-bf4wNDETWo@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.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).