public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Uros Bizjak <ubizjak@gmail.com>
To: Jan Beulich <jbeulich@suse.com>
Cc: "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>,
	"hubicka@ucw.cz" <hubicka@ucw.cz>,
	 Kirill Yukhin <kirill.yukhin@gmail.com>,
	Hongtao Liu <hongtao.liu@intel.com>
Subject: Re: [PATCH] x86: {,v}psadbw have commutative source operands
Date: Fri, 27 May 2022 11:05:03 +0200	[thread overview]
Message-ID: <CAFULd4YWtg_ddupO6rpefS8jtOSDa-_8zdK9fuVs3fA2gUb+Kw@mail.gmail.com> (raw)
In-Reply-To: <20d007c8-f703-8fac-6a13-1643af31adc6@suse.com>

On Fri, May 27, 2022 at 10:13 AM Jan Beulich <jbeulich@suse.com> wrote:
>
> Like noticed for gas as well (binutils-gdb commit c8cad9d389b7), the
> "absolute difference" aspect of the insns makes their source operands
> commutative.

You will need to expand via ix86_fixup_binary_operands_no_copy, use
register_mmxmem_operand on both input operands and use
ix86_binary_operator insn constraint. Please see many examples w/
commutative operands throughout .md files.

Uros.

> gcc/
> 2022-05-XX  Jan Beulich  <jbeulich@suse.com>
>
>         * config/i386/mmx.md (mmx_psadbw): Mark as commutative.
>         * config/i386/sse.md (<sse2_avx2>_psadbw): Likewise.
>
> --- a/gcc/config/i386/mmx.md
> +++ b/gcc/config/i386/mmx.md
> @@ -4407,7 +4407,7 @@
>
>  (define_insn "mmx_psadbw"
>    [(set (match_operand:V1DI 0 "register_operand" "=y,x,Yw")
> -        (unspec:V1DI [(match_operand:V8QI 1 "register_operand" "0,0,Yw")
> +        (unspec:V1DI [(match_operand:V8QI 1 "register_operand" "%0,0,Yw")
>                       (match_operand:V8QI 2 "register_mmxmem_operand" "ym,x,Yw")]
>                      UNSPEC_PSADBW))]
>    "(TARGET_MMX || TARGET_MMX_WITH_SSE)
> --- a/gcc/config/i386/sse.md
> +++ b/gcc/config/i386/sse.md
> @@ -19983,7 +19983,7 @@
>  (define_insn "<sse2_avx2>_psadbw"
>    [(set (match_operand:VI8_AVX2_AVX512BW 0 "register_operand" "=x,YW")
>         (unspec:VI8_AVX2_AVX512BW
> -         [(match_operand:<ssebytemode> 1 "register_operand" "0,YW")
> +         [(match_operand:<ssebytemode> 1 "register_operand" "%0,YW")
>            (match_operand:<ssebytemode> 2 "vector_operand" "xBm,YWm")]
>           UNSPEC_PSADBW))]
>    "TARGET_SSE2"
>

  reply	other threads:[~2022-05-27  9:05 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-27  8:13 Jan Beulich
2022-05-27  9:05 ` Uros Bizjak [this message]
2022-05-30  7:59   ` Jan Beulich
2022-05-30  8:28     ` Uros Bizjak

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=CAFULd4YWtg_ddupO6rpefS8jtOSDa-_8zdK9fuVs3fA2gUb+Kw@mail.gmail.com \
    --to=ubizjak@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=hongtao.liu@intel.com \
    --cc=hubicka@ucw.cz \
    --cc=jbeulich@suse.com \
    --cc=kirill.yukhin@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).