tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

compiler_rt missing support for 80-bit floats?



Hi,

while trying to compile libuhd on NetBSD, I stumbled upon an undefined
reference to __trunctfxf2 at link time of the first example program.

This function truncates a 128bit float to 80 bits. Digging around, I
found out that we have three implementations of the softfloat emulation
in the tree. The one given with gcc is not used.

This leaves us with src/lib/libc/softfloat which seems to lack the alias
required for this function. I enclose a patch which adds it there but I
don't know if it's still used on any platform, probably depends on the
gcc version being used. It's clearly not used on amd64, even on the
netbsd-7 branch.

So, the implementation we currently use is provided by compiler_rt in
src/sys/external/bsd/compiler_rt/dist/lib/builtins but also lacks the
implementation of this function.

Could someone with experience on floating point and/or compiler_rt
please tell if it's a simple matter of adding the 80-bit case to
fp_trunc_impl.inc and add stub C files, or if there is a deeper reason
for dropping 80bit support?

Regards,
 Aymeric

(the following patch is for reference only if someone else is interested
 for another platform/gcc combination, I couldn't test it)
--- libc/softfloat/softfloat-for-gcc.h	1 Aug 2013 23:21:19 -0000	1.12
+++ libc/softfloat/softfloat-for-gcc.h	10 Nov 2014 09:55:50 -0000
@@ -116,7 +116,9 @@
 #define float32_to_float128		__extendsftf2
 #define float64_to_floatx80		__extenddfxf2
 #define float64_to_float128		__extenddftf2
+#define floatx80_to_float128		__extendxftf2
 
+#define float128_to_floatx80		__trunctfxf2
 #define float128_to_float64		__trunctfdf2
 #define floatx80_to_float64		__truncxfdf2
 #define float128_to_float32		__trunctfsf2




Home | Main Index | Thread Index | Old Index