GCC Newspaper
NOVEMBER 30, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
gcc

Fix WORD_REGISTER_OPERATIONS issue noted by Sashiko

Corrects an optimization pass on WORD_REGISTER_OPERATIONS targets to use the correct mode for checking non-zero bits.

This commit addresses an issue identified in the simplify-rtx.cc file related to targets that define WORD_REGISTER_OPERATIONS. For such targets, when checking for non-zero bits within an RTX (Representation Tree) operation, the compiler was incorrectly passing a mode smaller than a full word. This change ensures that the wider WORD_MODE is used instead, aligning with existing practices in simplify-rtx and other related patches. This correction improves the accuracy of the simplify_binary_operation_1 function on these specific targets.

In Details

The simplify_context::simplify_binary_operation_1 function in simplify-rtx.cc incorrectly passed a mode smaller than a machine word to nonzero_bits when WORD_REGISTER_OPERATIONS was defined and the input mode was less than a word. WORD_REGISTER_OPERATIONS indicates that registers are naturally aligned to word boundaries, and operations on smaller types should ideally be promoted to word operations for efficiency or correctness. The nonzero_bits utility, and potentially other simplification routines that depend on it, expect the full WORD_MODE to correctly handle bitwise checks a…

For Context
WORD_REGISTER_OPERATIONS
A GCC target configuration macro that indicates the machine's registers are word-sized, and operations on smaller types might be promoted to word operations.
RTX
Representation Tree. GCC's internal intermediate representation used in the compiler's back-end. It represents code in a low-level, tree-like structure.
simplify-rtx.cc
A source file in GCC's back-end responsible for simplifying RTX expressions to optimize code.
mode
In GCC, a 'mode' represents a data type and its size, such as SFmode (single-precision float), DFmode (double-precision float), or an integer mode like HImode (16-bit integer).
WORD_MODE
GCC's internal representation mode for a machine word, typically the native integer size of the target architecture.
Sashiko
Likely a code review system or a specific code quality checker that flagged this issue.
Filed Under: optimizationtarget-specificRTX