<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/110894>110894</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [llvm-libc] support for 96b long double (i386)
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            libc
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          nickdesaulniers
      </td>
    </tr>
</table>

<pre>
    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 
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzkl11r3DgXxz-N5ubQQZZn_HIxF_MSQ6CUgabw3BlZPrbVaiQ_kpw2vdjPvkieTCZtlmbZDRTWhMG2nPPy-x8dH3PnZK8RN2S9I-vDgk9-MHajpfjSouOT0hKtWzSmfdg0k1St1D0odX96p2QjoDMWZFpk0HGpHHgD8SGQGvyAMFqpfQfCtEjSHUgPDvHkwA_cA8mok9_RdIQVyugeWjM1CgkrSUbB6NmwdOHBhJGMLgHwGz-NCkm6JfRA6JZk9PwXL281dFIhSC3U1GILnTUnIKziurVGtpSwKgY_WvMZhQ-XshGEVc7GX99KQ1g1x10LY5GwShh9j9ajXYpxJOm2vLh_a38DSbdJ-ubuLNbO20l4N3vMnvi-2nZdu2kcjQ0L1fGTlyqe7OTZaMFWJN2uGUm3gNYaG060gRP3YghF1U1aeGl0rCnBlQrVRFjeSF8L7jxh-RwTQMFWQPI9ALy_3e3r2w_vbz_cgDDaefw2WriDHn19zxVhBWHlvAIk34FFP1kNs44k3V6Mp_s7kt4QVnw6XlZcKMV0ByQ_PHoOR_BM1jd_PD_-Lq-XteiU4b5uUdTPi2BNA7hVPkPzYQOEPSa181x7ySM408EJTw3aJ5aE5XUdwqiD8zopa1rTupd-TrIbpyBUPJ-1Iun-ei-mN_PihWcOFv8_ofPYwoAWH8GsKTtLUoUU7sxHb6Xuz1xhzuuSE2HFfCdQXj4Ta2Z-NntG_bZskyQWfLL6FdwLV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