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 tree-optimization/113622] [11/12/13/14 Regression] ICE with vectors in named registers
Date: Mon, 29 Jan 2024 08:45:31 +0000	[thread overview]
Message-ID: <bug-113622-4-NAn39VREhZ@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-113622-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #10 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Jakub Jelinek from comment #8)
> Guess for an rvalue (if even that crashes) we want to expand it to some
> permutation or whole vector shift which moves the indexed elements first and
> then extract it, for lvalue we need to insert it similarly.

If we can we should match this up with .VEC_SET / .VEC_EXTRACT, otherwise
we should go "simple" and spill.

diff --git a/gcc/gimple-isel.cc b/gcc/gimple-isel.cc
index 7e2392ecd38..e94f292dd38 100644
--- a/gcc/gimple-isel.cc
+++ b/gcc/gimple-isel.cc
@@ -104,7 +104,8 @@ gimple_expand_vec_set_extract_expr (struct function *fun,
       machine_mode outermode = TYPE_MODE (TREE_TYPE (view_op0));
       machine_mode extract_mode = TYPE_MODE (TREE_TYPE (ref));

-      if (auto_var_in_fn_p (view_op0, fun->decl)
+      if ((auto_var_in_fn_p (view_op0, fun->decl)
+          || DECL_HARD_REGISTER (view_op0))
          && !TREE_ADDRESSABLE (view_op0)
          && ((!is_extract && can_vec_set_var_idx_p (outermode))
              || (is_extract

ensures the former and fixes the ICE on x86_64 on trunk.  The comment#5
testcase then results in the following loop:

.L3:
        movslq  %eax, %rdx
        vmovaps %zmm2, -56(%rsp)
        vmovaps %zmm0, -120(%rsp)
        vmovss  -120(%rsp,%rdx,4), %xmm4
        vmovss  -56(%rsp,%rdx,4), %xmm3
        vcmpltss        %xmm4, %xmm3, %xmm3
        vpbroadcastd    %eax, %zmm4
        addl    $1, %eax
        vpcmpd  $0, %zmm7, %zmm4, %k1
        vblendvps       %xmm3, %xmm5, %xmm6, %xmm3
        vbroadcastss    %xmm3, %zmm1{%k1}
        cmpl    $8, %eax
        jne     .L3

this isn't optimal of course, for optimality we need vectorization.  But
we still need to avoid the ICEs since vectorization can be disabled.  That
said, I'm quite sure in code using hard registers people are not doing
such stupid things so I wonder how important it is to avoid "regressing"
the vectorization here.

  parent reply	other threads:[~2024-01-29  8:45 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-26 20:16 [Bug tree-optimization/113622] New: r14-8450 regression: " xry111 at gcc dot gnu.org
2024-01-26 20:23 ` [Bug tree-optimization/113622] " xry111 at gcc dot gnu.org
2024-01-26 20:31 ` [Bug tree-optimization/113622] " pinskia at gcc dot gnu.org
2024-01-26 20:36 ` xry111 at gcc dot gnu.org
2024-01-26 20:39 ` [Bug tree-optimization/113622] [11/12/13/14 Regression] " jakub at gcc dot gnu.org
2024-01-26 20:43 ` pinskia at gcc dot gnu.org
2024-01-26 20:59 ` pinskia at gcc dot gnu.org
2024-01-27  3:49 ` pinskia at gcc dot gnu.org
2024-01-27 12:11 ` jakub at gcc dot gnu.org
2024-01-29  7:56 ` rguenth at gcc dot gnu.org
2024-01-29  8:45 ` rguenth at gcc dot gnu.org [this message]
2024-01-29  8:56 ` jakub at gcc dot gnu.org
2024-01-29  8:58 ` xry111 at gcc dot gnu.org
2024-01-29  9:07 ` jakub at gcc dot gnu.org
2024-01-29  9:09 ` xry111 at gcc dot gnu.org
2024-01-29  9:27 ` rguenth at gcc dot gnu.org
2024-01-29  9:38 ` rguenth at gcc dot gnu.org
2024-01-29 13:31 ` cvs-commit at gcc dot gnu.org
2024-01-29 13:31 ` cvs-commit at gcc dot gnu.org
2024-01-29 13:32 ` [Bug tree-optimization/113622] [11/12/13 " rguenth at gcc dot gnu.org
2024-01-30  8:34 ` cvs-commit at gcc dot gnu.org
2024-01-30 13:22 ` xry111 at gcc dot gnu.org
2024-01-30 13:27 ` xry111 at gcc dot gnu.org
2024-01-30 14:49 ` rguenther at suse dot de
2024-02-25 13:08 ` xry111 at gcc dot gnu.org
2024-03-21 13:54 ` cvs-commit at gcc dot gnu.org
2024-03-21 13:57 ` rguenth at gcc dot gnu.org
2024-05-06 11:49 ` 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-113622-4-NAn39VREhZ@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).