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

Improve iq2000 port code for AOR optabs and IOR with 0x0

Optimizes iq2000 port by using IOR over PLUS for equivalent operations and simplifying IOR with zero.

This commit improves code generation for the iq2000 port by steering the AOR (Arithmetic OR) optab to use IOR instead of PLUS when they are equivalent. It also optimizes the low-part IOR operation when one operand is zero, transforming it into a simple copy. For constant loads, this means emitting only the LUI instruction. These changes resolve poor code generation issues previously observed for the iq2000 port.

In Details

For the iq2000 port, this change modifies the aopsi3 expander and the 32-bit integer move splitter in iq2000.cc. It introduces a new optab entry for AOR to prefer IOR over PLUS, which is beneficial for instruction scheduling or code size. Furthermore, it optimizes IOR operations where the low part of the constant operand is zero by turning them into a copy instruction, effectively eliminating redundant operations when loading constants or ORing with zero.

For Context
optab
A table within GCC that maps operation codes (opcodes) to their corresponding code generation routines or patterns.
AOR
Arithmetic OR, a type of bitwise OR operation that can sometimes be optimized as an addition depending on the architecture and operands.
IOR
Bitwise Inclusive OR, a logical operation that outputs 1 if at least one of the inputs is 1.
LUI
Load Upper Immediate, an instruction typically used on RISC architectures to load the upper 16 or 20 bits of a 32-bit constant into a register.
iq2000
A specific target architecture or processor for which GCC provides support.
Filed Under: iq2000optimizationcode generation