mailing list of musl libc
 help / color / mirror / code / Atom feed
From: David Edelsohn <dje.gcc@gmail.com>
To: musl@lists.openwall.com
Subject: Re: [PATCH] powerpc64le: Add single instruction math functions
Date: Fri, 23 Jun 2017 23:05:08 -0400	[thread overview]
Message-ID: <CAGWvnykcRhDJ7gyRADxAE2-F7ww5oifrUhvFS3=g69U7kaZ5=A@mail.gmail.com> (raw)
In-Reply-To: <594DB66E.7030009@adelielinux.org>

Note that I only added the optimizations to the "powerpc64" port, not
the "powerpc" port.  The powerpc64 port only support PPC64LE Linux,
which does not include PPC970.  The comments about emulation are not
relevant to the "powerpc64" port.

If someone wants to copy the support to "powerpc" and add the
additional tests, that's fine.

Thanks, David


On Fri, Jun 23, 2017 at 8:46 PM, A. Wilcox <awilfox@adelielinux.org> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
>
> On 23/06/17 14:53, David Edelsohn wrote:
>> On Fri, Jun 23, 2017 at 3:35 PM, Rich Felker <dalias@libc.org>
>> wrote:
>>> On Wed, Jun 21, 2017 at 10:53:13AM -0400, David Edelsohn wrote:
>>>> The following two patches are a start at single instruction
>>>> math functions for PowerPC64 architecture.  Although PPC64LE
>>>> Linux and ELFv2 ABI require Power8 as the minimum
>>>> architecture, I have added guards that fallback to C code for
>>>> earlier architectures.
>>>
>>> Indeed, musl uses the ELFv2 ABI (minus its gratuitous mandate of
>>>  minimum ISA level) for both little and big endian powerpc64,
>>> and I think we have users of both (people running it on old
>>> powerbooks, etc.).
>>>
>>> Am I reading correctly that sqrt, fma, and fabs are available
>>> even in the lowest powerpc64 ISA, and don't need preprocessor
>>> conditionals?
>>
>> fabs and fma are part of the base ISA for Power processors that
>> include floating point support.  fsqrt originally was optional
>> feature in the distant past (General Purpose group of optional
>> instructions), but is required in the ISA for Power processors.
>>
>> Thanks, David
>>
>
> Chiming in as one of the heavy users/developers involved with musl/ppc.
>
> I can confirm FSQRT exists on the oldest PPC64 chip I have - a 970FX
> from 2003 - but it is indeed optional. (I didn't bother checking the
> actual IBM chips because they're all on the higher end.) The Linux
> kernel actually has support for emulating the instruction on PowerPC
> chips where it wasn't implemented. See arch/powerpc/math-emu/fsqrt.c
> in the kernel tree.
>
> It depends on CONFIG_MATH_EMULATION_HW_UNIMPLEMENTED (or
> CONFIG_MATH_EMULATION_FULL), but most (all?) distros that ship PPC
> kernels have that knob turned on, as far as I can tell.
>
> So this should be safe. The worst case scenario is that distros would
> need to twiddle a config knob in the kernel.
>
> All the best,
> - --arw
>
> - --
> A. Wilcox (awilfox)
> Project Lead, Adélie Linux
> http://adelielinux.org
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v2
>
> iQIcBAEBCAAGBQJZTbZrAAoJEMspy1GSK50UPQIQAJS//JXGNUSjHtlOsK2ngxTz
> 0lOFPDSMTJHmTTXVGJIfoM/Rw0NtAKO6I9+eBbi08eN+Bmh6swRDK+/WQeIft8xx
> Ayyi0fCNFhrEFLCc/M+SE5cwSym2gD7o0XyjNGhi5OM4rqOCybHUzTk5KW2Yxoyr
> MUG7tqFgXCX8LOkWauGDkAmr9A6NjCN6GZazR7ubrsqId7KRxPGUtZRNZhfl+/cQ
> sR5TcTF1yy1Ify6D0wyHIJlIdQPE65i+L+lAr9FGQSNl/NdOQA56hRiijCLwhMNJ
> GNSGS6xPMWX0I7bV/gas15CRmJZyNC5sc+5Gm61/wToHgsclYVWJNJ52NXfSEWCA
> LzEBfZ+6xoZgKQqBDumGEPSRoaRp8sYTTv5mgmlMBs76mOvjyd8j1p9gYrfzFoPx
> Th1EX/CAlgUq84f2Nx1MyDq47ukeJKjWEGfsJe3+yUHYYpENYIKYgvKfx01UGkqR
> vx7Cshtz6zjhadruxWAkQ3oqEJwJOfbBXKCITUMuUxFLHK47Ij4yJ/VZaAwiasLn
> 9zcTEtsq+Iu4xj/drNNPzVm2KbHTDfcKaQynowvuOx9KgyOpv+UprDXr2Koi5SCD
> 5+jS26QzcflGOF6WLvY+pKbDO3l1GPRHc57MhPcjJVVdYWE2NoVbcq+BhYw9ljTq
> KIiCkOVyagFRViWyrzvO
> =eogy
> -----END PGP SIGNATURE-----


  parent reply	other threads:[~2017-06-24  3:05 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-21 14:53 David Edelsohn
2017-06-23 19:35 ` Rich Felker
2017-06-23 19:53   ` David Edelsohn
2017-06-24  0:46     ` A. Wilcox
2017-06-24  0:55       ` Rich Felker
2017-06-24  3:05       ` David Edelsohn [this message]
2017-06-24  3:32         ` Rich Felker
2017-06-24  3:38         ` A. Wilcox
2017-06-24 20:53           ` David Edelsohn
2017-06-24 22:44             ` Rich Felker
2017-06-24 23:57             ` A. Wilcox
2017-06-25  0:10               ` Rich Felker
2017-06-25  1:41                 ` Rich Felker
2017-06-29 13:49                 ` David Edelsohn
2017-06-29 16:05                   ` Rich Felker
2017-06-29 17:00                     ` David Edelsohn
2017-06-29 17:59                       ` Rich Felker
2017-06-30  1:07                         ` David Edelsohn
2017-06-30  2:11                           ` Rich Felker
2017-06-25  3:24               ` David Edelsohn
2017-06-25 14:28                 ` Rich Felker
2017-06-25 14:56                   ` David Edelsohn
2018-09-27 22:53                   ` A. Wilcox

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='CAGWvnykcRhDJ7gyRADxAE2-F7ww5oifrUhvFS3=g69U7kaZ5=A@mail.gmail.com' \
    --to=dje.gcc@gmail.com \
    --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).