https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126328

--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Segher Boessenkool from comment #5)
> (In reply to Richard Biener from comment #3)
> > so we are back to a cost of 4, because combine_validate_cost doesn't
> > re-recog before costing :/
> 
> What does this mean?  The result of recog () should depend only on the RTL of
> the insn, always.  So why would you ever want to run recog () more often than
> required?

Because you want to write the insn matching code once.  Like you could
add a 'cost' insn attribute to patterns in the .md file and in the
insn_cost hook simply return that.  But - combine calls insn_cost when
the insn isn't recognized.  Now, I suppose the hook isn't supposed to modify
the insn (even though it doesnt' get a const_rtx_insn *), or do you say
the insn_cost hook should simply call recog () to match up a pattern with
costs?

See https://gcc.gnu.org/pipermail/gcc-patches/2026-July/724831.html
how I propose to "fix" the x86 insn_cost hook to recognize the hadd
patterns.  Relying on recog () would be way easier and more maintainable?

Reply via email to