aboutsummaryrefslogtreecommitdiff
path: root/gcc/range-op-float.cc
diff options
context:
space:
mode:
authorXi Ruoyao <xry111@xry111.site>2022-11-06 23:16:49 +0800
committerXi Ruoyao <xry111@xry111.site>2022-11-12 15:01:13 +0800
commit51a233b97cc9c51e63f03f2f5554e905f3f6c054 (patch)
tree3f3ecbb25183cace4e422ef04da1adfcbada9fd6 /gcc/range-op-float.cc
parente468dd40150ad20fe87d315c2638c572ca44dc3b (diff)
downloadgcc-51a233b97cc9c51e63f03f2f5554e905f3f6c054.zip
gcc-51a233b97cc9c51e63f03f2f5554e905f3f6c054.tar.gz
gcc-51a233b97cc9c51e63f03f2f5554e905f3f6c054.tar.bz2
LoongArch: Add ftint{,rm,rp}.{w,l}.{s,d} instructions
This allows to optimize the following builtins if -fno-math-errno: - __builtin_lrint{,f} - __builtin_lfloor{,f} - __builtin_lceil{,f} Inspired by https://gcc.gnu.org/pipermail/gcc-patches/2022-November/605287.html. ANYFI is added so the compiler won't try ftint.l.s if -mfpu=32. If we simply used GPR here an ICE would be triggered with __builtin_lrintf and -mfpu=32. ftint{rm,rp} instructions may raise inexact exception, so they can't be used if -fno-trapping-math -fno-fp-int-builtin-inexact. Note that the .w.{s,d} variants are not tested because we don't support ILP32 for now. gcc/ChangeLog: * config/loongarch/loongarch.md (UNSPEC_FTINT): New unspec. (UNSPEC_FTINTRM): Likewise. (UNSPEC_FTINTRP): Likewise. (LRINT): New define_int_iterator. (lrint_pattern): New define_int_attr. (lrint_submenmonic): Likewise. (lrint_allow_inexact): Likewise. (ANYFI): New define_mode_iterator. (lrint<ANYF><ANYFI>): New instruction template. gcc/testsuite/ChangeLog: * gcc.target/loongarch/ftint.c: New test. * gcc.target/loongarch/ftint-no-inexact.c: New test.
Diffstat (limited to 'gcc/range-op-float.cc')
0 files changed, 0 insertions, 0 deletions