On 1/18/2017 5:14 AM, lhmouse wrote:
> Patch is attached.

I see that you have replaced the x86 parts for fma and fmaf with C 
code.  That seems like a good thing.  Is there some reason you can't do 
that with the ARM versions too?

Reducing the amount of platform-specific code also seems like a good thing.

> This patch removes assembly files that implement FMA on ARM and merges
> them into the corresponding C files with the same name using inline assembly.

Umm.  Hmm.

There are a number of reasons not to use inline asm (for example 
https://gcc.gnu.org/wiki/DontUseInlineAsm ).  Are you sure this is a 
good idea?

> I don't have any knowledge about ARM assembly. Those functions for ARM
> were created using my x86 assembly knowledge and the actual instructions
> are copy-n-paste'd from old .S files. I don't have an ARM compiler to test
> those functions. Please fix them should they be broken.

Yup, that's one of the downsides to using inline asm.

I'm no ARM expert, but I'm not sure about this ARM code for fmal:

+long double fmal(long double x, long double y, long double z){
+  __asm__ (
+    "fmacd %2, %0, %1 \n"
+    "fcpyd %0, %2 \n"
+    : "+&w"(z)
+    : "w"(x), "w"(y)
+  );

Doesn't fmacd modify %2?  That would be (y), which is listed as an input 
parameter (and therefore is read-only).  What's more, I thought fmacd 
was calculating "Fd + Fn * Fm" where the parameters were "fmacd Fd, Fn, 
Fm".  Such being the case, I would have expected "fmacd %0, %1 %2"?  I 
don't have a way to run this either, but this looks wrong.

Under the nit-picky heading:

+double fma(double x, double y, double z){
+  __asm__ (
+    "fmacd %0, %1, %2 \n"
+    : "+&w"(z)
+    : "w"(x), "w"(y)
+  );

The \n is redundant.  And doesn't the + make the & redundant as well?

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

The \n is redundant.  And doesn't the + make the & redundant as well?

Lastly I gotta ask: Can we use __builtin_fmal?  Or is mingw-w64 the one 
providing the implementations for these?

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