This is an archive of the discontinued LLVM Phabricator instance.

[libcxx][test] Neither MSVC nor its STL support int128
ClosedPublic

Authored by CaseyCarter on Feb 16 2022, 10:39 PM.

Details

Summary

Define TEST_HAS_NO_INT128 accordingly.

Diff Detail

Event Timeline

CaseyCarter requested review of this revision.Feb 16 2022, 10:39 PM
CaseyCarter created this revision.
Herald added 1 blocking reviewer(s): Restricted Project. · View Herald TranscriptFeb 16 2022, 10:39 PM

This change probably is good in itself, but the situation of __int128_t in clang-cl environments is actually more complex than that.

Clang-cl actually does support code generation for the __int128_t type, but it doesn't have access to the division helper routines provided by compiler-rt builtins normally.

Regarding libc++ (which is only tangential, as I take it your commit is about testing STL with libc++'s testsuite) - in https://reviews.llvm.org/D91139 I suggested explicitly disabling use of __int128_t in libc++ due to this (as it can't be used as-is), but it was decided the way forward was to provide those helpers, somehow, e.g. the comment https://reviews.llvm.org/D91139#2429595. But there hasn't been any other specific progress on that front since, and the clang-cl CI configurations build with _LIBCPP_HAS_NO_INT128 explicitly defined: https://github.com/llvm/llvm-project/blob/d271fc04d5b97b12e6b797c6067d3c96a8d7470e/libcxx/utils/ci/run-buildbot#L99-L113

CaseyCarter retitled this revision from [libcxx][test] Compilers emulating MSVC do not support int128 to [libcxx][test] Neither MSVC nor its STL support int128.

Update to allow clang-cl + libc++ to support int128.

Quuxplusone requested changes to this revision.Feb 17 2022, 12:15 PM
Quuxplusone added a subscriber: Quuxplusone.
Quuxplusone added inline comments.
libcxx/test/support/test_macros.h
369

Do we support any compilers that predefine both __SIZEOF_INT128__ and _MSC_VER, and yet don't support __int128? I bet the answer is "no." If the answer is "no," then you should remove || defined(TEST_COMPILER_MSVC) from this line, leaving only

#if defined(_LIBCPP_HAS_NO_INT128) || defined(_MSVC_STL_VERSION)

which sounds about right to me: it says "If this is libc++ with no int128, or if this is MSVC STL which never has int128, then..." What C++ compiler we're using shouldn't matter at all, because we should just trust the library (libc++ or MSVC STL) to relay accurately the situation re int128 support.

I notice that we're implicitly assuming that libstdc++ always supports int128, which I'm sure is technically wrong; but we can leave that to the libstdc++ people to sort out. :)

Someone +1 my logic and then I'll approve this. ;)

This revision now requires changes to proceed.Feb 17 2022, 12:15 PM
CaseyCarter added inline comments.Feb 17 2022, 12:22 PM
libcxx/test/support/test_macros.h
369

Yes, I agree this falls out of the definition of _LIBCPP_HAS_NO_INT128. Fixing.

Thanks to Martin for telling me this was broken, and to Arthur for fixing it.

This revision is now accepted and ready to land.Feb 17 2022, 1:48 PM
This revision was landed with ongoing or failed builds.Feb 17 2022, 2:08 PM
This revision was automatically updated to reflect the committed changes.
CaseyCarter marked an inline comment as done.