This is an archive of the discontinued LLVM Phabricator instance.

[builtins] Omit 80-bit builtins on Android and MSVC
ClosedPublic

Authored by rprichard on Jun 19 2020, 12:00 AM.

Details

Summary

long double is a 64-bit double-precision type on:

  • MSVC (32- and 64-bit x86)
  • Android (32-bit x86)

long double is a 128-bit quad-precision type on x86_64 Android.

The assembly variants of the 80-bit builtins are correct, but some of
the builtins are implemented in C and require that long double be the
80-bit type passed via an x87 register.

Diff Detail

Event Timeline

rprichard created this revision.Jun 19 2020, 12:00 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 19 2020, 12:00 AM
Herald added subscribers: Restricted Project, mgorny. · View Herald Transcript

I'm suspicious of divtc3.c (in GENERIC_SOURCES) and multc3.c (in GENERIC_TF_SOURCES). They use the long double type without checking a preprocessor macro to ensure that long double is a 128-bit type. On 32-bit Android and MSVC, the type will be 64 bits, and on host GNU/Linux x86-{32,64}, the type will be 80 bits.

I'm not sure if tf/tc are always supposed to indicate the 128-bit IEEE 754 quad-precision binary128 type. e.g. On PowerPC64, it looks like tf/tc are the 128-bit double-double type instead.

Maybe on x86, though, the convention is that tf/tc is binary128 and xf/xc is 80-bit.

compnerd accepted this revision.Jun 30 2020, 8:36 AM

This is definitely the right thing to do. I think that there is a more elegant way to write this, but that feels outside the scope of this change.

This revision is now accepted and ready to land.Jun 30 2020, 8:36 AM

Rebase this revision on top of the cleanup revision. (git rebase was
able to do the rebase automatically.)

Is there anyone I should add as reviewer for the MSVC configuration?

This revision was automatically updated to reflect the committed changes.