mailing list of musl libc
 help / color / mirror / code / Atom feed
* [PATCH] s390x: Add single instruction math functions
@ 2017-06-09 14:51 David Edelsohn
  2017-06-10 15:36 ` Szabolcs Nagy
  0 siblings, 1 reply; 34+ messages in thread
From: David Edelsohn @ 2017-06-09 14:51 UTC (permalink / raw)
  To: musl

The following patch is a start at single instruction math functions
for s390x architecture to increase performance.

Thanks, David
---
 src/math/s390x/ceil.c       | 7 +++++++
 src/math/s390x/ceilf.c      | 7 +++++++
 src/math/s390x/ceill.c      | 7 +++++++
 src/math/s390x/fabs.c       | 7 +++++++
 src/math/s390x/fabsf.c      | 7 +++++++
 src/math/s390x/fabsl.c      | 7 +++++++
 src/math/s390x/floor.c      | 7 +++++++
 src/math/s390x/floorf.c     | 7 +++++++
 src/math/s390x/floorl.c     | 7 +++++++
 src/math/s390x/nearbyint.c  | 7 +++++++
 src/math/s390x/nearbyintf.c | 7 +++++++
 src/math/s390x/nearbyintl.c | 7 +++++++
 src/math/s390x/rint.c       | 7 +++++++
 src/math/s390x/rintf.c      | 7 +++++++
 src/math/s390x/rintl.c      | 7 +++++++
 src/math/s390x/round.c      | 7 +++++++
 src/math/s390x/roundf.c     | 7 +++++++
 src/math/s390x/roundl.c     | 7 +++++++
 src/math/s390x/sqrt.c       | 7 +++++++
 src/math/s390x/sqrtf.c      | 7 +++++++
 src/math/s390x/sqrtl.c      | 7 +++++++
 src/math/s390x/trunc.c      | 7 +++++++
 src/math/s390x/truncf.c     | 7 +++++++
 src/math/s390x/truncl.c     | 7 +++++++
 24 files changed, 168 insertions(+)
 create mode 100644 src/math/s390x/ceil.c
 create mode 100644 src/math/s390x/ceilf.c
 create mode 100644 src/math/s390x/ceill.c
 create mode 100644 src/math/s390x/fabs.c
 create mode 100644 src/math/s390x/fabsf.c
 create mode 100644 src/math/s390x/fabsl.c
 create mode 100644 src/math/s390x/floor.c
 create mode 100644 src/math/s390x/floorf.c
 create mode 100644 src/math/s390x/floorl.c
 create mode 100644 src/math/s390x/nearbyint.c
 create mode 100644 src/math/s390x/nearbyintf.c
 create mode 100644 src/math/s390x/nearbyintl.c
 create mode 100644 src/math/s390x/rint.c
 create mode 100644 src/math/s390x/rintf.c
 create mode 100644 src/math/s390x/rintl.c
 create mode 100644 src/math/s390x/round.c
 create mode 100644 src/math/s390x/roundf.c
 create mode 100644 src/math/s390x/roundl.c
 create mode 100644 src/math/s390x/sqrt.c
 create mode 100644 src/math/s390x/sqrtf.c
 create mode 100644 src/math/s390x/sqrtl.c
 create mode 100644 src/math/s390x/trunc.c
 create mode 100644 src/math/s390x/truncf.c
 create mode 100644 src/math/s390x/truncl.c

diff --git a/src/math/s390x/ceil.c b/src/math/s390x/ceil.c
new file mode 100644
index 0000000..2d0b422
--- /dev/null
+++ b/src/math/s390x/ceil.c
@@ -0,0 +1,7 @@
+#include <math.h>
+
+double ceil(double x)
+{
+ __asm__ ("fidbra %0, 6, %1, 4" : "=f"(x) : "f"(x));
+ return x;
+}
diff --git a/src/math/s390x/ceilf.c b/src/math/s390x/ceilf.c
new file mode 100644
index 0000000..94260e6
--- /dev/null
+++ b/src/math/s390x/ceilf.c
@@ -0,0 +1,7 @@
+#include <math.h>
+
+float ceilf(float x)
+{
+ __asm__ ("fiebra %0, 6, %1, 4" : "=f"(x) : "f"(x));
+ return x;
+}
diff --git a/src/math/s390x/ceill.c b/src/math/s390x/ceill.c
new file mode 100644
index 0000000..2ee4a5b
--- /dev/null
+++ b/src/math/s390x/ceill.c
@@ -0,0 +1,7 @@
+#include <math.h>
+
+long double ceill(long double x)
+{
+ __asm__ ("fixbra %0, 6, %1, 4" : "=f"(x) : "f"(x));
+ return x;
+}
diff --git a/src/math/s390x/fabs.c b/src/math/s390x/fabs.c
new file mode 100644
index 0000000..0c569a2
--- /dev/null
+++ b/src/math/s390x/fabs.c
@@ -0,0 +1,7 @@
+#include <math.h>
+
+double fabs(double x)
+{
+ __asm__ ("lpdbr %0, %1" : "=f"(x) : "f"(x));
+ return x;
+}
diff --git a/src/math/s390x/fabsf.c b/src/math/s390x/fabsf.c
new file mode 100644
index 0000000..99f884c
--- /dev/null
+++ b/src/math/s390x/fabsf.c
@@ -0,0 +1,7 @@
+#include <math.h>
+
+float fabsf(float x)
+{
+ __asm__ ("lpebr %0, %1" : "=f"(x) : "f"(x));
+ return x;
+}
diff --git a/src/math/s390x/fabsl.c b/src/math/s390x/fabsl.c
new file mode 100644
index 0000000..f543ef0
--- /dev/null
+++ b/src/math/s390x/fabsl.c
@@ -0,0 +1,7 @@
+#include <math.h>
+
+long double fabsl(long double x)
+{
+ __asm__ ("lpxbr %0, %1" : "=f"(x) : "f"(x));
+ return x;
+}
diff --git a/src/math/s390x/floor.c b/src/math/s390x/floor.c
new file mode 100644
index 0000000..d4958eb
--- /dev/null
+++ b/src/math/s390x/floor.c
@@ -0,0 +1,7 @@
+#include <math.h>
+
+double floor(double x)
+{
+ __asm__ ("fidbra %0, 7, %1, 4" : "=f"(x) : "f"(x));
+ return x;
+}
diff --git a/src/math/s390x/floorf.c b/src/math/s390x/floorf.c
new file mode 100644
index 0000000..af06471
--- /dev/null
+++ b/src/math/s390x/floorf.c
@@ -0,0 +1,7 @@
+#include <math.h>
+
+float floorf(float x)
+{
+ __asm__ ("fiebra %0, 7, %1, 4" : "=f"(x) : "f"(x));
+ return x;
+}
diff --git a/src/math/s390x/floorl.c b/src/math/s390x/floorl.c
new file mode 100644
index 0000000..0df4be1
--- /dev/null
+++ b/src/math/s390x/floorl.c
@@ -0,0 +1,7 @@
+#include <math.h>
+
+long double floorl(long double x)
+{
+ __asm__ ("fixbra %0, 7, %1, 4" : "=f"(x) : "f"(x));
+ return x;
+}
diff --git a/src/math/s390x/nearbyint.c b/src/math/s390x/nearbyint.c
new file mode 100644
index 0000000..0d3359f
--- /dev/null
+++ b/src/math/s390x/nearbyint.c
@@ -0,0 +1,7 @@
+#include <math.h>
+
+double nearbyint(double x)
+{
+ __asm__ ("fidbra %0, 0, %1, 4" : "=f"(x) : "f"(x));
+ return x;
+}
diff --git a/src/math/s390x/nearbyintf.c b/src/math/s390x/nearbyintf.c
new file mode 100644
index 0000000..3ad8695
--- /dev/null
+++ b/src/math/s390x/nearbyintf.c
@@ -0,0 +1,7 @@
+#include <math.h>
+
+float nearbyintf(float x)
+{
+ __asm__ ("fiebra %0, 0, %1, 4" : "=f"(x) : "f"(x));
+ return x;
+}
diff --git a/src/math/s390x/nearbyintl.c b/src/math/s390x/nearbyintl.c
new file mode 100644
index 0000000..9d900f9
--- /dev/null
+++ b/src/math/s390x/nearbyintl.c
@@ -0,0 +1,7 @@
+#include <math.h>
+
+long double nearbyintl(long double x)
+{
+ __asm__ ("fixbra %0, 0, %1, 4" : "=f"(x) : "f"(x));
+ return x;
+}
diff --git a/src/math/s390x/rint.c b/src/math/s390x/rint.c
new file mode 100644
index 0000000..bdd62b3
--- /dev/null
+++ b/src/math/s390x/rint.c
@@ -0,0 +1,7 @@
+#include <math.h>
+
+double rint(double x)
+{
+ __asm__ ("fidbr %0, 0, %1" : "=f"(x) : "f"(x));
+ return x;
+}
diff --git a/src/math/s390x/rintf.c b/src/math/s390x/rintf.c
new file mode 100644
index 0000000..c1e98c5
--- /dev/null
+++ b/src/math/s390x/rintf.c
@@ -0,0 +1,7 @@
+#include <math.h>
+
+float rintf(float x)
+{
+ __asm__ ("fiebr %0, 0, %1" : "=f"(x) : "f"(x));
+ return x;
+}
diff --git a/src/math/s390x/rintl.c b/src/math/s390x/rintl.c
new file mode 100644
index 0000000..4856825
--- /dev/null
+++ b/src/math/s390x/rintl.c
@@ -0,0 +1,7 @@
+#include <math.h>
+
+long double rintl(long double x)
+{
+ __asm__ ("fixbr %0, 0, %1" : "=f"(x) : "f"(x));
+ return x;
+}
diff --git a/src/math/s390x/round.c b/src/math/s390x/round.c
new file mode 100644
index 0000000..10b3159
--- /dev/null
+++ b/src/math/s390x/round.c
@@ -0,0 +1,7 @@
+#include <math.h>
+
+double round(double x)
+{
+ __asm__ ("fidbra %0, 1, %1, 4" : "=f"(x) : "f"(x));
+ return x;
+}
diff --git a/src/math/s390x/roundf.c b/src/math/s390x/roundf.c
new file mode 100644
index 0000000..28758ce
--- /dev/null
+++ b/src/math/s390x/roundf.c
@@ -0,0 +1,7 @@
+#include <math.h>
+
+float roundf(float x)
+{
+ __asm__ ("fiebra %0, 1, %1, 4" : "=f"(x) : "f"(x));
+ return x;
+}
diff --git a/src/math/s390x/roundl.c b/src/math/s390x/roundl.c
new file mode 100644
index 0000000..deef38e
--- /dev/null
+++ b/src/math/s390x/roundl.c
@@ -0,0 +1,7 @@
+#include <math.h>
+
+long double roundl(long double x)
+{
+ __asm__ ("fixbra %0, 1, %1, 4" : "=f"(x) : "f"(x));
+ return x;
+}
diff --git a/src/math/s390x/sqrt.c b/src/math/s390x/sqrt.c
new file mode 100644
index 0000000..7407a5c
--- /dev/null
+++ b/src/math/s390x/sqrt.c
@@ -0,0 +1,7 @@
+#include <math.h>
+
+double sqrt(double x)
+{
+ __asm__ ("sqdbr %0, %1" : "=f"(x) : "f"(x));
+ return x;
+}
diff --git a/src/math/s390x/sqrtf.c b/src/math/s390x/sqrtf.c
new file mode 100644
index 0000000..fbfdf6a
--- /dev/null
+++ b/src/math/s390x/sqrtf.c
@@ -0,0 +1,7 @@
+#include <math.h>
+
+float sqrtf(float x)
+{
+ __asm__ ("sqebr %0, %1" : "=f"(x) : "f"(x));
+ return x;
+}
diff --git a/src/math/s390x/sqrtl.c b/src/math/s390x/sqrtl.c
new file mode 100644
index 0000000..9b14d67
--- /dev/null
+++ b/src/math/s390x/sqrtl.c
@@ -0,0 +1,7 @@
+#include <math.h>
+
+long double sqrtl(long double x)
+{
+ __asm__ ("sqxbr %0, %1" : "=f"(x) : "f"(x));
+ return x;
+}
diff --git a/src/math/s390x/trunc.c b/src/math/s390x/trunc.c
new file mode 100644
index 0000000..24d9ed7
--- /dev/null
+++ b/src/math/s390x/trunc.c
@@ -0,0 +1,7 @@
+#include <math.h>
+
+double trunc(double x)
+{
+ __asm__ ("fidbra %0, 5, %1, 4" : "=f"(x) : "f"(x));
+ return x;
+}
diff --git a/src/math/s390x/truncf.c b/src/math/s390x/truncf.c
new file mode 100644
index 0000000..a59e52a
--- /dev/null
+++ b/src/math/s390x/truncf.c
@@ -0,0 +1,7 @@
+#include <math.h>
+
+float truncf(float x)
+{
+ __asm__ ("fiebra %0, 5, %1, 4" : "=f"(x) : "f"(x));
+ return x;
+}
diff --git a/src/math/s390x/truncl.c b/src/math/s390x/truncl.c
new file mode 100644
index 0000000..98afa2d
--- /dev/null
+++ b/src/math/s390x/truncl.c
@@ -0,0 +1,7 @@
+#include <math.h>
+
+long double truncl(long double x)
+{
+ __asm__ ("fixbra %0, 5, %1, 4" : "=f"(x) : "f"(x));
+ return x;
+}
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 34+ messages in thread

end of thread, other threads:[~2017-06-23 19:31 UTC | newest]

Thread overview: 34+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-09 14:51 [PATCH] s390x: Add single instruction math functions David Edelsohn
2017-06-10 15:36 ` Szabolcs Nagy
2017-06-10 17:25   ` David Edelsohn
2017-06-10 18:29     ` Szabolcs Nagy
2017-06-10 18:53       ` David Edelsohn
2017-06-10 19:48         ` Rich Felker
2017-06-10 20:22           ` David Edelsohn
2017-06-10 21:28             ` Szabolcs Nagy
2017-06-10 21:44               ` David Edelsohn
2017-06-10 21:48                 ` David Edelsohn
2017-06-11  2:20                   ` Rich Felker
2017-06-11 10:19                     ` Szabolcs Nagy
2017-06-11 15:04                       ` Rich Felker
2017-06-11 16:45                         ` Szabolcs Nagy
2017-06-11 21:45                           ` Rich Felker
2017-06-12  2:46                       ` David Edelsohn
2017-06-12  4:36                         ` Tuan M. Hoang
2017-06-12  9:03                         ` Szabolcs Nagy
2017-06-12 13:28                           ` David Edelsohn
2017-06-12 13:54                             ` David Edelsohn
2017-06-12 20:28                               ` Szabolcs Nagy
2017-06-12 21:02                                 ` David Edelsohn
2017-06-13 15:55                                   ` Szabolcs Nagy
2017-06-14 23:34                                     ` Rich Felker
2017-06-14 23:40                                       ` A. Wilcox
2017-06-14 23:44                             ` Rich Felker
2017-06-15 12:18                               ` David Edelsohn
2017-06-18 17:12                               ` David Edelsohn
2017-06-21  0:49                                 ` Rich Felker
2017-06-21  1:07                                   ` David Edelsohn
2017-06-21  1:20                                     ` Rich Felker
2017-06-21  3:34                                       ` David Edelsohn
2017-06-23 19:31                                         ` Rich Felker
2017-06-10 21:37             ` Rich Felker

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

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 NNTP newsgroup(s).