https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66462
--- Comment #25 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Jeff Law <[email protected]>: https://gcc.gnu.org/g:e8fb8ba77cf7a1688a063690fad27fb584c77b38 commit r17-4523-ge8fb8ba77cf7a1688a063690fad27fb584c77b38 Author: Matt Turner <[email protected]> Date: Mon Sep 21 07:27:42 2026 -0600 [PATCH 3/5] AArch64: Add isnormal expander [PR 66462] Add an expander for isnormal using integer arithmetic. This is typically faster and avoids generating spurious exceptions on signaling NaNs. This fixes part of PR66462. int isnormal1 (float x) { return __builtin_isnormal (x); } Before: fabs s0, s0 mov w0, 2139095039 fmov s31, w0 fcmp s0, s31 movi v31.2s, 0x80, lsl 16 fccmp s0, s31, 1, ls cset w0, lt eor w0, w0, 1 ret After: fmov w0, s0 ubfx w0, w0, 23, 8 sub w0, w0, #1 cmp w0, 254 cset w0, cc ret HFmode and BFmode are handled too. Neither has 16-bit integer arithmetic, so their encoding is zero-extended into a word first: int isnormal2 (_Float16 x) { return __builtin_isnormal (x); } Before: umov w0, v0.h[0] mvni v0.4h, 0x84, lsl 8 movi v30.4h, 0x4, lsl 8 fcvt s0, h0 and w0, w0, 32767 fcvt s30, h30 dup v31.4h, w0 fcvt s31, h31 fcmp s31, s0 cset w0, hi fcmp s31, s30 cset w1, lt orr w0, w0, w1 eor w0, w0, 1 ret After: umov w0, v0.h[0] ubfx w0, w0, 10, 5 sub w0, w0, #1 cmp w0, 30 cset w0, cc ret gcc/ChangeLog: PR middle-end/66462 * config/aarch64/aarch64.md (isnormal<mode>2): Add new expander. * config/aarch64/iterators.md (GPF_HF_BF): New mode iterator. (mantissa_bits): Add HF and BF. (V_INT_EQUIV): Add BF. gcc/testsuite/ChangeLog: PR middle-end/66462 * gcc.target/aarch64/pr66462.c: Add tests for isnormal, including _Float16 and __bf16.
