Skip to content

[llvm-libc] support for 96b long double (i386) #110894

@nickdesaulniers

Description

@nickdesaulniers

building llvm-libc for i386 fails to build in the printf code; it seems that sizeof(long double) on i386 is 12. example:

In file included from /android0/llvm-project/libc/src/stdio/printf_core/converter.cpp:9:
In file included from /android0/llvm-project/libc/src/stdio/printf_core/converter.h:13:
In file included from /android0/llvm-project/libc/src/stdio/printf_core/core_structs.h:16:
/android0/llvm-project/libc/src/__support/FPUtil/FPBits.h:824:52: error: no matching function for call to 'bit_cast'
  824 |   LIBC_INLINE constexpr T get_val() const { return cpp::bit_cast<T>(UP::bits); }
      |                                                    ^~~~~~~~~~~~~~~~
/android0/llvm-project/libc/src/stdio/printf_core/float_dec_converter.h:502:47: note: in instantiation of member function '__llvm_libc_19_0_0_git::fputil::FPBits<long double>::get_val' requested here
  502 |   FloatToString<T> float_converter(float_bits.get_val());
      |                                               ^
/android0/llvm-project/libc/src/stdio/printf_core/float_dec_converter.h:1116:14: note: in instantiation of function template specialization '__llvm_libc_19_0_0_git::printf_core::convert_float_decimal_typed<long double, 0>' requested here
 1116 |       return convert_float_decimal_typed<long double>(writer, to_conv,
      |              ^
/android0/llvm-project/libc/src/__support/CPP/bit.h:38:1: note: candidate template ignored: substitution failure [with To = long double, From = StorageType]: implicit instantiation of undefined template '__llvm_libc_19_0_0_git::cpp::enable_if<false, long double>'
   38 | bit_cast(const From &from) {
      | ^
/android0/llvm-project/libc/src/__support/big_int.h:1099:1: note: candidate template ignored: substitution failure [with To = long double, From = StorageType]: implicit instantiation of undefined template '__llvm_libc_19_0_0_git::cpp::enable_if<false, long double>'
 1099 | bit_cast(const From &from) {
      | ^
/android0/llvm-project/libc/src/__support/big_int.h:1114:1: note: candidate template ignored: substitution failure [with To = long double, Bits = 128]: implicit instantiation of undefined template '__llvm_libc_19_0_0_git::cpp::enable_if<false, long double>'
 1114 | bit_cast(const UInt<Bits> &from) {
      | ^

perhaps the StorageType for FPLayout<FPType::X86_Binary80> should be a 96b UInt for i386, but that leads to other errors?

Filing a bug to track this, as it's a blocker for i386 support.

cc @michaelrj-google

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions