public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Sandiford <richard.sandiford@arm.com>
To: Oluwatamilore Adebayo <oluwatamilore.adebayo@arm.com>
Cc: <gcc-patches@gcc.gnu.org>,  <richard.guenther@gmail.com>
Subject: Re: [PATCH 1/2] Mid engine setup [SU]ABDL
Date: Tue, 27 Jun 2023 08:46:41 +0100	[thread overview]
Message-ID: <mptsfad8hzy.fsf@arm.com> (raw)
In-Reply-To: <mptttuu9ce7.fsf@arm.com> (Richard Sandiford's message of "Mon, 26 Jun 2023 21:50:08 +0100")

Richard Sandiford <richard.sandiford@arm.com> writes:
>> -     VTYPE x, y, out;
>> +     VTYPE x, y;
>> +     WTYPE out;
>>       type diff;
>>     loop i in range:
>>       S1 diff = x[i] - y[i]
>>       S2 out[i] = ABS_EXPR <diff>;
>>  
>> -   where 'type' is a integer and 'VTYPE' is a vector of integers
>> -   the same size as 'type'
>> +   where 'VTYPE' and 'WTYPE' are vectors of integers.
>> +	 'WTYPE' may be wider than 'VTYPE'.
>> +	 'type' is as wide as 'WTYPE'.
>
> I don't think the existing comment is right about the types.  What we're
> matching is scalar code, so VTYPE and (now) WTYPE are integers rather
> than vectors of integers.

Gah, sorry, I realise now that the point was that VTYPE and WTYPE
are sequences rather than scalars.  But patterns are used for SLP
as well as loops, and the inputs and outputs might not be memory
objects.  So:

> I think it would be clearer to write:
>
>        S1 diff = (type) x[i] - (type) y[i]
>        S2 out[i] = ABS_EXPR <(WTYPE) diff>;
>
> since the promotions happen on the operands.
>
> It'd be good to keep the part about 'type' being an integer.
>
> Rather than:
>
> 	 'WTYPE' may be wider than 'VTYPE'.
> 	 'type' is as wide as 'WTYPE'.
>
> maybe:
>
> 	 'type' is no narrower than 'VTYPE' (but may be wider)
> 	 'WTYPE' is no narrower than 'type' (but may be wider)

...how about:

  TYPE1 x;
  TYPE2 y;
  TYPE3 x_cast = (TYPE3) x;              // widening or no-op
  TYPE3 y_cast = (TYPE3) y;              // widening or no-op
  TYPE3 diff = x_cast - y_cast;
  TYPE4 diff_cast = (TYPE4) diff;        // widening or no-op
  TYPE5 abs = ABS(U)_EXPR <diff_cast>;

(based on the comment above vect_recog_widen_op_pattern).

Thanks,
Richard

  reply	other threads:[~2023-06-27  7:46 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-26 15:34 Oluwatamilore Adebayo
2023-06-26 20:50 ` Richard Sandiford
2023-06-27  7:46   ` Richard Sandiford [this message]
2023-06-28 15:07     ` Oluwatamilore Adebayo
2023-06-28 15:09       ` Oluwatamilore Adebayo
2023-06-29 10:14         ` Richard Sandiford
2023-06-30  8:23           ` Oluwatamilore Adebayo
2023-06-30  8:26             ` Oluwatamilore Adebayo
2023-06-30 11:28               ` Richard Sandiford

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=mptsfad8hzy.fsf@arm.com \
    --to=richard.sandiford@arm.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=oluwatamilore.adebayo@arm.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).