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.
2025-12-23 Milan Tripkovic <[email protected]>
gcc/ChangeLog:
* config/riscv/spacemit-x60.md (spacemit_x60_clmul): clmul value changed
CONFIDENTIALITY: The contents of this e-mail are confidential and intended only
for the above addressee(s). If you are not the intended recipient, or the
person responsible for delivering it to the intended recipient, copying or
delivering it to anyone else or using it in any unauthorized manner is
prohibited and may be unlawful. If you receive this e-mail by mistake, please
notify the sender and the systems administrator at [email protected]
immediately.
---
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 c991f89e5e2..b4a5352ea57 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")
--
2.43.0