public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Sandiford <richard.sandiford@arm.com>
To: Jakub Jelinek <jakub@redhat.com>
Cc: Richard Biener <rguenther@suse.de>,
	 Jason Merrill <jason@redhat.com>,
	 "Joseph S. Myers" <joseph@codesourcery.com>,
	 Jan Hubicka <jh@suse.cz>,
	 gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] Add __builtin_convertvector support (PR c++/85052)
Date: Thu, 03 Jan 2019 13:06:00 -0000	[thread overview]
Message-ID: <875zv5sxfi.fsf@arm.com> (raw)
In-Reply-To: <20190103100640.GM30353@tucnak> (Jakub Jelinek's message of "Thu,	3 Jan 2019 11:06:40 +0100")

Jakub Jelinek <jakub@redhat.com> writes:
> +      /* Can't use get_compute_type here, as supportable_convert_operation
> +	 doesn't necessarily use an optab and needs two arguments.  */
> +      tree vector_compute_type
> +	= type_for_widest_vector_mode (TREE_TYPE (arg_type), mov_optab);
> +      unsigned HOST_WIDE_INT nelts;
> +      if (vector_compute_type
> +	  && VECTOR_MODE_P (TYPE_MODE (vector_compute_type))
> +	  && subparts_gt (arg_type, vector_compute_type)
> +	  && TYPE_VECTOR_SUBPARTS (vector_compute_type).is_constant (&nelts))
> +	{
> +	  while (nelts > 1)
> +	    {
> +	      tree ret1_type = build_vector_type (TREE_TYPE (ret_type), nelts);
> +	      tree arg1_type = build_vector_type (TREE_TYPE (arg_type), nelts);
> +	      if (supportable_convert_operation (code, ret1_type, arg1_type,
> +						 &decl, &code1))
> +		{
> +		  new_rhs = expand_vector_piecewise (gsi, do_vec_conversion,
> +						     ret_type, arg1_type, arg,
> +						     decl, code1);
> +		  g = gimple_build_assign (lhs, new_rhs);
> +		  gsi_replace (gsi, g, false);
> +		  return;
> +		}
> +	      nelts = nelts / 2;
> +	    }
> +	}

I think for this it would be better to use:

      if (vector_compute_type
	  && VECTOR_MODE_P (TYPE_MODE (vector_compute_type))
	  && subparts_gt (arg_type, vector_compute_type))
	{
	  unsigned HOST_WIDE_INT nelts = constant_lower_bound
	    (TYPE_VECTOR_SUBPARTS (vector_compute_type));

since the loop is self-checking.

E.g. this will make the Advanced SIMD handling on AArch64 the same
regardless of whether SVE is also enabled.

Thanks,
Richard

  parent reply	other threads:[~2019-01-03 13:06 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-03 10:06 Jakub Jelinek
2019-01-03 10:48 ` Marc Glisse
2019-01-03 11:04   ` Jakub Jelinek
2019-01-03 17:32     ` Marc Glisse
2019-01-03 22:24       ` [PATCH] Add __builtin_convertvector support (PR c++/85052, take 2) Jakub Jelinek
2019-01-07  8:27         ` Richard Biener
2019-01-03 11:16 ` [PATCH] Add __builtin_convertvector support (PR c++/85052) Richard Biener
2019-01-03 12:11   ` Jakub Jelinek
2019-01-03 13:06 ` Richard Sandiford [this message]
2019-01-03 17:04 ` Martin Sebor

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=875zv5sxfi.fsf@arm.com \
    --to=richard.sandiford@arm.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=jason@redhat.com \
    --cc=jh@suse.cz \
    --cc=joseph@codesourcery.com \
    --cc=rguenther@suse.de \
    /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).