https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66462
--- Comment #23 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Xi Ruoyao <[email protected]>: https://gcc.gnu.org/g:2c98d7cf3a151e3d464a8e4a161d084494281d76 commit r16-4071-g2c98d7cf3a151e3d464a8e4a161d084494281d76 Author: Xi Ruoyao <[email protected]> Date: Tue Sep 16 23:10:26 2025 +0800 LoongArch: Add isnan expander [PR 66462] Add an expander for isnan using fclass. Since isnan is just a compare, enable it only with -fsignaling-nans to avoid generating spurious exceptions. This fixes part of PR66462. int isnan1 (float x) { return __builtin_isnan (x); } With -fno-signaling-nans: fcmp.cun.s $fcc0,$f0,$f0 movcf2fr $f0,$fcc0 movfr2gr.s $r4,$f0 jr $r1 With -fsignaling-nans: fclass.s $f0,$f0 movfr2gr.s $r4,$f0 andi $r4,$r4,3 sltu $r4,$r0,$r4 jr $r1 PR middle-end/66462 gcc/ * config/loongarch/loongarch.md (FCLASS_MASK): Add 3. (fclass_optab): Assign isnan for 3. (<FCLASS_MASK:fclass_optab><ANYF:mode>2): If FCLASS_MASK is 3, only enable when -fsignaling-nans. gcc/testsuite: * gcc.target/loongarch/fclass-compile.c: Update test. * gcc.target/loongarch/fclass-run.c: Likewise.
