Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20191211094800.GJ23985@port70.net>
Date: Wed, 11 Dec 2019 10:48:00 +0100
From: Szabolcs Nagy <nsz@...t70.net>
To: Stefan Kanthak <stefan.kanthak@...go.de>
Cc: musl@...ts.openwall.com
Subject: Re: An addition to the math subtree

* Stefan Kanthak <stefan.kanthak@...go.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

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.