Skip to content
Snippets Groups Projects
Commit 7be87b7d authored by Juzhe-Zhong's avatar Juzhe-Zhong Committed by Pan Li
Browse files

RISC-V: Fix regression (GCC-14 compare with GCC-13.2) of SHA256 from coremark-pro

This patch fixes -70% performance drop from GCC-13.2 to GCC-14 with -march=rv64gcv in real hardware.

The root cause is incorrect cost model cause inefficient vectorization which makes us performance drop significantly.

So this patch does:

1. Adjust vector to scalar cost by introducing v to scalar reg move.
2. Adjust vec_construct cost since we does spend NUNITS instructions to construct the vector.

Tested on both RV32/RV64 no regression, Rebase to the trunk and commit it as it is approved by Robin.

	PR target/113247

gcc/ChangeLog:

	* config/riscv/riscv-protos.h (struct regmove_vector_cost): Add vector to scalar regmove.
	* config/riscv/riscv-vector-costs.cc (adjust_stmt_cost): Ditto.
	* config/riscv/riscv.cc (riscv_builtin_vectorization_cost): Adjust vec_construct cost.

gcc/testsuite/ChangeLog:

	* gcc.target/riscv/rvv/autovec/vls/reduc-19.c: Adapt test.
	* gcc.target/riscv/rvv/autovec/vls/reduc-20.c: Ditto.
	* gcc.target/riscv/rvv/autovec/vls/reduc-21.c: Ditto.
	* gcc.dg/vect/costmodel/riscv/rvv/pr113247-1.c: New test.
	* gcc.dg/vect/costmodel/riscv/rvv/pr113247-2.c: New test.
	* gcc.dg/vect/costmodel/riscv/rvv/pr113247-3.c: New test.
	* gcc.dg/vect/costmodel/riscv/rvv/pr113247-4.c: New test.
parent 405096f9
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment