Re: [PATCH 0/3] ARM with only 32-bit floats do not have fast 64-bit FMA
Sebastian Huber <[email protected]>
| Newsgroups | gmane.comp.lib.newlib |
|---|---|
| Message-ID | <[email protected]> |
On 02/09/2020 01:06, Keith Packard wrote: > Joseph Myers <[email protected]> writes: > >> But note that newlib/libm/common/s_fma.c doesn't actually do anything >> useful; it's not a fused operation. Implementing correct fma in software >> is highly nontrivial, especially when you want to handle exceptions and >> rounding modes correctly (including machine-specific differences in >> whether tininess is detected before or after rounding). > > Should we just stop providing the generic fma/fmaf implementations? That > seems like a good idea to me as it will prevent applications from > getting the wrong answer. > > The fmaf one does offer increased precision by doing the operation in > double instead of float, which is 'different' from doing it in float, > but it still gets a different answer from 'a * b + c'. It also gets the > wrong exception status. Our failing test is pretty basic, it just checks if fma() and fmaf() library functions are present as per C99. The glibc offers also a simple default implementation, for example: https://sourceware.org/git/?p=glibc.git;a=blob;f=math/s_fma.c;h=4d73af4f65d511594b2395d032a135721c578484;hb=HEAD -- Sebastian Huber, embedded brains GmbH Address : Dornierstr. 4, D-82178 Puchheim, Germany Phone : +49 89 189 47 41-16 Fax : +49 89 189 47 41-09 E-Mail : [email protected] PGP : Public key available on request. Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.