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] rtl: AArch64: New RTL for ABD
Date: Tue, 06 Jun 2023 18:03:37 +0100	[thread overview]
Message-ID: <mptjzwgplp2.fsf@arm.com> (raw)
In-Reply-To: <20230606151153.53653-1-oluwatamilore.adebayo@arm.com> (Oluwatamilore Adebayo's message of "Tue, 6 Jun 2023 16:11:53 +0100")

Oluwatamilore Adebayo <oluwatamilore.adebayo@arm.com> writes:
>> It would be good to mark all of these functions with __attribute__((noipa)),
>> since I think interprocedural optimisations might otherwise defeat the
>> runtime test in abd_run_1.c (in the sense that we might end up folding
>> things at compile time and not testing the vector versions of the functions).
>
> Done.
>
>> There are 14 tests, and it looks like 6 of them are expected to produce
>> ABD instructions while 8 aren't.  It isn't really clear which tests are
>> which though.
>> 
>> I think it'd help to split the file into two:
>> 
>> - one containing only the tests that should produce ABD, so that the
>>   scan-assembler counts sum up to the number of tests
>> 
>> - one containing only the tests that cannot use ABD, with:
>> 
>>     { dg-final { scan-assembler-not {\tsabd\t} } }
>>     { dg-final { scan-assembler-not {\tuabd\t} } }
>> 
>>   to enforce that
>
> After adjustments made to the vectoriser part, all tests now use an abd
> instruction.

Ah, that's a problem.  Sorry, I didn't review 1/2 closely enough.

For:

> +  /* Failed to find a widen operation so we check for a regular MINUS_EXPR.  */
> +  if (diff
> +      && gimple_assign_rhs_code (diff) == MINUS_EXPR
> +      && (TYPE_UNSIGNED (abs_type) || TYPE_OVERFLOW_UNDEFINED (abs_type)))
> +    {
> +      *half_type = NULL_TREE;
> +      return true;
> +    }

the condition should instead be:

  if (diff
      && gimple_assign_rhs_code (diff) == MINUS_EXPR
      && TYPE_OVERFLOW_UNDEFINED (TREE_TYPE (abs_oprnd)))
    {
      *half_type = NULL_TREE;
      return true;
    }

That is, we rely on overflow being undefined, so we need to check
TYPE_OVERFLOW_UNDEFINED on the type of the subtraction (rather than
abs_type, which is the type of ABS input, and at this point can be
different from TREE_TYPE (abs_oprnd)).

Then fn_unsigned_int and fn_unsigned_char_int_short correctly
avoid using SABD.  The output for the other tests looks right.

It would be good to add a:

/* { dg-final { scan-assembler-not {\tabs\t} } } */

to be the positive tests, to make it more obvious that all separate
ABS instructions are elided.

Thanks,
Richard

  parent reply	other threads:[~2023-06-06 17:03 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-09 16:14 Oluwatamilore Adebayo
2023-05-16 12:30 ` Richard Sandiford
2023-06-06 15:11   ` Oluwatamilore Adebayo
2023-06-06 15:17     ` [PATCH 2/2] " Oluwatamilore Adebayo
2023-06-06 17:03     ` Richard Sandiford [this message]
2023-06-08 10:37       ` [PATCH] rtl: " Oluwatamilore Adebayo
2023-06-08 10:38         ` [PATCH 2/2] " Oluwatamilore Adebayo
2023-06-13  8:27           ` Oluwatamilore Adebayo

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=mptjzwgplp2.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).