Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAGWvnynPNVY6Xgz8+S=wOtQuXFis=4eH1-523d=PvtnRbSGCUg@mail.gmail.com>
Date: Fri, 9 Jun 2017 10:51:25 -0400
From: David Edelsohn <dje.gcc@...il.com>
To: musl@...ts.openwall.com
Subject: [PATCH] s390x: Add single instruction math functions

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

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.