]> git.ipfire.org Git - thirdparty/gcc.git/commit
RISC-V: Inhibit FP <--> int register moves via tune param
authorVineet Gupta <vineetg@rivosinc.com>
Mon, 23 May 2022 18:12:09 +0000 (11:12 -0700)
committerKito Cheng <kito.cheng@sifive.com>
Tue, 24 May 2022 07:55:17 +0000 (15:55 +0800)
commitb646d7d279ae0c0d35564542d09866bf3e8afac0
treec60dfdaef8bc6ee7ccfaa38a818f02d88efa97e8
parentb43836914bdc2a37563cf31359b2c4803bfe4374
RISC-V: Inhibit FP <--> int register moves via tune param

Under extreme register pressure, compiler can use FP <--> int
moves as a cheap alternate to spilling to memory.
This was seen with SPEC2017 FP benchmark 507.cactu:
ML_BSSN_Advect.cc:ML_BSSN_Advect_Body()

| fmv.d.x fa5,s9 # PDupwindNthSymm2Xt1, PDupwindNthSymm2Xt1
| .LVL325:
| ld s9,184(sp) # _12469, %sfp
| ...
| .LVL339:
| fmv.x.d s4,fa5 # PDupwindNthSymm2Xt1, PDupwindNthSymm2Xt1
|

The FMV instructions could be costlier (than stack spill) on certain
micro-architectures, thus this needs to be a per-cpu tunable
(default being to inhibit on all existing RV cpus).

Testsuite run with new test reports 10 failures without the fix
corresponding to the build variations of pr105666.c

|  === gcc Summary ===
|
| # of expected passes 123318   (+10)
| # of unexpected failures 34       (-10)
| # of unexpected successes 4
| # of expected failures 780
| # of unresolved testcases 4
| # of unsupported tests 2796

gcc/ChangeLog:

* config/riscv/riscv.cc: (struct riscv_tune_param): Add
  fmv_cost.
(rocket_tune_info): Add default fmv_cost 8.
(sifive_7_tune_info): Ditto.
(thead_c906_tune_info): Ditto.
(optimize_size_tune_info): Ditto.
(riscv_register_move_cost): Use fmv_cost for int<->fp moves.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/pr105666.c: New test.

Signed-off-by: Vineet Gupta <vineetg@rivosinc.com>
gcc/config/riscv/riscv.cc
gcc/testsuite/gcc.target/riscv/pr105666.c [new file with mode: 0644]