]> git.ipfire.org Git - thirdparty/gcc.git/commit
LoongArch: Adjust the cost of ADDRESS_REG_REG.
authorLulu Cheng <chenglulu@loongson.cn>
Tue, 10 Dec 2024 12:59:22 +0000 (20:59 +0800)
committerLulu Cheng <chenglulu@loongson.cn>
Fri, 14 Feb 2025 07:55:29 +0000 (15:55 +0800)
commit7c50f95421b6de50e4f40773558d0072eafb2365
tree0395c6ec6545f44e0e56d7fdd82a20f77515efff
parentee579b7c257468b9032ab4583ec455fa871d4428
LoongArch: Adjust the cost of ADDRESS_REG_REG.

After changing this cost from 1 to 3, the performance of spec2006
401 473 416 465 482 can be improved by about 2% on LA664.

Add option '-maddr-reg-reg-cost='.

gcc/ChangeLog:

* config/loongarch/genopts/loongarch.opt.in: Add
option '-maddr-reg-reg-cost='.
* config/loongarch/loongarch-def.cc
(loongarch_rtx_cost_data::loongarch_rtx_cost_data): Initialize
addr_reg_reg_cost to 3.
* config/loongarch/loongarch-opts.cc
(loongarch_target_option_override): If '-maddr-reg-reg-cost='
is not used, set it to the initial value.
* config/loongarch/loongarch-tune.h
(struct loongarch_rtx_cost_data): Add the member
addr_reg_reg_cost and its assignment function to the structure
loongarch_rtx_cost_data.
* config/loongarch/loongarch.cc (loongarch_address_insns):
Use la_addr_reg_reg_cost to set the cost of ADDRESS_REG_REG.
* config/loongarch/loongarch.opt: Regenerate.
* config/loongarch/loongarch.opt.urls: Regenerate.
* doc/invoke.texi: Add description of '-maddr-reg-reg-cost='.

gcc/testsuite/ChangeLog:

* gcc.target/loongarch/const-double-zero-stx.c: Add
'-maddr-reg-reg-cost=1'.
* gcc.target/loongarch/stack-check-alloca-1.c: Likewise.
gcc/config/loongarch/genopts/loongarch.opt.in
gcc/config/loongarch/loongarch-def.cc
gcc/config/loongarch/loongarch-opts.cc
gcc/config/loongarch/loongarch-tune.h
gcc/config/loongarch/loongarch.cc
gcc/config/loongarch/loongarch.opt
gcc/config/loongarch/loongarch.opt.urls
gcc/doc/invoke.texi
gcc/testsuite/gcc.target/loongarch/const-double-zero-stx.c
gcc/testsuite/gcc.target/loongarch/stack-check-alloca-1.c