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

aarch64: Expand any-or-plus to IOR or ADD

AArch64 backend now correctly expands bitwise operations, improving code generation and fixing regressions.

The AArch64 backend has been updated to correctly expand bitwise OR and XOR operations (aop3) to IOR or ADD instructions, rather than defaulting to PLUS. This change is necessary because the AArch64 architecture does not define a specific instruction for this operation, and the previous default caused issues with floating-point conversions and bitfield operations. The fix ensures more accurate code generation, resolving regressions in specific C code patterns.

In Details

The aop<mode>3 expander in AArch64's .md files was defaulting to PLUS for SImode/DImode when operands were bitwise-disjoint, due to lack of a specific AArch64 instruction. This default interfered with correct handling of bitfield inserts and float conversions by misrepresenting the number of significant bits. This commit introduces a new expander that checks if the second operand is an immediate ADD or logical immediate, emitting IOR for logical immediates and ADD otherwise, thereby preserving the intended operation and fixing subsequent compilation issues.

Filed Under: aarch64optimizationcode-generation