Re: [PATCH 0/3] ARM with only 32-bit floats do not have fast 64-bit FMA

Keith Packard via Newlib <[email protected]>
Newsgroups gmane.comp.lib.newlib
Message-ID <[email protected]>
Sebastian Huber <[email protected]> writes:

> I think the problem is somewhere in the build system:
>
> find -name s_fma.c
> ./newlib/libm/machine/arm/s_fma.c
> ./newlib/libm/machine/aarch64/s_fma.c
> ./newlib/libm/machine/riscv/s_fma.c
> ./newlib/libm/machine/spu/s_fma.c
> ./newlib/libm/common/s_fma.c
>
> I guess the machine-specific file overrides the common file. If the 
> machine-specific file is empty due to pre-processor magic, then the 
> default implementation is still not present.

newlib shouldn't be calling fma if the underlying hardware support isn't
present -- fma is used in some math functions to improve performance
where the code can take full advantage of the additional precision of
the intermediate value.

Are you using fma directly? If your hardware supports it, the C compiler
should be directly emitting the relevant instruction sequence so you
shouldn't be seeing an undefined function appear.

If not, then one of the two versions of fma should be getting compiled
as they have opposite tests -- newlib/libm/machine/arm/s_fma.c checks
for '#if HAVE_FAST_FMA' while newlib/libm/common/s_fma.c checks for
'#if !HAVE_FAST_FMA'.

I recently did some work in this area, so it's possible I broke
something in your environment that I didn't catch in mine; I don't test
newlib builds, only downstream picolibc builds.

-- 
-keith
signature.asc (application/pgp-signature, 832 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEw4O3eCVWE9/bQJ2R2yIaaQAAABEFAl9OoNIACgkQ2yIaaQAA
ABHltw//bFrAHJ+wSTKOENYCH1UaIkAsPmSd3FgjGAs5/8RQNmXKkq1lkAVlgvLI
3WnQhF/OyqQkmrS/jU0iA8yz+BtDbe8mo3hM//m3mGz6kmmLMmjlJ5QRDr5HrYKZ
id1n6K1AQmNqMR+1MgDwR/i63GwQu8w9KdNpnMktLqG72ktTn00+xXoc3JPedMXF
zQLLNTcZZR6TNH7QfXYNu6+MSdRcnP+KRRvRRY3QIkM3HVjsoQAzm07bIGQuZJCC
J9CvD3LuSErKkKfOC4MrPoiZGyyyK482h4dVHhgvvGQ95xHBS972IZjRZ4yrjSlI
A/JyKe6MSnP94u7rmBZVDnRU7NMhTZ3UMG4S8HwwWav+ONQ6+OsSSSzT85Y3I6z+
FVLHFVVZVSSUz9Wg9iDhRU60qNUtgWuHhiVSoP1nTQC+Uq9YWEOEdrMY8dfV4hSs
TNBb3peBYI9PzQsJ/+5ITQKpLpoJzr3woDkGn2bL0Y342O7FYoNiq8AbeytxhikY
pnZMxfPYI0OPj7ws/vFIbT2tBOum+MFSNQ4aC2MJySjYJZDdnHOH9b9SufUpT9q3
xwd6+j1qjLzs675Y/jKe9+k8XzvWe7/ZB6VqBlX33ULwPN0DGqQdoQZIgErQ2MTK
Iwotzq22MisKgWi1lOD0QbNC3wcWqSsjjKlpxRIOHBD5LCPgdY0=
=V/ab
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.