mailing list of musl libc
 help / color / mirror / code / Atom feed
From: "Stefan Kanthak" <stefan.kanthak@nexgo.de>
To: <musl@lists.openwall.com>
Subject: More additions for the math/i386 subtree
Date: Tue, 10 Dec 2019 22:48:18 +0100	[thread overview]
Message-ID: <2DBF29D377CC4516BCB01E382C0EEF31@H270> (raw)

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



                 reply	other threads:[~2019-12-10 21:48 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2DBF29D377CC4516BCB01E382C0EEF31@H270 \
    --to=stefan.kanthak@nexgo.de \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).