[1/9] LoongArch: Use __builtin_rint{,f} with GCC >= 13

Message ID 20221118113040.2502609-1-tangxiaolin@loongson.cn
State Committed
Commit 948652e4f82f5aedbe882178ae158990bde63c79
Headers
Series [1/9] LoongArch: Use __builtin_rint{,f} with GCC >= 13 |

Commit Message

Xiaolin Tang Nov. 18, 2022, 11:30 a.m. UTC
  From: Xi Ruoyao <xry111@xry111.site>

GCC 13 compiles these built-ins to frint.{d,s} instruction.

Link: https://gcc.gnu.org/r13-3919
---
 sysdeps/loongarch/fpu/math-use-builtins-rint.h | 9 +++++++++
 1 file changed, 9 insertions(+)
 create mode 100644 sysdeps/loongarch/fpu/math-use-builtins-rint.h
  

Patch

diff --git a/sysdeps/loongarch/fpu/math-use-builtins-rint.h b/sysdeps/loongarch/fpu/math-use-builtins-rint.h
new file mode 100644
index 0000000000..cd91482f5f
--- /dev/null
+++ b/sysdeps/loongarch/fpu/math-use-builtins-rint.h
@@ -0,0 +1,9 @@ 
+#if __GNUC_PREREQ (13, 0)
+#  define USE_RINT_BUILTIN 1
+#  define USE_RINTF_BUILTIN 1
+#else
+#  define USE_RINT_BUILTIN 0
+#  define USE_RINTF_BUILTIN 0
+#endif
+#define USE_RINTL_BUILTIN 0
+#define USE_RINTF128_BUILTIN 0