On Fri, Jan 14, 2022 at 2:44 PM Hongyu Wang <wwwhhhyyy...@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 via email to