Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <7b59f86b784cba366df72635f2b38edf2614450f.1693396649.git.quic_mathbern@quicinc.com>
Date: Wed, 30 Aug 2023 09:22:28 -0300
From: Matheus Tavares Bernardino <quic_mathbern@...cinc.com>
To: <musl@...ts.openwall.com>
CC: Brian Cain <bcain@...cinc.com>, Sid Manning <sidneym@...cinc.com>,
        "Rich
 Felker" <dalias@...c.org>, Fangrui Song <i@...kray.me>,
        Szabolcs Nagy
	<nsz@...t70.net>
Subject: [RFC PATCH 3/5] hexagon: add fma/fmaxf/fminf routines

From: Sid Manning <sidneym@...cinc.com>

---
 src/math/hexagon/fmaf.c  | 8 ++++++++
 src/math/hexagon/fmaxf.c | 8 ++++++++
 src/math/hexagon/fminf.c | 8 ++++++++
 3 files changed, 24 insertions(+)
 create mode 100644 src/math/hexagon/fmaf.c
 create mode 100644 src/math/hexagon/fmaxf.c
 create mode 100644 src/math/hexagon/fminf.c

diff --git a/src/math/hexagon/fmaf.c b/src/math/hexagon/fmaf.c
new file mode 100644
index 00000000..7ce1996c
--- /dev/null
+++ b/src/math/hexagon/fmaf.c
@@ -0,0 +1,8 @@
+#include <math.h>
+
+float fmaf(float x, float y, float z)
+{
+	__asm__ ("%[z]+=sfmpy(%[x], %[y])"
+                 : [z]"+r"(z) : [x]"r"(x), [y]"r"(y));
+	return z;
+}
diff --git a/src/math/hexagon/fmaxf.c b/src/math/hexagon/fmaxf.c
new file mode 100644
index 00000000..0dc52b25
--- /dev/null
+++ b/src/math/hexagon/fmaxf.c
@@ -0,0 +1,8 @@
+#include <math.h>
+
+float fmaxf(float x, float y)
+{
+	__asm__ ("%[x]=sfmax(%[x], %[y])"
+                : [x]"+r"(x) : [y]"r"(y));
+	return x;
+}
diff --git a/src/math/hexagon/fminf.c b/src/math/hexagon/fminf.c
new file mode 100644
index 00000000..aeb20ae0
--- /dev/null
+++ b/src/math/hexagon/fminf.c
@@ -0,0 +1,8 @@
+#include <math.h>
+
+float fminf(float x, float y)
+{
+	__asm__ ("%[x]=sfmin(%[x], %[y])"
+                : [x]"+r"(x) : [y]"r"(y));
+	return x;
+}
-- 
2.37.2

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.