public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r10-10615] x86: Fix ix86_expand_vector_init for V*TImode [PR100887]
Date: Tue, 10 May 2022 08:18:17 +0000 (GMT)	[thread overview]
Message-ID: <20220510081817.E576A3836029@sourceware.org> (raw)

https://gcc.gnu.org/g:2f5857a3ad1160a467c4c351820a450a7cff2d50

commit r10-10615-g2f5857a3ad1160a467c4c351820a450a7cff2d50
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Fri Jun 4 11:20:02 2021 +0200

    x86: Fix ix86_expand_vector_init for V*TImode [PR100887]
    
    We have vec_initv4tiv2ti and vec_initv2titi patterns which call
    ix86_expand_vector_init and assume it works for those modes.  For the
    case of construction from two half-sized vectors, the code assumes it
    will always succeed, but we have only insn patterns with SImode and DImode
    element types.  QImode and HImode element types are already handled
    by performing it with same sized vectors with SImode elements and the
    following patch extends that to V*TImode vectors.
    
    2021-06-04  Jakub Jelinek  <jakub@redhat.com>
    
            PR target/100887
            * config/i386/i386-expand.c (ix86_expand_vector_init): Handle
            concatenation from half-sized modes with TImode elements.
    
    (cherry picked from commit b7dd2e4eeb44bc8678ecde8a6c7401de85e63561)

Diff:
---
 gcc/config/i386/i386-expand.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/gcc/config/i386/i386-expand.c b/gcc/config/i386/i386-expand.c
index d690d5b9bc1..ea9bdbce9b4 100644
--- a/gcc/config/i386/i386-expand.c
+++ b/gcc/config/i386/i386-expand.c
@@ -14117,11 +14117,15 @@ ix86_expand_vector_init (bool mmx_ok, rtx target, rtx vals)
       if (GET_MODE_NUNITS (GET_MODE (x)) * 2 == n_elts)
 	{
 	  rtx ops[2] = { XVECEXP (vals, 0, 0), XVECEXP (vals, 0, 1) };
-	  if (inner_mode == QImode || inner_mode == HImode)
+	  if (inner_mode == QImode
+	      || inner_mode == HImode
+	      || inner_mode == TImode)
 	    {
 	      unsigned int n_bits = n_elts * GET_MODE_SIZE (inner_mode);
-	      mode = mode_for_vector (SImode, n_bits / 4).require ();
-	      inner_mode = mode_for_vector (SImode, n_bits / 8).require ();
+	      scalar_mode elt_mode = inner_mode == TImode ? DImode : SImode;
+	      n_bits /= GET_MODE_SIZE (elt_mode);
+	      mode = mode_for_vector (elt_mode, n_bits).require ();
+	      inner_mode = mode_for_vector (elt_mode, n_bits / 2).require ();
 	      ops[0] = gen_lowpart (inner_mode, ops[0]);
 	      ops[1] = gen_lowpart (inner_mode, ops[1]);
 	      subtarget = gen_reg_rtx (mode);


                 reply	other threads:[~2022-05-10  8:18 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20220510081817.E576A3836029@sourceware.org \
    --to=jakub@gcc.gnu.org \
    --cc=gcc-cvs@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).