https://gcc.gnu.org/g:fa80b3972160804a0db1e9c3caa90edf603086a0
commit r16-6368-gfa80b3972160804a0db1e9c3caa90edf603086a0 Author: Milan Tripkovic <[email protected]> Date: Tue Dec 23 09:39:41 2025 -0700 [RISC-V][PATCH] Adjust clmul latency in Spacemit X60 scheduler model This patch adjusts the instruction scheduling and cost model for the Zbc (CLMUL) extension on the Spacemit X60 core. The tuning was evaluated using three configurations (CLMUL2, CLMUL3, and the baseline CLMUL5) across a variety of hashing and encryption kernels. | Test Case | Met | CLMUL2 | CLMUL3 | v5 (Patch) | v5/v2 | v5/v3 | |--------------|-----|-------------|-------------|-------------|-------|-------| | AES Hash | ms | 1,676.94| 1,614.35| 1,614.71| -3.71%| +0.02%| | [5bsv8qnh1] | cyc |2,683,008,256|2,582,866,539|2,583,483,082| -3.71%| +0.02%| |--------------|-----|-------------|-------------|-------------|-------|-------| | Sweet Spot | ms | 2,631.45| 2,631.35| 2,743.37| +4.25%| +4.26%| | [xe9sncK87] | cyc |4,210,294,394|4,210,083,291|4,389,331,992| +4.25%| +4.26%| |--------------|-----|-------------|-------------|-------------|-------|-------| | 128b Mult | ms | 1,639.32| 1,727.10| 1,754.90| +7.05%| +1.61%| | [aYezqcx4n] | cyc |2,622,877,789|2,763,259,605|2,807,789,209| +7.05%| +1.61%| |--------------|-----|-------------|-------------|-------------|-------|-------| | CRC32 Fold | ms | 2,056.78| 1,947.46| 2,120.03| +3.07%| +8.86%| | [bdWoW9ezv] | cyc |3,290,804,189|3,115,896,432|3,391,980,303| +3.07%| +8.86%| |--------------|-----|-------------|-------------|-------------|-------|-------| | Wegman Hash | ms | 2,160.13| 2,161.12| 2,204.77| +2.07%| +2.02%| | [aa8aGerbe] | cyc |3,456,154,927|3,457,644,543|3,527,588,691| +2.07%| +2.02%| |--------------|-----|-------------|-------------|-------------|-------|-------| Links: [5bsv8qnh1] https://godbolt.org/z/5bsv8qnh1 [xe9sncK87] https://godbolt.org/z/xe9sncK87 [aYezqcx4n] https://godbolt.org/z/aYezqcx4n [bdWoW9ezv] https://godbolt.org/z/bdWoW9ezv [aa8aGerbe] https://godbolt.org/z/aa8aGerbe Based on the benchmark results, CLMUL3 is proposed as the new default tuning for this core. gcc/ChangeLog: * config/riscv/spacemit-x60.md (spacemit_x60_clmul): Adjust latency. Diff: --- gcc/config/riscv/spacemit-x60.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/config/riscv/spacemit-x60.md b/gcc/config/riscv/spacemit-x60.md index c991f89e5e2d..b4a5352ea572 100644 --- a/gcc/config/riscv/spacemit-x60.md +++ b/gcc/config/riscv/spacemit-x60.md @@ -93,7 +93,7 @@ (eq_attr "mode" "DI"))) "spacemit_x60_alu") -(define_insn_reservation "spacemit_x60_clmul" 5 +(define_insn_reservation "spacemit_x60_clmul" 3 (and (eq_attr "tune" "spacemit_x60") (eq_attr "type" "clmul")) "spacemit_x60_alu")
