So you have decided that __builtins can't be used then?  That's too bad.

I know almost nothing about the guts of floating point, so I'm prepared 
to defer to your judgement, but here's what I think:

Let me propose an alternative for fma.c:

--------

/**
  * This file has no copyright assigned and is placed in the Public Domain.
  * This file is part of the mingw-w64 runtime package.
  * No warranty is given; refer to the file DISCLAIMER.PD within this 
package.
  */
double fma(double x, double y, double z);

long double fmal(long double x, long double y, long double z);

double fma(double x, double y, double z){
   return (double)fmal(x, y, z);
}

--------

In other words, remove all the platform specific code.  This (greatly) 
simplifies this file.  You were already using fmal for x86.  And it 
doesn't lose anything for ARM, since both fma() and fmal() use the exact 
same inline asm.  Why have the exact same (hard to maintain) code in 2 
places?

As for fmaf, what about:

--------

/**
  * This file has no copyright assigned and is placed in the Public Domain.
  * This file is part of the mingw-w64 runtime package.
  * No warranty is given; refer to the file DISCLAIMER.PD within this 
package.
  */
float fmaf(float x, float y, float z);

#if defined(_ARM_) || defined(__arm__)

float fmaf(float x, float y, float z){
   __asm__ (
     "fmacs %0, %1, %2 \n"
     : "+t"(z)
     : "t"(x), "t"(y)
   );
   return z;
}

#else

long double fmal(long double x, long double y, long double z);

float fmaf(float x, float y, float z){
   return (float)fmal(x, y, z);
}

#endif

--------

The case here is less compelling, but I assert that if fmal is 
supported, it can always be used to calculate fmaf.  If there is a 
shorter/more efficient method (such as there is with ARM), it can be 
added here.

As for fmal, I have a question about your code.  Not the implementation, 
but the design.  Looking at https://en.wikipedia.org/wiki/Long_double, 
it says "Microsoft Windows with Visual C++ also sets the processor in 
double-precision mode by default."  Since (it appears?) you aren't 
following _controlfp_s, won't this give use a different answer than fmal 
from msvcr120.dll?

More nits:

s/whecher/whether
s/#x86_Extended_Precision_Format/#x86_extended_precision_format

dw


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to