]> git.ipfire.org Git - thirdparty/gcc.git/commit
LoongArch: Implement scalar isinf, isnormal, and isfinite via fclass
authorXi Ruoyao <xry111@xry111.site>
Wed, 3 Jul 2024 18:49:28 +0000 (02:49 +0800)
committerXi Ruoyao <xry111@xry111.site>
Thu, 15 Aug 2024 11:38:44 +0000 (19:38 +0800)
commitee4a6343225b6e44b3d2b2c90c355c21f7ec6855
tree46fc1d502a2736b77c47841965b70250afd508df
parentf7e672da8fc3d416a6d07eb01f3be4400ef94fac
LoongArch: Implement scalar isinf, isnormal, and isfinite via fclass

Doing so can avoid loading FP constants from the memory.  It also
partially fixes PR 66262 as fclass does not signal on sNaN.

gcc/ChangeLog:

* config/loongarch/loongarch.md (extendsidi2): Add ("=r", "f")
alternative and use movfr2gr.s for it.  The spec clearly states
movfr2gr.s sign extends the value to GRLEN.
(fclass_<fmt>): Make the result SImode instead of a floating
mode.  The fclass results are really not FP values.
(FCLASS_MASK): New define_int_iterator.
(fclass_optab): New define_int_attr.
(<FCLASS_MASK:fclass_optab><ANYF:mode>): New define_expand
template.

gcc/testsuite/ChangeLog:

* gcc.target/loongarch/fclass-compile.c: New test.
* gcc.target/loongarch/fclass-run.c: New test.
gcc/config/loongarch/loongarch.md
gcc/testsuite/gcc.target/loongarch/fclass-compile.c [new file with mode: 0644]
gcc/testsuite/gcc.target/loongarch/fclass-run.c [new file with mode: 0644]