[libc-commits] [libc] [libc][i386] FPBit support for 96b long double (PR #115084)
via libc-commits
libc-commits at lists.llvm.org
Mon Nov 11 10:00:06 PST 2024
================
@@ -127,7 +127,18 @@ template <> struct FPLayout<FPType::IEEE754_Binary128> {
};
template <> struct FPLayout<FPType::X86_Binary80> {
+// x86_64
+#if __SIZEOF_LONG_DOUBLE__ == 16
using StorageType = UInt128;
+// i386-linux-gnu
+#elif __SIZEOF_LONG_DOUBLE__ == 12
+ using StorageType = UInt<__SIZEOF_LONG_DOUBLE__ * CHAR_BIT>;
+#else
+// TODO: https://github.com/llvm/llvm-project/issues/115184
+// Android i386 uses `long double == double` i.e. `sizeof(long double) == 8`
+// https://developer.android.com/ndk/guides/abis#x86
----------------
lntue wrote:
Now that thinking more about it, I would like to dictate using `UInt128` for 80-bit floating point whenever `__SIZEOF_LONG_DOUBLE__ != 12`. So that when we emulate 80-bit floating points on targets other than i386, we will always use 128-bit. For Android, Windows, and MacOS where long double is double, it will be taken care of by `LIBC_TYPES_LONG_DOUBLE_IS_DOUBLE`, and so this specialization is not used for `FPBits<long double>`.
https://github.com/llvm/llvm-project/pull/115084
More information about the libc-commits
mailing list