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>,
	Jan Hubicka <hubicka@ucw.cz>
Subject: Re: [PATCH] x86: correct bmi2_umul<mode><dwi>3_1's MEM_P() uses
Date: Fri, 27 May 2022 10:57:54 +0200	[thread overview]
Message-ID: <CAFULd4bu7czQ6Ybcf74UjE7Z_9MhQDokKZBv-9pJ5JbxsOherA@mail.gmail.com> (raw)
In-Reply-To: <88d618dc-0c78-81ed-5b1c-6157b9ba7a30@suse.com>

On Fri, May 27, 2022 at 10:05 AM Jan Beulich <jbeulich@suse.com> wrote:
>
> It's pretty clear that the operand numbers in the MEM_P() checks are
> off by one, perhaps due to a copy-and-paste oversight (unlike in most
> other places here we're dealing with two outputs).
> ---
> What I don't understand is why operand 2 is "nonimmediate_operand", not
> "register_operand" (which afaict would eliminate the need for these
> MEM_P() checks). This would then also extend to e.g. the subsequent
> umul<mode><dwi>3_1 and mul<mode><dwi>3_1 (and apparently quite a few
> more).

Because they are commutative (due to % operand modifier) and reload
can put memory operand into each operand.

Patch is OK with the appropriate ChangeLog entry.

Thanks,
Uros.
>
> --- a/gcc/config/i386/i386.md
> +++ b/gcc/config/i386/i386.md
> @@ -8465,7 +8465,7 @@
>                         (zero_extend:<DWI> (match_dup 3)))
>             (match_operand:QI 4 "const_int_operand" "n"))))]
>    "TARGET_BMI2 && INTVAL (operands[4]) == <MODE_SIZE> * BITS_PER_UNIT
> -   && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
> +   && !(MEM_P (operands[2]) && MEM_P (operands[3]))"
>    "mulx\t{%3, %0, %1|%1, %0, %3}"
>    [(set_attr "type" "imulx")
>     (set_attr "prefix" "vex")
>

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

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-27  8:05 Jan Beulich
2022-05-27  8:57 ` Uros Bizjak [this message]
2022-05-27 10:12   ` Jan Beulich

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=CAFULd4bu7czQ6Ybcf74UjE7Z_9MhQDokKZBv-9pJ5JbxsOherA@mail.gmail.com \
    --to=ubizjak@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=hubicka@ucw.cz \
    --cc=jbeulich@suse.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).