public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Sandiford <richard.sandiford@arm.com>
To: Richard Biener <richard.guenther@gmail.com>
Cc: liuhongt <hongtao.liu@intel.com>,  GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [RFC: PATCH] Extend vectorizer to handle nonlinear induction for neg, mul/lshift/rshift with a constant.
Date: Thu, 04 Aug 2022 11:09:27 +0100	[thread overview]
Message-ID: <mpto7x0miaw.fsf@arm.com> (raw)
In-Reply-To: <CAFiYyc3b3UPqA453TUZt-__bScoPfK29MOVO7Bnj4_J3_fYpFw@mail.gmail.com> (Richard Biener's message of "Thu, 4 Aug 2022 10:18:26 +0200")

Richard Biener <richard.guenther@gmail.com> writes:
>> +/* Create vector init for vectorized iv.  */
>> +static tree
>> +vect_create_nonlinear_iv_init (gimple_seq* stmts, tree init_expr,
>> +                              tree step_expr, poly_uint64 nunits,
>> +                              tree vectype,
>> +                              enum vect_induction_op_type induction_type)
>> +{
>> +  unsigned HOST_WIDE_INT const_nunits;
>> +  tree vec_shift, vec_init, new_name;
>> +  unsigned i;
>> +
>> +  /* iv_loop is the loop to be vectorized. Create:
>> +     vec_init = [X, X+S, X+2*S, X+3*S] (S = step_expr, X = init_expr).  */
>> +  new_name = init_expr;
>> +  switch (induction_type)
>> +    {
>> +    case vect_step_op_shr:
>> +    case vect_step_op_shl:
>> +      /* Build the Initial value from shift_expr.  */
>> +      vec_init = gimple_build_vector_from_val (stmts,
>> +                                              vectype,
>> +                                              new_name);
>> +      vec_shift = gimple_build (stmts, VEC_SERIES_EXPR, vectype,
>> +                               build_zero_cst (TREE_TYPE (step_expr)),
>> +                               step_expr);
>
> There might be a more canonical way to build the series expr - Richard?

build_vec_series is shorter if step_expr is known to be a constant.
The above looks good for the general case.

Thanks,
Richard

  reply	other threads:[~2022-08-04 10:09 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-04  4:28 liuhongt
2022-08-04  8:18 ` Richard Biener
2022-08-04 10:09   ` Richard Sandiford [this message]
2022-08-05  5:21   ` Hongtao Liu
2022-08-29  5:24   ` [PATCH V2] " liuhongt
2022-08-29  5:24     ` liuhongt
2022-09-05 10:58     ` Richard Biener

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=mpto7x0miaw.fsf@arm.com \
    --to=richard.sandiford@arm.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=hongtao.liu@intel.com \
    --cc=richard.guenther@gmail.com \
    /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).