[v4,09/12] math: Add math-use-builtinds-fmin.h
Checks
Context |
Check |
Description |
dj/TryBot-apply_patch |
success
|
Patch applied to master at the time it was sent
|
Commit Message
It allows the architecture to use the builtin instead of generic
implementation.
---
math/s_fmin_template.c | 27 ++++++++++++++++++++++++
sysdeps/generic/math-use-builtins-fmin.h | 4 ++++
sysdeps/generic/math-use-builtins.h | 1 +
3 files changed, 32 insertions(+)
create mode 100644 sysdeps/generic/math-use-builtins-fmin.h
Comments
Hi Adhemerval,
math/s_fmin_template.c | 27 ++++++++++++++++++++++++
sysdeps/generic/math-use-builtins-fmin.h | 4 ++++
sysdeps/generic/math-use-builtins.h | 1 +
3 files changed, 32 insertions(+)
create mode 100644 sysdeps/generic/math-use-builtins-fmin.h
Looks good to me.
Cheers,
Wilco
@@ -17,11 +17,38 @@
<https://www.gnu.org/licenses/>. */
#include <math.h>
+#include <math-use-builtins.h>
+
+#if __HAVE_FLOAT128
+# define USE_BUILTIN_F128 , _Float128 : USE_FMAXF128_BUILTIN
+# define BUILTIN_F128 , _Float128 : __builtin_fminf128
+#else
+# define USE_BUILTIN_F128
+# define BUILTIN_F128
+#endif
+
+#define USE_BUILTIN(X, Y) \
+ _Generic((X), \
+ float : USE_FMAXF_BUILTIN, \
+ double : USE_FMAX_BUILTIN, \
+ long double : USE_FMAXL_BUILTIN \
+ USE_BUILTIN_F128)
+
+#define BUILTIN(X, Y) \
+ _Generic((X), \
+ float : __builtin_fminf, \
+ double : __builtin_fmin, \
+ long double : __builtin_fminl \
+ BUILTIN_F128) \
+ (X, Y)
FLOAT
M_DECL_FUNC (__fmin) (FLOAT x, FLOAT y)
{
+ if (USE_BUILTIN (x, y))
+ return BUILTIN (x, y);
+
if (islessequal (x, y))
return x;
else if (isgreater (x, y))
new file mode 100644
@@ -0,0 +1,4 @@
+#define USE_FMIN_BUILTIN 0
+#define USE_FMINF_BUILTIN 0
+#define USE_FMINL_BUILTIN 0
+#define USE_FMINF128_BUILTIN 0
@@ -35,5 +35,6 @@
#include <math-use-builtins-sqrt.h>
#include <math-use-builtins-fma.h>
#include <math-use-builtins-fmax.h>
+#include <math-use-builtins-fmin.h>
#endif /* MATH_USE_BUILTINS_H */