GCC Newspaper
OCTOBER 6, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
nds32

nds32: Fix rtx_costs return value

Fixed the ND32 backend's `rtx_costs` functions to correctly store costs and return a boolean status, resolving a build failure.

This commit corrects an error in the ND32 target’s cost calculation functions. Previously, nds32_rtx_costs_speed_prefer incorrectly returned the cost value directly in two places, instead of storing it in the provided pointer and returning true to indicate completion. This fix ensures the functions adhere to their expected interface, resolving a build failure observed with config-list.mk.

In Details

In gcc/config/nds32/nds32-cost.cc, the nds32_rtx_costs_speed_prefer function was modified to correctly implement its return value contract. Two instances that previously returned the calculated cost directly have been changed to store the cost in the *total pointer argument and return true, aligning with the expected behavior of rtx_costs functions which should indicate completion via the return value, not the cost itself.

For Context
NDS32
A 32-bit microprocessor instruction set architecture. GCC has a backend for this architecture.
rtx_costs
A function or set of functions within GCC that estimate the cost of operations on a particular target architecture, typically used by the instruction scheduler and optimizer.
Pointer argument
An argument passed to a function that is a memory address. In C/C++, this allows the function to modify the original variable that the pointer points to.
Filed Under: nds32build fixcost model