public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Andrew Pinski <pinskia@gmail.com>
To: Kyrylo Tkachov <Kyrylo.Tkachov@arm.com>
Cc: "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] aarch64: Add support for +cssc
Date: Fri, 11 Nov 2022 12:10:46 -0800	[thread overview]
Message-ID: <CA+=Sn1nVq5Z4EY9OeDq__eKkMbPsm0o1W_YYxmDDd0go_-4sUg@mail.gmail.com> (raw)
In-Reply-To: <PAXPR08MB69260AEE049F853F4C89043B93009@PAXPR08MB6926.eurprd08.prod.outlook.com>

On Fri, Nov 11, 2022 at 2:26 AM Kyrylo Tkachov via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
> Hi all,
>
> This patch adds codegen for FEAT_CSSC from the 2022 Architecture extensions.
> It fits various existing optabs in GCC quite well.
> There are instructions for scalar signed/unsigned min/max, abs, ctz, popcount.
> We have expanders for these already, so they are wired up to emit single-insn
> patterns for the new TARGET_CSSC.
>
> These instructions are enabled by the +cssc command-line extension.
> Bootstrapped and tested on aarch64-none-linux-gnu.
>
> I'll push it once the Binutils patch from Andre for this gets committed



@@ -4976,8 +5020,14 @@ (define_expand "ffs<mode>2"
 (define_expand "popcount<mode>2"
   [(match_operand:GPI 0 "register_operand")
    (match_operand:GPI 1 "register_operand")]
-  "TARGET_SIMD"
+  "TARGET_CSSC || TARGET_SIMD"
 {
+  if (TARGET_CSSC)
+    {
+      emit_insn (gen_aarch64_popcount<mode>2_insn (operands[0], operands[1]));
+      DONE;
+    }
+
   rtx v = gen_reg_rtx (V8QImode);
   rtx v1 = gen_reg_rtx (V8QImode);
   rtx in = operands[1];

I think the easy way is to this instead:
 (define_expand "popcount<mode>2"
   [(set (match_operand:GPI 0 "register_operand")
     (popcount:GPI  (match_operand:GPI 1 "register_operand")))]
  "TARGET_CSSC || TARGET_SIMD"
{
  if (!TARGET_CSSC)
    {
// Current code
     DONE;
    }
}

And then you don't need to name the aarch64_popcount pattern. Or use a *.
Yes it does mess up the diff but the end result seems cleaner.
I suspect all of the expands you are changing should be done this
similar way too.

Thanks,
Andrew Pinski

>
> Thanks,
> Kyrill
>
> gcc/ChangeLog:
>
>         * config/aarch64/aarch64-option-extensions.def (cssc): Define.
>         * config/aarch64/aarch64.h (AARCH64_ISA_CSSC): Define.
>         (TARGET_CSSC): Likewise.
>         * config/aarch64/aarch64.md (aarch64_abs<mode>2_insn): New define_insn.
>         (abs<mode>2): Adjust for the above.
>         (aarch64_umax<mode>3_insn): New define_insn.
>         (umax<mode>3): Adjust for the above.
>         (aarch64_popcount<mode>2_insn): New define_insn.
>         (popcount<mode>2): Adjust for the above.
>         (<optab><mode>3): New define_insn.
>         * config/aarch64/constraints.md (Usm): Define.
>         (Uum): Likewise.
>         * doc/gcc/gcc-command-options/machine-dependent-options/aarch64-options.rst:
>         Document +cssc.
>         * config/aarch64/iterators.md (MAXMIN_NOUMAX): New code iterator.
>         * config/aarch64/predicates.md (aarch64_sminmax_immediate): Define.
>         (aarch64_sminmax_operand): Likewise.
>         (aarch64_uminmax_immediate): Likewise.
>         (aarch64_uminmax_operand): Likewise.
>
> gcc/testsuite/ChangeLog:
>
>         * gcc.target/aarch64/cssc_1.c: New test.
>         * gcc.target/aarch64/cssc_2.c: New test.
>         * gcc.target/aarch64/cssc_3.c: New test.
>         * gcc.target/aarch64/cssc_4.c: New test.
>         * gcc.target/aarch64/cssc_5.c: New test.

      reply	other threads:[~2022-11-11 20:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-11 10:25 Kyrylo Tkachov
2022-11-11 20:10 ` Andrew Pinski [this message]

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='CA+=Sn1nVq5Z4EY9OeDq__eKkMbPsm0o1W_YYxmDDd0go_-4sUg@mail.gmail.com' \
    --to=pinskia@gmail.com \
    --cc=Kyrylo.Tkachov@arm.com \
    --cc=gcc-patches@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).