Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <2DBF29D377CC4516BCB01E382C0EEF31@H270>
Date: Tue, 10 Dec 2019 22:48:18 +0100
From: "Stefan Kanthak" <stefan.kanthak@...go.de>
To: <musl@...ts.openwall.com>
Subject: More additions for the math/i386 subtree

Optimised branch-free implementations of fmax() and fmin() for i386

JFTR: I'm NOT subscribed to your mailing list, so CC: me in replies!

--- -/dev/null
+++ +/src/math/i386/fmax.S
@@ -0,0 +1,26 @@
+.global fmaxf
+.type fmaxf,@function
+fmaxf:
+        flds 4(%esp)
+        flds 8(%esp)
+        jmp 1f
+
+.global fmaxl
+.type fmaxl,@function
+fmaxl:
+        fldt 4(%esp)
+        fldt 16(%esp)
+        jmp 1f
+
+.global fmax
+.type fmax,@function
+fmax:
+        fldl 4(%esp)
+        fldl 12(%esp)
+1:      fucomi %st(0),%st(0)
+        fcmovu %st(1),%st(0)
+        fxch %st(1)
+        fucomi %st(1),%st(0)
+        fcmovu %st(1),%st(0)
+        fstp %st(1)
+        ret

--- -/dev/null
+++ +/src/math/i386/fmin.S
@@ -0,0 +1,26 @@
+.global fminf
+.type fminf,@function
+fminf:
+        flds 4(%esp)
+        flds 8(%esp)
+        jmp 1f
+
+.global fminl
+.type fminl,@function
+fminl:
+        fldt 4(%esp)
+        fldt 16(%esp)
+        jmp 1f
+
+.global fmin
+.type fmin,@function
+fmin:
+        fldl 4(%esp)
+        fldl 12(%esp)
+1:      fucomi %st(0),%st(0)
+        fcmovu %st(1),%st(0)
+        fucomi %st(1),%st(0)
+        fcmovu %st(1),%st(0)
+        fstp %st(1)
+        ret

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.