Skip to content

Commit

Permalink
LoongArch: Use __builtin_{fmax,fmaxf,fmin,fminf} with GCC >= 13
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
xry111 authored and caiyinyu committed Aug 30, 2022
1 parent fa9e095 commit 2416031
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
10 changes: 10 additions & 0 deletions sysdeps/loongarch/fpu/math-use-builtins-fmax.h
Original file line number Diff line number Diff line change
@@ -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
10 changes: 10 additions & 0 deletions sysdeps/loongarch/fpu/math-use-builtins-fmin.h
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 2416031

Please sign in to comment.