Thanks for the suggestion, here is the updated patch that survived bootstrap/regtest. > 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. I added reg_mentioned_p for all insns except fp16 complex mult, since they have constraint & to the dest so it must be allocated different register from src. Uros Bizjak 于2022年1月14日周五 23:49写道: > > On Fri, Jan 14, 2022 at 2:44 PM Hongyu Wang 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\t{%2, %1, > %0|%0, %1, %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 > && > && !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.