GCC Newspaper
OCTOBER 6, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
xtensa Performance Win

Make use of CONST.S instruction

Enabled the use of the Xtensa `CONST.S` instruction for floating-point immediate assignments.

This commit enables the Xtensa CONST.S instruction for loading specific single-precision floating-point constants (+0.f, 1.f, 2.f, 0.5f) into floating-point registers. It also allows the Reload/LRA pass to handle assignments of +0.f to general-purpose registers using the MOVI instruction. This optimization is available when floating-point instructions for division, reciprocal, or square root are configured, as CONST.S is then enabled in the Xtensa ISA.

In Details

This patch enhances the Xtensa backend by enabling the CONST.S instruction for specific FP immediate values (+0.f, 1.f, 2.f, 0.5f) and MOVI for assigning +0.f to general-purpose registers. New constraints Gz and Gc are introduced in constraints.md to match these FP constants. The move_operand predicate in predicates.md is removed as its role is superseded. This optimization is valid when the Xtensa ISA configuration includes FP division, reciprocal, or square root instructions, which implicitly enable CONST.S.

For Context
Xtensa
A configurable processor architecture commonly used in embedded systems. GCC supports various configurations of the Xtensa ISA.
CONST.S instruction
An Xtensa instruction that loads a specific single-precision floating-point constant into an FP register.
Reload/LRA pass
In compiler optimization, the Reload pass (often integrated with the Linear Register Allocation pass) is responsible for handling register allocation, spill code generation, and instruction selection.
FP immediate
A floating-point constant value directly embedded into an instruction.
Filed Under: xtensaoptimizationfloating-point