GCC Newspaper
OCTOBER 6, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
aarch64

Block complex multiplication when honoring signed zeros on AArch64

Prevent AArch64's complex multiplication expansion from using signed zeros to avoid incorrect results.

This commit modifies the AArch64 backend to block the expansion of COMPLEX_MUL when the HONOR_SIGNED_ZEROS flag is enabled. The current emulation of COMPLEX_MUL using COMPLEX_FMA with a $+0.0$ accumulator can produce incorrect zero signs due to rounding or flushing behavior. To maintain correctness, this optimization is disabled when signed zero handling is required. This change is accompanied by test case updates to enforce the -fno-signed-zeros flag for relevant scenarios.

In Details

On AArch64, the cmul (complex multiplication) intrinsic is often emulated using COMPLEX_FMA (fused multiply-add) by seeding the accumulator with +0.0. This approach, however, can lead to incorrect sign propagation for zero results, especially when floating-point rounding or flushing modes are active. To address this, the pattern matching for cmul in AArch64's aarch64-simd.md and aarch64-sve.md now includes a requirement that !HONOR_SIGNED_ZEROS. This ensures that the potentially problematic emulation is not used when precise signed zero semantics are mandated by the compilation…

For Context
COMPLEX_MUL
An operation representing the multiplication of two complex numbers.
COMPLEX_FMA
An operation representing a fused multiply-add for complex numbers, often used as an efficient way to implement complex multiplication.
HONOR_SIGNED_ZEROS
A compiler flag or target feature that requires the generated code to correctly preserve the sign of zero values during floating-point operations.
AArch64
The 64-bit ARM architecture, commonly used in mobile devices, servers, and embedded systems.
Signed Zeros
In floating-point arithmetic, zeros can have a sign ('+0.0' or '-0.0'). Preserving these signs is important in certain numerical algorithms and standards.
Filed Under: aarch64complex numbersfloating-pointsigned zeros