public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc/azanella/hypot-refactor] math: Add math-use-builtinds-fmin.h
@ 2021-12-06 17:58 Adhemerval Zanella
0 siblings, 0 replies; 3+ messages in thread
From: Adhemerval Zanella @ 2021-12-06 17:58 UTC (permalink / raw)
To: glibc-cvs
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=77e80a9d4ceb06a96cf9f8d113377c58dfedacc1
commit 77e80a9d4ceb06a96cf9f8d113377c58dfedacc1
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date: Wed Dec 1 10:44:58 2021 -0300
math: Add math-use-builtinds-fmin.h
It allows the architecture to use the builtin instead of generic
implementation.
Diff:
---
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(+)
diff --git a/math/s_fmin_template.c b/math/s_fmin_template.c
index 565a836266..27c2382f59 100644
--- a/math/s_fmin_template.c
+++ b/math/s_fmin_template.c
@@ -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))
diff --git a/sysdeps/generic/math-use-builtins-fmin.h b/sysdeps/generic/math-use-builtins-fmin.h
new file mode 100644
index 0000000000..d2383ce00c
--- /dev/null
+++ b/sysdeps/generic/math-use-builtins-fmin.h
@@ -0,0 +1,4 @@
+#define USE_FMIN_BUILTIN 0
+#define USE_FMINF_BUILTIN 0
+#define USE_FMINL_BUILTIN 0
+#define USE_FMINF128_BUILTIN 0
diff --git a/sysdeps/generic/math-use-builtins.h b/sysdeps/generic/math-use-builtins.h
index e07bba242f..24fba47575 100644
--- a/sysdeps/generic/math-use-builtins.h
+++ b/sysdeps/generic/math-use-builtins.h
@@ -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 */
^ permalink raw reply [flat|nested] 3+ messages in thread
* [glibc/azanella/hypot-refactor] math: Add math-use-builtinds-fmin.h
@ 2021-12-01 17:09 Adhemerval Zanella
0 siblings, 0 replies; 3+ messages in thread
From: Adhemerval Zanella @ 2021-12-01 17:09 UTC (permalink / raw)
To: glibc-cvs
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=8946dd63ad96602458277b6f76edf19f9382f31b
commit 8946dd63ad96602458277b6f76edf19f9382f31b
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date: Wed Dec 1 10:44:58 2021 -0300
math: Add math-use-builtinds-fmin.h
It allows the architecture to use the builtin instead of generic
implementation.
Diff:
---
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(+)
diff --git a/math/s_fmin_template.c b/math/s_fmin_template.c
index 565a836266..27c2382f59 100644
--- a/math/s_fmin_template.c
+++ b/math/s_fmin_template.c
@@ -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))
diff --git a/sysdeps/generic/math-use-builtins-fmin.h b/sysdeps/generic/math-use-builtins-fmin.h
new file mode 100644
index 0000000000..d2383ce00c
--- /dev/null
+++ b/sysdeps/generic/math-use-builtins-fmin.h
@@ -0,0 +1,4 @@
+#define USE_FMIN_BUILTIN 0
+#define USE_FMINF_BUILTIN 0
+#define USE_FMINL_BUILTIN 0
+#define USE_FMINF128_BUILTIN 0
diff --git a/sysdeps/generic/math-use-builtins.h b/sysdeps/generic/math-use-builtins.h
index e07bba242f..24fba47575 100644
--- a/sysdeps/generic/math-use-builtins.h
+++ b/sysdeps/generic/math-use-builtins.h
@@ -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 */
^ permalink raw reply [flat|nested] 3+ messages in thread
* [glibc/azanella/hypot-refactor] math: Add math-use-builtinds-fmin.h
@ 2021-12-01 16:46 Adhemerval Zanella
0 siblings, 0 replies; 3+ messages in thread
From: Adhemerval Zanella @ 2021-12-01 16:46 UTC (permalink / raw)
To: glibc-cvs
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=8946dd63ad96602458277b6f76edf19f9382f31b
commit 8946dd63ad96602458277b6f76edf19f9382f31b
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date: Wed Dec 1 10:44:58 2021 -0300
math: Add math-use-builtinds-fmin.h
It allows the architecture to use the builtin instead of generic
implementation.
Diff:
---
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(+)
diff --git a/math/s_fmin_template.c b/math/s_fmin_template.c
index 565a836266..27c2382f59 100644
--- a/math/s_fmin_template.c
+++ b/math/s_fmin_template.c
@@ -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))
diff --git a/sysdeps/generic/math-use-builtins-fmin.h b/sysdeps/generic/math-use-builtins-fmin.h
new file mode 100644
index 0000000000..d2383ce00c
--- /dev/null
+++ b/sysdeps/generic/math-use-builtins-fmin.h
@@ -0,0 +1,4 @@
+#define USE_FMIN_BUILTIN 0
+#define USE_FMINF_BUILTIN 0
+#define USE_FMINL_BUILTIN 0
+#define USE_FMINF128_BUILTIN 0
diff --git a/sysdeps/generic/math-use-builtins.h b/sysdeps/generic/math-use-builtins.h
index e07bba242f..24fba47575 100644
--- a/sysdeps/generic/math-use-builtins.h
+++ b/sysdeps/generic/math-use-builtins.h
@@ -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 */
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-12-06 17:58 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-06 17:58 [glibc/azanella/hypot-refactor] math: Add math-use-builtinds-fmin.h Adhemerval Zanella
-- strict thread matches above, loose matches on Subject: below --
2021-12-01 17:09 Adhemerval Zanella
2021-12-01 16:46 Adhemerval Zanella
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).