This is an archive of the discontinued LLVM Phabricator instance.

[libc] Add Uint128 type as a fallback when __uint128_t is not available.
ClosedPublic

Authored by sivachandra on Jun 21 2022, 2:05 PM.

Details

Summary

Also, the unused specializations of __int128_t have been removed.

Diff Detail

Event Timeline

sivachandra created this revision.Jun 21 2022, 2:05 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptJun 21 2022, 2:05 PM
sivachandra requested review of this revision.Jun 21 2022, 2:05 PM
lntue added inline comments.Jun 21 2022, 3:40 PM
libc/src/__support/CPP/Limits.h
77–88

Can you just include "Uint128.h" and only specialize the template for UInt128 so that there is no need for #ifdef here?

libc/src/__support/CPP/TypeTraits.h
59–62

Can you just include "Uint128.h" and only specialize the template for UInt128 so that there is no need for #ifdef here?

libc/test/src/__support/high_precision_decimal_test.cpp
354

#ifdef's are not needed in this test anymore.

libc/test/src/__support/str_to_float_test.cpp
317

Not needed anymore.

libc/utils/UnitTest/CMakeLists.txt
8

Too many tests using uint128 implicitly I guess?

libc/utils/UnitTest/LibcTest.cpp
59–69

Combine the specializations with UInt128.

257–271

Combine the specializations with UInt128.

sivachandra marked 2 inline comments as done.

Address comments.

libc/src/__support/CPP/Limits.h
77–88

I have added comments now to explain why we need both specializations. Essentially, we need both so that we can uniitest UInt<128> on platfroms where UInt128 resolves to __uint128_t.

libc/src/__support/CPP/TypeTraits.h
59–62

Same reason as above; added comments here as well.

libc/utils/UnitTest/CMakeLists.txt
8

This change isn't changing the situation. The deps were incomplete previously.

libc/utils/UnitTest/LibcTest.cpp
59–69

Same reason as above. Added a comment now.

257–271

Ditto.

This revision was not accepted when it landed; it landed in state Needs Review.Jun 24 2022, 9:03 AM
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.

I have landed this now unblock other work. I am happy to do follow up changes as required.