[gcc(refs/vendors/riscv/heads/gcc-15-with-riscv-opts)] RISC-V: Adjust tt-ascalon-d8 branch cost
Jeff Law
law@gcc.gnu.org
Sat Jan 17 07:15:50 GMT 2026
https://gcc.gnu.org/g:a23e0cd280d07690ba4be5dc9f99a53897d36c95
commit a23e0cd280d07690ba4be5dc9f99a53897d36c95
Author: Anton Blanchard <antonb@tenstorrent.com>
Date: Mon Sep 8 07:36:39 2025 -0600
RISC-V: Adjust tt-ascalon-d8 branch cost
If-conversion isn't being applied to this nbench code:
#include <stdint.h>
#define INTERNAL_FPF_PRECISION 4
typedef uint16_t u16;
void ShiftMantLeft1(u16 *carry, u16 *mantissa)
{
int i;
int new_carry;
u16 accum;
for(i=INTERNAL_FPF_PRECISION-1;i>=0;i--)
{ accum=mantissa[i];
new_carry=accum & 0x8000;
accum=accum<<1;
if(*carry)
accum|=1;
*carry=new_carry;
mantissa[i]=accum;
}
return;
}
Bumping branch_cost from 3 to 4 triggers if-conversion, improving the
nbench FP EMULATION result on Ascalon significantly. There's a risk
that more aggressive use of conditional zero instructions will negatively
impact workloads that predict well, but we haven't seen anything obvious.
gcc/ChangeLog:
* config/riscv/riscv.cc (tt_ascalon_d8_tune_info): Increase branch_cost
from 3 to 4.
(cherry picked from commit 11171cb98098e0a6438a5c2f964f5d45f2127b76)
Diff:
---
gcc/config/riscv/riscv.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc
index 2dcc5b4fd86c..060b15fcdc6f 100644
--- a/gcc/config/riscv/riscv.cc
+++ b/gcc/config/riscv/riscv.cc
@@ -659,7 +659,7 @@ static const struct riscv_tune_param tt_ascalon_d8_tune_info = {
{COSTS_N_INSNS (3), COSTS_N_INSNS (3)}, /* int_mul */
{COSTS_N_INSNS (13), COSTS_N_INSNS (13)}, /* int_div */
8, /* issue_rate */
- 3, /* branch_cost */
+ 4, /* branch_cost */
4, /* memory_cost */
4, /* fmv_cost */
false, /* slow_unaligned_access */
More information about the Gcc-cvs
mailing list