[libc-commits] [libc] [libc][i386] FPBit support for 96b long double (PR #115084)
Nick Desaulniers via libc-commits
libc-commits at lists.llvm.org
Mon Nov 11 12:01:12 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
----------------
nickdesaulniers wrote:
As in:
```diff
diff --git a/libc/src/__support/FPUtil/FPBits.h b/libc/src/__support/FPUtil/FPBits.h
index 2994febff2f8..98e7eef90d43 100644
--- a/libc/src/__support/FPUtil/FPBits.h
+++ b/libc/src/__support/FPUtil/FPBits.h
@@ -127,7 +127,7 @@ template <> struct FPLayout<FPType::IEEE754_Binary128> {
};
template <> struct FPLayout<FPType::X86_Binary80> {
-#if __SIZEOF_LONG_DOUBLE__ == 16
+#if __SIZEOF_LONG_DOUBLE__ == 16 || __SIZEOF_LONG_DOUBLE__ == 8
using StorageType = UInt128;
#else
using StorageType = UInt<__SIZEOF_LONG_DOUBLE__ * CHAR_BIT>;
```
I can build android (`-DLIBC_TARGET_TRIPLE=i386-linux-android`) fine with that change.
https://github.com/llvm/llvm-project/pull/115084
More information about the libc-commits
mailing list