mailing list of musl libc
 help / color / mirror / code / Atom feed
* An addition to the math subtree
@ 2019-12-10 16:58 Stefan Kanthak
  2019-12-11  9:48 ` Szabolcs Nagy
  0 siblings, 1 reply; 2+ messages in thread
From: Stefan Kanthak @ 2019-12-10 16:58 UTC (permalink / raw)
  To: musl

Optimised implementations of copysign() for i386

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

--- -/dev/null
+++ +/src/math/i386/copysign.S
@@ -0,0 +1,26 @@
+.global copysignf
+.type copysignf,@function
+copysignf:
+        shlb $1,4+3(%esp)
+        shlb $1,8+3(%esp)
+        rcrb $1,4+3(%esp)
+        flds 4(%esp)
+        ret
+
+.global copysignl
+.type copysignl,@function
+copysignl:
+        shlb $1,4+9(%esp)
+        shlb $1,16+9(%esp)
+        rcrb $1,4+9(%esp)
+        fldt 4(%esp)
+        ret
+
+.global copysign
+.type copysign,@function
+copysign:
+        shlb $1,4+7(%esp)
+        shlb $1,12+7(%esp)
+        rcrb $1,4+7(%esp)
+        fldl 4(%esp)
+        ret



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: An addition to the math subtree
  2019-12-10 16:58 An addition to the math subtree Stefan Kanthak
@ 2019-12-11  9:48 ` Szabolcs Nagy
  0 siblings, 0 replies; 2+ messages in thread
From: Szabolcs Nagy @ 2019-12-11  9:48 UTC (permalink / raw)
  To: Stefan Kanthak; +Cc: musl

* Stefan Kanthak <stefan.kanthak@nexgo.de> [2019-12-10 17:58:40 +0100]:
> Optimised implementations of copysign() for i386

note that in most user code gcc would inline
copysign calls instead of calling into libc.

when it is a call into libc then it wont be
fast no matter what because of the call overhead
(spilling registers).

so libc copysign is not performance critical
(except currently musl code itself calls it
but that can be fixed)

i386 asm is also not very interesting (it introduces
maintenance burden and not many users care about it)

> 
> JFTR: I'm NOT subscribed to your mailing list, so CC: me in replies!
> 
> --- -/dev/null
> +++ +/src/math/i386/copysign.S
> @@ -0,0 +1,26 @@
> +.global copysignf
> +.type copysignf,@function
> +copysignf:
> +        shlb $1,4+3(%esp)
> +        shlb $1,8+3(%esp)
> +        rcrb $1,4+3(%esp)
> +        flds 4(%esp)
> +        ret
> +
> +.global copysignl
> +.type copysignl,@function
> +copysignl:
> +        shlb $1,4+9(%esp)
> +        shlb $1,16+9(%esp)
> +        rcrb $1,4+9(%esp)
> +        fldt 4(%esp)
> +        ret
> +
> +.global copysign
> +.type copysign,@function
> +copysign:
> +        shlb $1,4+7(%esp)
> +        shlb $1,12+7(%esp)
> +        rcrb $1,4+7(%esp)
> +        fldl 4(%esp)
> +        ret


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-12-11  9:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-10 16:58 An addition to the math subtree Stefan Kanthak
2019-12-11  9:48 ` Szabolcs Nagy

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).