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

AArch64: Add isnormal expander [PR 66462]

AArch64 now has an optimized expander for `__builtin_isnormal` that avoids exceptions and is faster.

An optimized expander for __builtin_isnormal has been added to the AArch64 backend, supporting float, _Float16, and __bf16 types. This new implementation uses integer arithmetic instead of floating-point comparisons, which can be faster and crucially avoids generating spurious exceptions on signaling NaNs. This change addresses a part of PR66462 by improving the robustness and performance of the isnormal intrinsic.

In Details

This patch introduces a new isnormal expander for SFmode, HFmode, and BFmode on AArch64. It replaces the previous implementation, which relied on floating-point comparisons and could trap on signaling NaNs, with an integer-based approach. The integer method extracts the exponent, adjusts it, and compares it against fixed thresholds. This is typically faster and safer, as it avoids generating floating-point exceptions. The commit also adds specific test cases for these modes.

For Context
expander
In GCC, an expander is a function or code sequence that replaces an intrinsic or built-in function with a series of lower-level operations or machine instructions.
signaling NaN
A special floating-point value that, when used in an operation, generates an exception (e.g., FE_INVALID) and its value is typically propagated. This contrasts with a quiet NaN, which propagates without raising an exception.
HFmode
GCC internal mode for the IEEE 754 half-precision floating-point format (_Float16, 16 bits).
BFmode
GCC internal mode for the Brain Float 16 (BF16) format (__bf16, 16 bits).
SFmode
GCC internal mode for the IEEE 754 single-precision floating-point format (float, 32 bits).
Filed Under: aarch64builtinsoptimization