public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Jonathan Wright <jonwri01@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r12-4909] gcc/expmed.c: Ensure vector modes are tieable before extraction
Date: Thu,  4 Nov 2021 14:56:24 +0000 (GMT)	[thread overview]
Message-ID: <20211104145624.1B6C4385803B@sourceware.org> (raw)

https://gcc.gnu.org/g:4e5929e4575922015ff4634af4dea59c59a44f10

commit r12-4909-g4e5929e4575922015ff4634af4dea59c59a44f10
Author: Jonathan Wright <jonathan.wright@arm.com>
Date:   Mon Oct 11 23:02:16 2021 +0100

    gcc/expmed.c: Ensure vector modes are tieable before extraction
    
    Extracting a bitfield from a vector can be achieved by casting the
    vector to a new type whose elements are the same size as the desired
    bitfield, before generating a subreg. However, this is only an
    optimization if the original vector can be accessed in the new
    machine mode without first being copied - a condition denoted by the
    TARGET_MODES_TIEABLE_P hook.
    
    This patch adds a check to make sure that the vector modes are
    tieable before attempting to generate a subreg. This is a necessary
    prerequisite for a subsequent patch that will introduce new machine
    modes for Arm Neon vector-tuple types.
    
    gcc/ChangeLog:
    
    2021-10-11  Jonathan Wright  <jonathan.wright@arm.com>
    
            * expmed.c (extract_bit_field_1): Ensure modes are tieable.

Diff:
---
 gcc/expmed.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gcc/expmed.c b/gcc/expmed.c
index bbdd0e71d20..4abce11b647 100644
--- a/gcc/expmed.c
+++ b/gcc/expmed.c
@@ -1735,7 +1735,8 @@ extract_bit_field_1 (rtx str_rtx, poly_uint64 bitsize, poly_uint64 bitnum,
       FOR_EACH_MODE_FROM (new_mode, new_mode)
 	if (known_eq (GET_MODE_SIZE (new_mode), GET_MODE_SIZE (GET_MODE (op0)))
 	    && known_eq (GET_MODE_UNIT_SIZE (new_mode), GET_MODE_SIZE (tmode))
-	    && targetm.vector_mode_supported_p (new_mode))
+	    && targetm.vector_mode_supported_p (new_mode)
+	    && targetm.modes_tieable_p (GET_MODE (op0), new_mode))
 	  break;
       if (new_mode != VOIDmode)
 	op0 = gen_lowpart (new_mode, op0);


                 reply	other threads:[~2021-11-04 14:56 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=20211104145624.1B6C4385803B@sourceware.org \
    --to=jonwri01@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).