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

xtensa: Fix an issue regarding the CONST.S instruction in xtensa_is_insn_L32R_p()

Corrects instruction cost estimation for Xtensa's CONST.S instruction.

This commit fixes an incorrect cost estimation for the Xtensa CONST.S machine instruction within the xtensa_is_insn_L32R_p() function. Previously, CONST.S was mistakenly assigned the same cost as the L32R instruction, which is used for literal pool references. This led to incorrect instruction selection. The fix ensures that CONST.S (and potentially CONST.D in the future) is correctly distinguished from L32R by modifying the function to return false when these constant instructions are encountered.

In Details

The function xtensa_is_insn_L32R_p in config/xtensa/xtensa.cc incorrectly returned true for CONST.S instructions due to faulty cost estimation, treating them as equivalent to L32R (literal pool load). This commit modifies the function to return false for CONST.S and CONST.D instructions, ensuring they are not mistaken for L32R and thus properly handled in instruction selection and cost-based optimization.

For Context
CONST.S
A Xtensa machine instruction for loading a single-precision floating-point constant.
L32R
A Xtensa machine instruction used to load a 32-bit value from the literal pool.
literal pool
A section in an object file or executable that stores constant data used by the program, typically accessed via special load instructions.
cost estimation
The process by which a compiler assigns a 'cost' or 'latency' value to different instructions or code sequences to aid in optimization and instruction selection.
Filed Under: xtensaoptimizationinstruction selection