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

xtensa: Optimize neg[sd]f2 patterns for performance and code size

xtensa floating-point negation patterns are tweaked for better performance and smaller code size, especially in TARGET_DENSITY configurations.

The neg[sd]f2 machine description patterns for Xtensa have been refined to prevent performance regressions caused by interactions with other patches. The changes focus on using only floating-point instructions and a peephole2 pattern to improve code size when both source and destination are address registers in TARGET_DENSITY configurations. This approach avoids complex instruction selection based on operand constraints.

In Details

The neg<mode>2 MD patterns for Xtensa were modified to use define_insn without alternatives or splits, relying instead on two new peephole2 patterns. This change aims to resolve a performance regression observed in TARGET_DENSITY configurations when hardware FP scratch registers were used for negation, leading to larger code size compared to using only address registers. The new approach simplifies instruction selection for this specific operation.

Filed Under: xtensaoptimizationperformancecode-size