LoongArch: Use __builtin_{fmax,fmaxf,fmin,fminf} with GCC >= 13
authorXi Ruoyao <xry111@xry111.site>
Sat, 20 Aug 2022 08:43:44 +0000 (16:43 +0800)
committercaiyinyu <caiyinyu@loongson.cn>
Tue, 30 Aug 2022 03:59:15 +0000 (11:59 +0800)
GCC 13 compiles these built-ins to {fmax,fmin}.{s/d} instruction, use
them instead of the generic implementation.

Link: https://gcc.gnu.org/r13-2085
Signed-off-by: Xi Ruoyao <xry111@xry111.site>
sysdeps/loongarch/fpu/math-use-builtins-fmax.h [new file with mode: 0644]
sysdeps/loongarch/fpu/math-use-builtins-fmin.h [new file with mode: 0644]

diff --git a/sysdeps/loongarch/fpu/math-use-builtins-fmax.h b/sysdeps/loongarch/fpu/math-use-builtins-fmax.h
new file mode 100644 (file)
index 0000000..5d22567
--- /dev/null
@@ -0,0 +1,10 @@
+#if __GNUC_PREREQ (13, 0)
+# define USE_FMAX_BUILTIN 1
+# define USE_FMAXF_BUILTIN 1
+#else
+# define USE_FMAX_BUILTIN 0
+# define USE_FMAXF_BUILTIN 0
+#endif
+
+#define USE_FMAXL_BUILTIN 0
+#define USE_FMAXF128_BUILTIN 0
diff --git a/sysdeps/loongarch/fpu/math-use-builtins-fmin.h b/sysdeps/loongarch/fpu/math-use-builtins-fmin.h
new file mode 100644 (file)
index 0000000..4d28b41
--- /dev/null
@@ -0,0 +1,10 @@
+#if __GNUC_PREREQ (13, 0)
+# define USE_FMIN_BUILTIN 1
+# define USE_FMINF_BUILTIN 1
+#else
+# define USE_FMIN_BUILTIN 0
+# define USE_FMINF_BUILTIN 0
+#endif
+
+#define USE_FMINL_BUILTIN 0
+#define USE_FMINF128_BUILTIN 0