On Fri, Dec 29, 2023 at 09:14:52PM -0700, Jeff Law wrote: > On 12/29/23 10:46, YunQiang Su wrote: > >When we try to combine RTLs, the result may be very complex, > >and `rtx_cost` may think that it need lots of costs. But in > >fact, it may match a pattern in machine descriptions, which > >may emit only 1 or 2 hardware instructions. This combination > >may be refused due to cost comparison failure. > Then that's a problem with the backend's implementation of RTX_COST. > > >Since the high cost may be due to a more expsensive operation. > >To get real reason, we also need information about instruction > >count. > Then cost the *operations*, not the number of instructions. Also note > that a single insn may generate multiple assembler instructions. > > Even with all its warts, the real solution here is to fix the port's RTX > costs.
Or implement the insn_cost hook instead, it will be used preferably over rtx_costs in most places then. Including in the combiner. insn_cost is much easier to implement, and even possible to make good cost estimates with :-) Segher