On Sat, 20 Sep 2025, Jon Turney wrote:

> On 13/08/2025 18:33, Jeremy Drake via Cygwin-patches wrote:
> > On Tue, 5 Aug 2025, Thirumalai Nagalingam wrote:
> >
> > > Hi all,
> > >
> > > This patch adds support for the `fsqrt` instruction on AArch64 platforms
> > > in the `__FLT_ABI(sqrt)` implementation.
> >
> > This looks OK as far as it goes, but I have a few thoughts.
> >
> > From the comments, it appears this code originally came from mingw-w64.
> > Their current version of this code has aarch64 implementations.  The
> > difference with this one is they have a version for float as well as
> > double.  The versions here seem to only be used for long double (which on
> > aarch64 is the same as double).
> >
> > Given that long double is the same as double on aarch64, might it make
> > sense to redirect/alias the long double names to the double
> > implementations in the def file (cygwin.din) on aarch64, rather than
> > providing two different implementations (one in newlib for double and one
> > in this cygwin/math directory for long double)?  It seems like that's
> > asking for subtle discrepancies between the implementations.  I'm not
> > seeing any obvious preprocesor-like operations in gendef (mingw-w64 uses
> > cpp to preprocess .def.in => .def files for arch-specific #ifdefs) so
> > maybe this would be more complicated.
>
> Sorry about the long delay looking into this.
>
> So, I was about to apply Thiru's v2 patch, since that all seems reasonable to
> me. But now I'm not so sure...
>
> I think that a good goal is to keep this file aligned with the mingw-w64
> version, if possible.
>
> If I'm understanding correctly, if we do that, this problem goes away, but at
> the cost that fsqrtd and fsqrtl are potentially different (although surely
> since it all boils down to a single instruction, that's never going to happen
> :) )?

Right.  Also, I expect whatever is done will need to be done with all the
rest of the long double functions in winsup/cygwin/math also.  I don't
know if sqrt was intended as an exemplar before moving forward with the
others, or if they really just had issues with this one.

Reply via email to