mailing list of musl libc
 help / color / Atom feed
* More additions for the math/i386 subtree
@ 2019-12-10 21:48 Stefan Kanthak
  0 siblings, 0 replies; only message in thread
From: Stefan Kanthak @ 2019-12-10 21:48 UTC (permalink / raw)
  To: musl

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



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, back to index

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-10 21:48 More additions for the math/i386 subtree Stefan Kanthak

mailing list of musl libc

Archives are clonable: git clone --mirror http://inbox.vuxu.org/musl

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.musl


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git