public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Uros Bizjak <ubizjak@gmail.com>
To: Hongyu Wang <wwwhhhyyy333@gmail.com>
Cc: Hongyu Wang <hongyu.wang@intel.com>,
	Hongtao Liu <hongtao.liu@intel.com>,
	 "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] [i386] GLC tuning: Break false dependency for dest register.
Date: Fri, 14 Jan 2022 16:49:33 +0100	[thread overview]
Message-ID: <CAFULd4b2ovuOrFtqdvnSS6=1xuqSYLErfbOb8CSC3+dqgES70w@mail.gmail.com> (raw)
In-Reply-To: <CA+OydWke2-ePvV4Ozg=SXFZ52AKBnV4e1j61uh6kXp3_43GNjg@mail.gmail.com>

On Fri, Jan 14, 2022 at 2:44 PM Hongyu Wang <wwwhhhyyy333@gmail.com> wrote:
>
> > Are there any technical obstacles to introduce subst to
> > define_{,insn_and_}split?
>
> gccint says: define_subst can be used only in define_insn and
> define_expand, it cannot be used in other expressions (e.g. in
> define_insn_and_split).

Hm, hm ... annoying ...

> I have no idea how to implement it in current infrastructure.
>
> > In the proposed patch, if the output register is also mentioned in the
> > input, then clearing before insn will clear the value in the input
> > register. The solution in the i386.md also takes care of this issue.
> >
>
> For this, I think we can add REGNO checks for operands in condition
> (which means there is true dependency).

Let's go in your direction, considering the limitations of current
infrastructure.
+{
+  if (TARGET_DEST_FALSE_DEPENDENCY
+      && get_attr_dest_false_dep (insn) ==
+        DEST_FALSE_DEP_TRUE)
+    output_asm_insn ("vxorps\t{%x0, %x0, %x0}", operands);
+  return "vgetmant<ssemodesuffix>\t{%2, <round_saeonly_mask_op3>%1,
%0<mask_operand3>|%0<mask_operand3>, %1<round_saeonly_mask_op3>, %2}";
+}

There is no need to pass the information via attributes. IMO, you
shoud use subst attribute directly in the condition:

{
  if (TARGET_DEST_FALSE_DEPENDENCY
      && <mask3_dest_false_dep_attr>
      && !reg_mentioned_p (operands[0], operands[1]))
   output_asm_insn ("vxorps\t{%x0, %x0, %x0}", operands);
  return ".....";
}

Assume the above works, so please:

- rename TARGET_DEST_FALSE_DEPENDENCY to something less generic, maybe
following existing BMI example with TARGET_AVOID_FALSE_DEP_FOR_AVX512F
- rename "mask3_dest_false_dep_attr" to "mask3_false_dep_for_avx512f_cond"

Please note reg_mentioned_p in the above condition. This function
returns nonzero if register op0 appears somewhere within op1 and is
critical for the correct operation of your patch.

Uros.

  reply	other threads:[~2022-01-14 15:49 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-13  7:28 Hongyu Wang
2022-01-13  7:41 ` Uros Bizjak
2022-01-14  5:38   ` Hongyu Wang
2022-01-14  6:03     ` Hongyu Wang
2022-01-14  8:37       ` Uros Bizjak
2022-01-14 13:44         ` Hongyu Wang
2022-01-14 15:49           ` Uros Bizjak [this message]
2022-01-15 16:39             ` Hongyu Wang
2022-01-15 16:43               ` Uros Bizjak
2022-01-16  4:22                 ` Hongtao Liu
2022-01-19  0:00                   ` [PATCH] i386: Fix GLC tuning with -masm=intel [PR104104] Jakub Jelinek
2022-01-19  1:01                     ` Wang, Hongyu
2022-01-19  1:09                     ` Hongtao Liu
2022-01-19  1:40                       ` [PATCH] i386: Fix *aes<aeswideklvariant>u8 Jakub Jelinek
2022-01-19  1:47                         ` Hongtao Liu
2022-01-14  8:17     ` [PATCH] [i386] GLC tuning: Break false dependency for dest register 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='CAFULd4b2ovuOrFtqdvnSS6=1xuqSYLErfbOb8CSC3+dqgES70w@mail.gmail.com' \
    --to=ubizjak@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=hongtao.liu@intel.com \
    --cc=hongyu.wang@intel.com \
    --cc=wwwhhhyyy333@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).