Re: [PATCH] MIPS: Implement TARGET_INSN_COSTS

2023-12-28 Thread YunQiang Su
Roger Sayle 于2023年12月29日周五 00:54写道: > > > > The current (default) behavior is that when the target doesn’t define > > TARGET_INSN_COST the middle-end uses the backend’s > > TARGET_RTX_COSTS, so multiplications are slower than additions, > > but about the same size when optimizing for size (with -O

[PATCH] MIPS: Implement TARGET_INSN_COSTS

2023-12-28 Thread Roger Sayle
The current (default) behavior is that when the target doesn't define TARGET_INSN_COST the middle-end uses the backend's TARGET_RTX_COSTS, so multiplications are slower than additions, but about the same size when optimizing for size (with -Os or -Oz). All of this gets disabled with your

[PATCH] MIPS: Implement TARGET_INSN_COSTS

2023-12-28 Thread YunQiang Su
MIPS backend had some information about INSN, including length, count etc. And since some instructions are more costly, let's add a new attr `perf_ratio`. It's default value is (const_int 1). The return value of mips_insn_cost is insn_count * perf_ratio * 4. The magic `4` here, is due to that