The cost of lo_sum rtx for addi.d instruction my be a very big number if computed by common function. It may cause some symbols saving to stack and loading from stack if there no enough registers during loop optimization.
gcc/ChangeLog: * config/loongarch/loongarch.cc (loongarch_rtx_costs): Add lo_sum cost. --- gcc/config/loongarch/loongarch.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gcc/config/loongarch/loongarch.cc b/gcc/config/loongarch/loongarch.cc index 845fad5a8e8..0e57f09379c 100644 --- a/gcc/config/loongarch/loongarch.cc +++ b/gcc/config/loongarch/loongarch.cc @@ -3648,6 +3648,10 @@ loongarch_rtx_costs (rtx x, machine_mode mode, int outer_code, *total = COSTS_N_INSNS (4); return false; + case LO_SUM: + *total = set_src_cost (XEXP (x, 0), mode, speed); + return true; + case LT: case LTU: case LE: -- 2.36.0