GCC Newspaper
JUNE 15, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
rx

RX: Correct the size of mov instruction

This patch fixes incorrect code generation in the RX backend when expanding `extendqisi2` or `extendhisi2` operations.

The RX backend was generating incorrect mov instruction sizes for certain code patterns, leading to incorrect output. This patch ensures the correct operation size is always selected for mov instructions, resolving the code generation issue. Optimization hid the bug, so it went unnoticed until now.

In Details

The RX backend's rx_gen_move_template function was not correctly selecting the smallest mode for mov instructions when expanding extendqisi2 or extendhisi2. This patch fixes the mode selection logic. Interaction with the compiler's instruction selection phase is the key here.

For Context

The compiler's backend is responsible for translating the compiler's intermediate representation (IR) into machine code for a specific processor architecture. This involves selecting the right instructions and encoding them correctly. The RX backend generates code for Renesas RX microcontrollers. This commit fixes a bug in the instruction selection logic for move instructions, ensuring that the correct instruction size is chosen based on the data type being moved.

Filed Under: gccrxcode generationbugfix